AutoHotkey control Home Assistant via the API. Use any PC keyboard

Peeps,

I created a AutoHotKey script to control Home Assistant with any PC keyboard.

The keyboard does not have to be plugged into the hardware running HA. So devices such as Rasberry Pi and small computers with limited USB ports will benefit, or the keyboard on your laptop.

It can control lights, switches, locks, scripts, scenes, MQTT. SSL supported, using the HA Rest API with encryption via Microsoft Credentials. You can also tweak the script to add support for the many features that AutoHotKey offers, such as connecting it to other software, tools, ecosystems that support hotkeys, ie.

Example: via a hotkey you can toggle a light on HA and also launch Photoshop and open Notepad.

Let me know your experience. I am not a professional developer, have some experience with AHK. With enough ChatGPT prompts and finding libraries from other users, I pieced together the script. It has been working on my system and should in theory work on your system.

2 Likes

Hi. I was using hass.agent to setup a hot key to open multiple web pages. My pc died and I have build another. Now, I am having trouble where it complains that it can’t communicate with HA api. It is quite strange. There is a test page where I can test it to see if hass.agent can communicate with HA. It passes. However, the client program itself says it cannot not. I have no clue why it cannot when it could with my old pc running on the same network.

My question is can this script do what am am asking above? I want to setup a hotkey to open several webpages on chrome.

Sorry just saw this, Autohotkey can easily open a website…

; AutoHotkey script to open several website in Google Chrome 🚀

^!g:: ; Ctrl + Alt + G hotkey
Run, chrome.exe "https://www.bluey.tv" --new-window
Run, chrome.exe "https://backstreetboys.com" --new-window
Run, chrome.exe "https://www.peppapig.com" --new-window
Run, chrome.exe "https://www.rafaelmagic.com" --new-window
return

For example that Opens up the website for Bluey (my favorite cartoon about a blue dog) with Chrome, PepaPig, Back Street Boys and my website. JUST by pressing Control Alt g…

If you take out --new-window Then theyll open up in the same browser as tabs…