How do you autostart Home Assistant on Windows 10?
OK. I am gonna answer my own question here…
Somehow I manage to achieve this by following these steps…
- Open up Task Scheduler (can use search tool to look for it)
- Click on “Task Scheduler (Local)” on the left panel and then select “Create Task…”
- Under General tab, give it a name and then select “Run whether user is logged on or not”…
- Under Triggers tab, click on “New…” button and then for “Begin the task” option, select “At startup”…
- Under Actions tab, click on New… button and then under Action, select “Start a program”. Under Settings, browse to your python.exe file. Mine is located at “C:\Users\Masterkenobi\AppData\Local\Programs\Python\Python35\python.exe”. For Add arguments field, enter “-m homeassistant”
- Under Conditions tab, uncheck “Start the task only if the computer is on AC power”. I need this because I want it to run even if the PC is on battery. You can skip this.
- Under Settings tab, uncheck “Stop the task if it runs longer than:” so that it will continue to run forever.
- Once you click OK, it will prompt you for your password. Enter the password you normally use to logon to your Windows.
You are done!
To test it, reboot your PC and wait for few minutes before try to load the page in your other PC.
Thanks for sharing @masterkenobi,
What about adding this great instructions in the installation section in the portal??
Any admin can do it??
I did this made it a batch file and put it into my startup folder
if not “%minimized%”=="" goto :minimized
start /min cmd /C "%~dpnx0"
py -3 -m homeassistant --open-ui
But that requires to log in in the system, doesn’t it?
On the other hand master’s solution is more service oriented.
Mine doesn’t run as a service correct. It is on a headless windows 10 pc I use as a server so it doesn’t have users or sign in accounts. However it does do what I want and what the title of the post asks about. Auto starting on windows.
If you want to run it as a service, I found this post very helpful:
If you want to register the account under another user’s name because your password frequently changes or some other reason, you need to set the “Add arguments” box to:
-m homeassistant --config c:\users\public\homeassistant
or some other publicly accessible directory, as the other user probably won’t be able to access the config files under your AppData directory. Move the config files from
to this new directory.
I have a shell command that runs a python script to play a sound on my windows machine. If I run HA in the command terminal, the shell command plays the sound. When I run HA by the Task Scheduler, the shell command doesn’t play the sound. Do you know how I can get it play a sound with Task Scheduler?