Get started with NetDaemon app development
1. Clone the app-template#
The easiest way to get started with app development for NetDaemon is to use or clone the app template repo. That will give you everything you need to get started developing your first automation.
Example, cloning the template project directly and rename it
2. Enable remote development in devcontainers#
If you are using Visual Studio Code, devcontainers are the preferred way to develop your apps. If you are running Visual Studio, skip this step. This also requres docker to be installed.
- Install remote Development extension in VSCode if you have not allready.
- Open folder, the newly cloned template
- Run task:
Remote-Containers: Open Folder in Container. Wait until it fully opened
3. Make configurations#
NetDaemon development environment needs to be configured to connect to Home Assistant. Minimal config is: hostname/ip, port and access token.
- Rename
_appsettings.jsontoappsettings.json. - Edit the values in the appsetting
appsettings.json. Following settings are mandatory:Host, the ip or hostname, (port defaults to 8123)Token, the long lived access token
Example appsettings file
Develop and debug your apps#
Now properly configured you can develop your application. The template shows example of both develop and test your apps. A sample app has been provided for you: src/apps/HelloWorld/HelloWorld.cs.
Debug and run your apps and view log output for errors.
Deploy your apps#
After you have developed and tested your apps it is time to deploy and run the apps in the production environment. That's what we will look at next...