Home Assistant Community

Autostart on Windows

#1

How do you autostart Home Assistant on Windows 10?

1 Like

Starting with HA on windows 7
#2

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.

4 Likes

#3

Thanks for sharing @masterkenobi,

What about adding this great instructions in the installation section in the portal??

Any admin can do it??

0 Likes

#4

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
:minimized
py -3 -m homeassistant --open-ui

0 Likes

#5

But that requires to log in in the system, doesn’t it?

On the other hand master’s solution is more service oriented.

0 Likes

#6

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.

0 Likes

#7

If you want to run it as a service, I found this post very helpful:

2 Likes

#9

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
%APPDATA%/.homeassistant
to this new directory.

1 Like

#10

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?

0 Likes