Home assistant raspberry shutdown

Home assistant raspberry shutdown

Home Assistant Add-on: RPC Shutdown

Follow these steps to get the add-on installed on your system:

  1. Navigate in your Home Assistant frontend to Supervisor ->Add-on Store.
  2. Find the «RPC Shutdown» add-on and click it.
  3. Click on the «INSTALL» button.

In the configuration section, define alias, address and credentials and save the configuration.

  1. Start the add-on.
  2. Check the add-on log output to see the result.

Option: computers (required)

A list of computer objects to be able to shutdown from Home-Assistant.

Option: computers.alias (required)

Set an alias for this record, which becomes the name for the input.

Option: computers.address (required)

IP address or NetBIOS name of the computer to be able to shutdown.

Option: computers.credentials (required)

Credentials for logging into the computer. Use a % as the delimiter of username and password.

Option: computers.delay (optional)

A delay (in seconds) before shutting down the computer. This gives a user that happens to be using that computer time to save their work.

Option: computers.message (optional)

Show a custom message on the screen of the computer that will be shutdown.

Home Assistant configuration

Use the following inside Home Assistant service call to use it:

Each line explained:

service: hassio.addon_stdin : Use hassio.addon_stdin service to send data over STDIN to an add-on. data.addon: core_rpc_shutdown : Tells the service to send the command to this add-on. data.input: test-pc : Alias name created for the computer in the add-on configuration, and shuts that one down.

You have several options to get them answered:

  • The [Home Assistant Discord Chat Server][discord].
  • The Home Assistant Community Forum.
  • Join the Reddit subreddit in /r/homeassistant

In case you’ve found a bug, please open an issue on our GitHub.



Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats


Failed to load latest commit information.


Simple service to run on Raspberry Pis and report data back to Home Assistant. Also provides switches so you can reboot or shutdown the Pi from within HA.

  • Install psutil
  • Install paho-mqtt
  • Clone this repo to /home/pi
  • cd home-assistant-pi
  • cp config-sample.json config.json
  • Edit config.json to set all of the options. Change HOSTNAME to whatever you want to use as a name and make sure your HA config also matches.
  • Configure Home Assistant. Here’s an example of some configuration.yaml settings:
  • You probably want to run this program as a service , so I’ve provided some help here.

Interact with the service

sudo systemctl status home-assistant-pi.service

sudo systemctl start home-assistant-pi.service

sudo systemctl stop home-assistant-pi.service

Check service’s log

sudo journalctl -f -u home-assistant-pi.service


Raspberry Pi service which sends data to Home Assistant and allows HA to send reboot/shutdown commands to the Pi.


Home Assistant Wake On Lan & Home Assistant RPC Shutdown (HOW-TO)

Last updated by Kiril Peyanski on 15/06/2022

I will show you how to create Home Assistant Wake on Lan (WoL) switch to turn on your desktop computer. As well as how to use Home Assistant RPC shutdown add-on to turn off a Windows PC with a click of button.

Using Home Assistant you can control many things and probably you already doing this, but after you read this you will add your computer to the list. Let start this!

Table of Contents

What is Wake on LAN (WoL)?

Wake on Lan is a standard that allows a computer to be awakened by a network message called magic packet. To use the Wake On LAN, your computer should support this feature and it have to be always connected to your network. You can use Wake on LAN regardless of the installed Operating System as this feature is usually controlled by the motherboard of your device.

After you finish reading this you will be able to create a Home Assistant Wake on LAN Switch, Script or Automation that will awaken any device that supports WoL.

What is RPC Shutdown?

On the opposite side to turn off a Windows PC from Home Assistant you will need the Home Assistant RPC Shutdown add-on. The RPC Shutdown add on is available in the Add-On store in Home Assistant and you can install it with 1 click.

If you don’t have Home Assistant yet, or your Home Assistant is without the Supervisor menu (Add-on store) check these two tutorials of mine and you will have everything that is needed in no time:

  • Home Assistant Supervised 👉 LINK
  • Home Assistant OS 👉 LINK

How to Enable Wake On Lan in BIOS?

First of all you have to check that the device that you want to turn on remotely support the Wake On Lan functionality. Check your motherboard manual or enter in the BIOS (usually by hitting the Del, button or a specific functions keys during the startup of your system).

Every motherboard vendor is having different place and even different wording for the Wake On Lan feature, so you’ll have to search for it a bit in the BIOS menus or in the manuals.

Enable Wake on Magic Packet in Windows 10

Sometimes it is necessary to enable wake on magic packet option on your network adapter in Windows and this is how I did it in Windows 10.

Right click on the Start menu > Device Manager > Network Adapters > right click on your network adapter and select Properties > Advanced > Wake on magic packet > Enabled.

Home Assistant Wake on LAN

It is time to add and configure the Home Assistant Wake on Lan integration.

Add the following text in configuration.yaml file and you will have the Wake on LAN platform enabled in your Home Assistant.

You will need to restart your Home Assistant before start using the Wake on LAN integration, but don’t do that yet. We will add the Home Assistant Wake On LAN switch in the next section and we will restart afterwards.

Add Home Assistant Wake on LAN switch

Only adding the things described in the above section in Home Assistant configuration is not enough. You may want to have a switch, script or automation in Home Assistant that will wake a specific PC or multiple PCs. This is what you can do for a Home Assistant Wake on LAN switch:

