Home Assistant is automation platform for home written on Python. It allows to connect a whole bunch of devices and create rules to perform automated tasks.
For Mac OS and Linux there are instruction on how to daemonize (autostart) the platform. So, here are the missing for Windows.
There numerous way to run a Python script as Windows Service, including the accepted answer on StackOverflow, but IMHO a much simpler approach is by using NSSM.
Download and extract NSSM from here
Run from command line
\win64\nssm.exe install HomeAssistantwhich will launch configuration UI for service
In this example I installed "Home Assistant" under Python Virtual Environment located at
C:\hass-env\, which places executable at
C:\hass-env\Scripts\hass.exe. The configuration folder is located in
%appdata%\.homeassistant\, hence will pass it location via argument
Details screen is self explanatory:
I'm running it with
Local Systemaccount (this is why I needed to specify configuration folder in step #3 to my
To catch log information written to console I defined I/O redirection to custom log file:
You can define file rotation in case output file growths fast as following:
Install serviceand you be able to find it in SCM:
At this stage you should be now able to start, stop and restart the service. If error thrown during startup, the service won't start and you can check the log file for details.