Further adventures of Home Automation
I'd heard about the stream deck from Elgato, a small 15-key macro board that is primarily used for streamers and content-creators, to be able to quickly change scenes etc. I'm not a streamer, but when the SDK was announced, I wondered if I could use that to my advantage.
Happily, someone else had come to a similar conclusion before me, and had released some tools to create plugins using C#.
I started to write a custom plugin that would allow me to do a few things:
- Have a button that I can press that will switch my AV Receiver to the desired input (PC, Playstation, Xbox etc).
- Turn AV Receiver on/off
- Change volume level of receiver
- Turn lights on/off at the press of a button
This worked great! Now I can have the stream deck next to my sofa, and control all the things I need to from the comfort of my seat!
One thing it didn't do, however, was update when a light was either on/off.
Home Assistant has a few websockets that you can hook into. One of those was a state change hook. Whenever a device changed state (eg, a light went from 'off' to 'on', it would broadcast this out.
So, I expanded my plugin so that it listened for these web hooks on startup. Now, when a light changes, it also updates the stream deck! - I can now see at-a-glance, if any of my lights are on or not!
If you want to have a look at the code required to make this all work, have a look at my github project.