Skip to main content

Install NetDaemon runtime

There are several ways to deploy your apps:

  • Using a Home Assistant add-on
  • In the NetDaemon Docker container
  • Or using the template as base to deploy your own setup

Deploy as Home Assistant add-on

Once added to Home Assistant, select one of the V3 versions. If you feel you always want the latest and greatest changes you can choose the dev build but be prepare that things can break!

  1. Make a folder structure under your Home Assistant configuration directory to use for NetDaemon apps. /config/netdaemon4

  2. Add the https://github.com/net-daemon/homeassistant-addon in Add new repository URL to the add-on store.

  3. Add the NetDaemon add-on.

todo: add new image

  1. Deploy your apps and .yaml files in the folder /config/netdaemon4.

Deploy compiled assemblies and configurations

Copy your published files from dotnet publish -c Release -o [outputdir] to /config/netdaemon4. All the binaries and configuration should be copied.

See also tutorial Publish NetDeamon apps with Powershell.

In the add-on config, specify the app_assembly setting to point to the assembly relative to your /config/netdaemon4 folder. This assembly should be the entry assembly (dll) from your project template. You can also add a path to the configuration folder separately. This is an example of how the configuration should appear using the default template:

The name of the assembly may be different.

note

To use Visual Studio's publish feature first install & configure the Samba share Home Assistant addon, then configure your VS publish options:

Now you can publish to quickly deploy files, and restart NetDaemon to run them.

Deploy source files and configurations

Copy the .cs and .yaml files to /config/netdaemon4 folder from the apps folder using the template project and start/restart the NetDaemon add-on.

Install as a Docker container

If you are using Home Assistant Core and do not have the possibility to run add-ons, using the Docker container is a convenient way to run NetDaemon apps.

Always use specific versioning tags of Docker containers (not latest or dev) cause these are constantly getting new versions and things could break You can always find the latest stable version here

Example Docker run configuration

docker run -d \
--name netdaemon4 \
--restart=always \
-e HomeAssistant__Host=192.168.1.4 \
-e HomeAssistant__Token=XXXXX \
-e NetDaemon__ApplicationAssembly=NetDaemonApps.dll \
-e Logging__LogLevel__Default=Information \
-e TZ=Europe/Stockholm \
-v ~/netdaemon_config:/data \
netdaemon/netdaemon4

Example using docker-compose.yaml for

version: '3.7'
services:
netdaemon:
image: netdaemon/netdaemon4 # use netdaemon/netdaemon4:ver
# for specific version
container_name: netdaemon4
restart: always
environment:
- HomeAssistant__Host=your_ip_or_hostname
- HomeAssistant__Token=your_token
- NetDaemon__ApplicationAssembly=NetDaemonApps.dll
- Logging__LogLevel__Default=Information # use Information/Debug/Trace/Warning/Error
- TZ=Etc/UTC # Set your current timezone
volumes:
- /config/netdaemon:/data # replace /config/netdaemon
# to your local folder

Environment variables

The Docker container needs these environment variables to run properly.

ENVDescription
HomeAssistant__HostThe host that is running Home Assistant (defaults to localhost)
HomeAssistant__PortThe port Home Assistant is running on (default to 8123)
HomeAssistant__SslSet to True if SSL is used to access Home Assistant.
HomeAssistant__TokenA Long Lived Access Token(LLAT) that NetDaemon can use for the communication with Home Assistant.
HomeAssistant__InsecureBypassCertificateErrorsIgnores certificate errors. Please use at own risk.
NetDaemon__ApplicationAssemblyUse this for the Deploy compiled assemblies option. Set to {your_assembly}.dll. For source deployment you should not set this setting!
Logging__LogLevel__DefaultDefaults to Information, values are (Trace, Debug, Information, Warning, Error)
TZYou will need to set container time zone to make the scheduler work properly
NetDaemon__ApplicationConfigurationFolderIf you want to select another folder for your YAML configurations. Standard is /data

Volumes

VolDescription
/dataThe volume of the NetDaemon folder should be mapped to /data See how to setup the correct folder here

Folder structure and where to map the Docker volume

The ~/netdaemon_config needs to point to a local folder. See image below where the local folder is named netdaemon4 and should be mapped as volume to the /data! You can use any folder name you like to use.