Skip to main content

Install NetDaemon runtime

There are several ways to deploy your apps. You could just run the development project and set it up yourself. NetDaemon provides a convenient ways to run your apps:

  • Using a Home Assistant add-on
  • In a docker container

So let's set it up before we can deploy the apps to it.

Install NetDaemon as a Home Assistant add-on#

Two versions are provided, release and dev. If you feel you always want the latest and greatest changes you can choose the dev build but be prepare that things break!

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

  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.

  4. Deploy your apps in the /config/netdaemon/apps folder.

Advanced add-on configurations#

The standard way running your apps in add-on is just to copy the .cs and .yaml files to /config/netdaemon/apps and it will dynamically compile and run them. If you want to use own project with custom dependecies you will have to use the advanced deployment options. Specify the AppSourcesetting in add-on config. If you set a app_source: folder, the it will dynamically compile and run apps in /config/netdaemon/folder. If app_source: daemonapp.csproj it will compile and run the project in /config/netdaemon/daemonapp.csproj with all it's dependencies. Set the app_source: daemonapp.dll it will run the published project in /config/netdaemon/daemonapp.dll.

There is not way to include other dependecies in standard dynamically compiled option You will have to run the two other advanced option to include for example a external nuget package.

Install as a docker container#

If you are using Home Assistant Core and not have the possiblity 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 netdaemon \
--restart=always \
-e HOMEASSISTANT__HOST=192.168.1.4 \
-e HOMEASSISTANT__TOKEN=XXXXX \
-e NETDAEMON__GENERATEENTITIES=False \
-e LOGGING__MINIMUMLEVEL=info \
-e TZ=Europe/Stockholm \
-p 1337:1337 \
-v ~/netdaemon_config:/data \
netdaemon/netdaemon

-p 1337:1337 is only needed if you want the admin panel

Example using docker-compose.yaml#

version: '3.7'
services:
netdaemon:
image: netdaemon/netdaemon # use netdaemon/netdaemon:ver
# for specific version
container_name: netdaemon
restart: always
environment:
- HOMEASSISTANT__HOST=your_ip_or_hostname
- HOMEASSISTANT__TOKEN=your_token
- NETDAEMON__GENERATEENTITIES=False # True if generate enitites
- LOGGING__MINIMUMLEVEL=info # use trace/debug/info
- TZ='Etc/UTC' # Set your current timezone
ports:
- 1337:1337 # This is required only if
# you are running the GUI
volumes:
- /config/netdaemon:/data # replace /config/netdaemon
# to your local folder

Evironment variables#

The docker container needs 3 enviroment 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__TOKENA Long Lived Acces Token(LLAT) that NetDaemon can use for the comminication with Home Assistant.
NETDAEMON__GENERATEENTITIESDefaults to False, set True if you want the autogenerated entities
LOGGING__MINIMUMLEVELDefaults to info, values are (trace, debug, info, warning, error)
TZYou will need to set container time zone to make the scheduler work properly
NETDAEMON__APPSOURCENETDAEMON__APPSOURCE is used to setup more advanced runtime options. If you set a folder, the deafult dynamically compiled apps should be set in this folder. If daemonapp.csproj the runtime will run that project with all it's dependencies.Set to daemonapp.dll for published project. For standard dynamically compiled projects you do not have to set this setting.
NETDAEMON__ADMINSet this to false to disabled the Admin UI.

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 need to point to the netdaemon folder. See image below. The red arrow in the example configuration below points to the folder that should be mapped to the /data!