Links on the site may earn us an affiliate commission. Learn more.

Today, I’m going to show you the method that I personally use to send commands from Home Assistant to a Windows computer. So you can do things like turning the computer on, shut it down, open programs and much more.

What’s needed

To make this work, you’ll need a few things. To turn the computer on, you can use the Wake on LAN component in Home Assistant. Then, to send commands to shut down and do other tasks on the computer, you will need the following:

I know, it sounds like a lot of steps, but it’s actually not. It’s just for the initial set up. Once this is done, setting different automations would be a lot easier to do.

Set up the Wake on LAN component

Open the Home Assistant Configuration.yaml file and enter, wake_on_lan:. Save the changes and then create a new switch to turn the computer on and off. Open the switch.yaml file and enter the following:

- platform: wake_on_lan
  name: "Your_PC_Name"
  mac_address: "A1:B2:C3:D4:E5:F6"
  host: 192.168.XX.X
  turn_off:
    service: script.pc_off

For the platform, enter the wake_on_lan component. Set up a name for the computer, then enter the computer’s mac_address and the IP address under host.

NOTE: Set up a static IP address for the computer on your router. So, the component can use the host IP to check on the current state of the computer.

Lastly, for the turn_off variable set the service using a script which we’ll create later on. Save the changes and restart Home Assistant.

Install Join on Android

To turn the computer off and send other commands to the computer, install the Join app on an Android device first. So you can then use the Join component in Home Assistant.

Join is an app similar to Pushbullet. It links an Android device to a computer, allowing to see the device’s notifications, send and receive text messages, send commands back and forth and so much more.

The Join app is not available on IOS devices. However, there is a Windows app available that you could use to do the initial set up. However, I would only use the Windows app if you don’t have an Android device or if you don’t use the Chrome browser to set up the Join extension.

One main reason is that Join has end-to-end encryption. But, the windows app doesn’t have that feature available. You can only use the encryption when using the Android app and the Chrome extension.

After you install the app, open it, and sign in using your Google credentials. This allows Join to use Google Drive to securely store data that is pushed between devices instead of using a 3rd party server. Then, to enable encryption, go into SettingsEncryption, and enter a new password.

Remember that password because you would also need to set it up on your computer so it can decrypt the data that is sent and received.

Install Join extension

On the computer, go to the Chrome web store, install the Join extension, and sign in using your Google Credentials. Then, open the extension, and you should then have 2 devices, your computer, and the Android device where you did the initial set up.

To set up encryption, click on the Menu icon, Encryptions, and then enter the same password you set up on the Android device.

Set up Join component

To configure the Join component in Home Assistant, you’ll need to get the Join API Key and the device ID for the computer. You can get that information by accessing Join on the web using this link: https://joinjoaomgcd.appspot.com.

Join on the web allows managing all devices linked to Join from any device. Without having to use the app or the Chrome extension. For example, on an IOS device which the app is not available. You could still get some functionality via the browser.

Here you would have 2 devices. The Android device where you did the initial set up and the computer which shows the default name as Chrome.You can change the name by selecting the device and then click on, Rename To get the devices ID and also the API key. Select the computer and then click on Join API. In there, you also get the Join webhook which you’ll need to set up in EventGhost later on. Now, that you have this information, open the Home Assistant configuration.yaml file and enter the following:

joaoapps_join:
  - name: Computer
    device_id: Computer_Device_ID
    api_key: Join_API_Key

Set up the name for the computer, enter the Join device_id assigned to the computer, and then the Join api_key. If you have multiple devices that you want to add, you can add it below using the same variables. Just set the name for the device and the specific device_id.

  - name: Phone
    device_id: Phone_Device_ID
    api_key: Join_API_Key

Set up Join on the Notify component

The other thing that you want to set up here is the Join platform in the Notify integration. This allows sending messages from home assistant to the devices using Join. One perfect example would be to create an automation that would send a notification to your phone when your computer is turned on. I’ll show you how to do that later on. To set up the Join platform in the Notify integration, add the following to the configuration.yaml file:

notify:
  - platform: joaoapps_join
    api_key: !secret Join_api_key
    device_id: !secret Join_Juan_phone_id
    name: Phone

If you have more than one device that you want to send notifications to, you can add another device below using the same variables. Just change the name for the device and enter the specific device_id.

  - platform: joaoapps_join
    api_key: !secret Join_api_key
    device_id: !secret Join_PC_id
    name: Computer

Restart Home Assistant to apply the changes. Then, when is back online, go into Developer ToolsServices and search for joaoapps_join. You would see the new Join devices added. The same things goes if you search for notify. It will show you the Join devices that you can send custom notifications from Home Assistant.

