Autostart on Windows

How do you autostart Home Assistant on Windows 10?

1 Like

OK. I am gonna answer my own question here…

Somehow I manage to achieve this by following these steps…

  1. Open up Task Scheduler (can use search tool to look for it)
  2. Click on “Task Scheduler (Local)” on the left panel and then select “Create Task…”
  3. Under General tab, give it a name and then select “Run whether user is logged on or not”…

  1. Under Triggers tab, click on “New…” button and then for “Begin the task” option, select “At startup”…

  1. 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”

  1. 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.

  1. Under Settings tab, uncheck “Stop the task if it runs longer than:” so that it will continue to run forever.

  1. 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

@echo off
if not “%minimized%”=="" goto :minimized
set minimized=true
start /min cmd /C “%~dpnx0”
goto :EOF
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.

1 Like

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.

1 Like

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?

I am going to try to dig up this zombie. :wink: I tried to ask in a new thread a week ago, but didn’t get any answers. So: It’s not working for me, probably because I installed in a virtual environment. I have tried to search the forum and Google but not found anything that helps me do that. Any ideas?

Why not just use nssm?

Mostly because I had never heard about it… :wink: I’m using Startup Delayer now, which works nicely.

I use nssm because i would prefer to have a service so it can start when the machine starts. Task scheduler is good, but If I want to easily stop and start the application, all I need to do is go to services.

@hitnrun30 I tried to do that now, on another Windows computer I want to run Hass on. But I get a weird eror message about being unable to start service, and “the service did not return an error”. Any idea what that can be? I see something weird in the service manager in Windows: The executable is set to C:\Users\Automatisering\AppData\Local\Programs\Python\Python38\nssm.exe, not C:\Users\Automatisering\AppData\Local\Programs\Python\Python38\python.exe Is that the problem, or is that just because the nssm has installed the service? I have nssm in the Python38 directory because it’s in PATH.

Have you ever created an nssm before? You use it to create a service, so the command is:

nssm create [service name]

if you made a virtual env then go to the script should be where the hass file is and add --open-ui as a command line argument. Sorry to be a little vague, but my machine is turned off because of construction.

Guys, the easiest way in Windows is just to create a shortcut from “pythonw.exe”, edit the shortcut properties, and add " -m homeassistant" to the target field.

The service will run in the background with no visible cmd window.
If you wish to add this to the startup just move the shortcut to the startup folder as other users suggested.