If you are using HassClient today and want to migrate to v3 you have two options:
- Manually copy your existing apps over to a new copy of the v3 app template. This is the recommended approach. See how to get the template here
- Manually update your project to support the new v3 packages. This is recommended if you have a more complex NetDaemon project - see the section below for more details.
Please do not mix the models in the same project! If you are upgrading app by app and have both V2 and V3 apps for a time please use two different deployments/add-ons and locations for your V2 and V3 apps!
Here is a summary of the main changes between the versions:
- New namespaces
NetDaemon.Runtime. If you are using HasClient today you should just replace any
NetDaemon.AppModel. We recommend check out the how to get the template here..
- Configuration using yaml is changed. Configuration is now only available as injected
IAppConfig<Class>in constructor. To migrate, copy public properties to own config class and change the yaml using that class name instead of app name. Class property on yaml can be removed.
- Base class based on
NetDaemonRxAppis not supported at all. You will need to migrate your applications to HassModel before upgrade to NetDaemon 3.
Upgrading an existing apps project to v3
There are five main considerations when upgrading a new project to use v3 (before you begin taking advantage of the new functionality!):
program.csto use the new application startup and configuration
- Update your nuget packages
GlobalUsings.csto refer to the new namespace
appSettings.jsonto reflect a change in config
- Update your locally installed code generator
After you have tested your project locally you will need to update your NetDaemon install on Home Assistant to v3.
1. Update program.cs
Refer to your project's
program.cs and check the main application startup block. You will likely have a section that looks like this:
Update this to reflect the makeup of the new v3 app template's program.cs - before you do this, check whether you are using a custom logger or any other custom configuration, and copy this out of the way. You can copy it back again after you have updated to the v3 startup.
Please check the up-to-date version here rather than copy/pasting from this page. The example below is just to give you an idea of what the new code looks like but the app template may have been updated since this documentation was written.
When finished, your
program.cs should look similar to this:
#pragma warning disable CA1812
.ConfigureServices((_, services) =>
2. Update your nuget packages
Remove the following packages:
Add the following packages:
Finally, ensure that all packages are updated to the latest versions.
3. Update global usings
// Common usings for NetDaemon apps
global using System;
global using System.Reactive.Linq;
global using Microsoft.Extensions.Logging;
global using NetDaemon.AppModel; // <--- changed
global using NetDaemon.HassModel; // <--- changed
4. Update appSettings.json
There is a breaking change in your
appSettings.json file - in the
NetDaemon section rename the
AppSource key to
ApplicationConfigurationFolder. Note also that the default application source folder has changed from
5. Update the code generator
As some of the namespaces have changed you should update your locally installed version of the Code generator by running the following command:
dotnet tool install -g JoySoftware.NetDaemon.HassModel.CodeGen
...and then re-run the generator to create an updated version of
Update the version of NetDaemon in Home Assistant
If you still have v2 of NetDaemon installed inside Home Assistant ("HA") then that will not be able to run your v3 apps. You should remove the v2 install from HA first, then install the v3 version.
After you have done so remember to check the configuration (the default config path changed from
/config/netdaemon3) and re-deploy your apps project to it, then restart NetDaemon and check the logs.
You can find the installation instructions here