Install EventGhost and set up AutoRemote

So, Join is now set on an Android device, the Windows computer and also the Home Assistant server. Next, install EventGhost, and the AutoRemote plug-in, So Join can communicate with EventGhost.

To install EventGhost, you can do it directly from the GitHub website.

The last version that was made was 0.5 rc6. Even though this is a pre-release version, it works with no problems. I’ve been using it since it came out and have never had any issues with it.

After you install EventGhost, download the AutoRemote plug-in from here.

On the joaoapps website click on AutoRemote EventGhost plugin file to save it to your computer. Then, add that file to the EventGhost Plugin folder. So, go into your C drive, Program Files (x86)EventGhost, and Plugins. Create a new folder named AutoRemote and then save the file in there.

Configure Join in the AutoRemote plugin

Open the Join Chrome extension and go into SettingsAdvanced and then under EventGhost, add the port 1818. Then, get the Join webhook from Join On the web. In there, select your computer, click on Join API, then under API Key, click on Show and copy the Join webhook below.

After that, open EventGhost and click on ConfigurationAdd Plugin and then, AutoRemote. Under Device Name, enter the name for your computer and then, enter the Join webhook under Device Key. Click on Apply and Allow AutoRemote access to your Google Drive.

Now, because this is the first time that you’re using EventGhost, is going to ask you to save the configuration file. So make sure that you put it in a safe place where you’re not going to delete it or move it. Otherwise, your configuration would get all messed up.

Test communication between Home Assistant and EventGost

All right, so the configuration is all set. To test it, open Home Assistant and go into Developer ToolsServices, search and select the option joaoapps_join.computer_send_tasker. Then, for the Service Data, enter the following {"command":"test"}. Now, when you click on Call service, it should show on EventGhost as an event. You can set that event to trigger tasks in Windows to turn off the computer, lock it and much more. We can now finish the switch that we created earlier to turn on and off the computer.

Set up a script to turn off the computer

Go into your Home Assistant config folder and open the script.yaml file and enter the following:

pc_off:
  alias: PC - Off
  sequence:
    - service: joaoapps_join.computer_send_tasker
      data:
        command: shutdown

We named the script pc_off, which is what we set up earlier on the switch to turn on and off the computer. Then, we’re using the Join service to send the command to the computer, and for the data, we set up the command to shutdown. This would be the payload that would be sent to EventGhost, which can then be used in a macro to turn off the computer.

Save the changes, then go to the Configuration tab, Server Control and reload your scripts.

Configure Macro in EvenGhost

In Home Assistant, trigger the script to turn off the computer. Then, go to EventGhost. Click on Add MacroSystem, and then Power. Under power, there are several options that you can select. You can have EventGhost lock the computer, reboot, shut it down, sign off or sleep. You can create scripts in Home Assistant to trigger any of those options.

OK, So select Shut Down. Then select Force close of all programs and then click OK. After that, drag the event sent from Home Assistant and drop it between the Macro and the Action. Lastly, click on Save.

Now, anytime you trigger the script to shutdown in Home Assistant, EventGhost would pick it up, and it would then shut down the computer.

If you set up other scripts in Home Assistant to trigger any of the other power options in EventGhost, you can copy this macro, change the payload in the event and then change the Action to whatever power option you want.

Set up an automation with Join to send a notification to your phone

The other thing that I wanted to show you about Join is the notify integration. One way that I personally use it is to send a notification to my phone when my computer is turned on. One good thing about using Join is that it allows you to customize everything about the notification that you get on your phone. Some of the examples would be the icon, the title, and the content of the message.

to set an automation for a custom Join notification, Go into your Home Assistant config folder and open the automation.yaml file and enter the following:

alias: 'Computer turn on Alert'
trigger:
  platform: state
  entity_id: switch.computer
  from: 'off'
  to: 'on'
action:
  service: notify.juans_phone
  data:
    title: 'Home Assistant'
    message: 'Computer has been turned on'
    data:
      icon: https://www.home-assistant.io/images/favicon-192x192.png
      url: https://YourDomain.duckdns.org

Here, we’re saying that when the state of the computer switch goes from off to on is going to use the notify service to send a notification to my phone. Now the data that is sent, we customize the title, the message the icon and we also set up the url pointing to Home Assistant. What this would do is that when you get the notification, you can click on it and it would open your Home Assistant instance.

Conclusion

There is so much more than you can do with Join and EventGhost. So I hope that this tutorial can give you an idea of things that you can implement this project with.

If you have questions or suggestion for future videos, feel free to contact me via social media @JuanMTech. You can also drop a comment on the above video description.

Want to support my work?