First, you will need the MAC address of the PC of your interest. You can get the MAC address either from your router interface or from the Windows command prompt using the ipconfig /all command.

Second, you have to add the following YAML in the configuration.yaml file using text editor or add-on like File Editor.

Make sure that you do the following things:

  • If you already have switch: section in your configuration.yaml file add only the last 3 lines under your existing section.
  • Change the mac: value with your MAC address.
  • Change the name: to something meaningful for you (e.g. hostname of the device)
  • Save the changes and restart Home Assistant.

Test the Home Assistant WoL switch

Let’s quickly test if the Home Assistant Wake on LAN switch can actually wake our PC.

You can add a button to the Home Assistant Lovelace UI by click on the three dot menu in the upper right corner > Edit Dashboard > Add Card > Button Card > as entity select your newly created switch (i.e. switch.a3_pc) > Save

Before the actual test you have to put your computer to sleep. If you shut it down the Wake on LAN may or may not work.

And now when your PC fell asleep 💤 and you have a Button card with your WoL switch in Home Assistant – you can just press it and your PC will rise from the dead. 🎉

Home Assistant RPC Shutdown add-on

Okay Wake on LAN Is working, but what if you want to turn off a Windows PC from Home Assistant? The Home Assistant RPC shutdown add-on available in the Home Assistant store will save the day. Let’s install it

Open your Home Assistant and press, the “ c ” button to invoke the search bar, type add-on and choose Navigate Add-On store. Then search for RPC Shutdown or save the hassle and click on the link below, which will lead you to the same place.

Click on the Install button to have your RPC Shutdown add-on.

After the installation we will need the IP, username and password of the windows machine to configure properly the RPC shutdown add-on. This is an example configuration for my Windows PC, of course you can add multiple computers as well (just add more aliases).

Make sure that you do the following changes under the Configuration tab in RPC shutdown add-on:

  • Change the alias: with something meaningful for you (e.g. hostname of the device)
  • Change the address: value with the IP address of the computer that you want to wake (Get it from your router interface or use again the ipconfig /all command from Windows command prompt)
  • Change the credentials: values with your Windows user & pass (i.e. user%pass)
  • Save the changes and start the RPC shutdown add-on from the Info tab.

Add Home Assistant RPC Shutdown switch

To test if the shutdown of a Windows PC from Home Assistant is working – we will edit our switch that we created in the Add Home Assistant Wake on LAN switch section above.

Go back to your configuration.yaml file and add another 6 lines under the existing WoL switch, so your code at the end should look similar to the one below.

The things that you have to change here are the following:

  • The value of the host: parameter with the IP of the machine that you want to shutdown.
  • The value of the input: parameter, where the value should be exactly the same as the alias in the RPC shutdown configuration. In my case the value everywhere is my windows pc hostname (a3-pc).
  • Save the changes and restart Home Assistant.

After Home Assistant has started – you can try to shutdown the Windows PC (a.k.a the victim) by pressing the same button that wake our PC earlier in the Home Assistant UI.

If your computer shut down correctly – you are done with this guide and you don’t have to do anything else, except you can show off in the comments section below.

If your computer doesn’t want to shutdown, check the RPC Shutdown Logs section and continue reading.

What If RPC shutdown is not working?

If you see any of the errors below in the RPC shutdown log section:

Also the Home Assistant RPC shutdown is not working – you have to do several extra steps. Namely to start a Remote Registry service, to create a WMI firewall rule and to add a local policy in your Windows registry.

Don’t worry it is easy, not that easy as subscribing to my newsletter, but I will show you all of the steps.

Start Remote Registry Service in Windows

Click on Start menu > select Run > Type services.msc and click OK > In the Services window search for Remote Registry service > Double click on it and set the Startup type: to Automatic > Click Apply > Finally start the service by click on Start button.

You can try again to shutdown your PC from Home Assistant after you start the Remote Registry service, but most probably you will fail, so keep reading.

Allow WMI in Windows Firewall

We have to create a simple Firewall Rule. Here is how:

Click on the Start button and type “allow” > Click on the Allow an app through Windows Firewall result > in the opened window scroll down until you see Windows Management Instrumentation (WMI) > Click on Change settings button and tick the checkbox under the Private column > finally click OK button.

You can try again to shutdown your PC from Home Assistant after you allow the Windows Management Instrumentation (WMI) in the Windows Firewall, but most probably you will fail, so keep reading.

Adding Local Policy in Windows Registry

It is Time to edit the Windows registry just a little bit :

Add a 32-bit DWORD named “LocalAccountTokenFilterPolicy” with a value of “1” (without quotes) under the following path in the windows registry: HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System

Or download and start the following LATFP.reg file that I made, which is doing the exact same thing 👉 LINK

After this last step you can try again the Home Assistant RPC Shutdown and this time it should work. Congratulations 🥂

Support My Work

If you want to secure this site existence you can become one of my Patreons where you will receive early access to my content, exclusive content and depending of the tier – free access to my paid Smart Home Guide.

Of course there are other support options available and you can check them here 👉 LINK

With that being said, stay safe and don’t forget – Home Smart, but not hard!

Thank you for watching and I will see you in my next article.