I haven't done anything with the actual ESP32/physical button thing yet, but I got the software side of my "remotely turn the Raspberry Pi displays on and off" project done! The core is a very simple Node.js service that runs on the Pis directly (https://github.com/VirtualWolf/hyperpixel-brightness-control) and subscribes to an MQTT topic that contains messages indicating whether the display should be on or off, then writes directly to the GPIO pin to control the display brightness. I updated my Pi Home Dashboard (https://github.com/VirtualWolf/pi-home-dashboard) to add an HTTP endpoint that'll send messages to that same topic the display-attached Pis are subscribed to, and the shortcuts in the video are simply calling that endpoint. I'm using the "retain" MQTT flag for the messages sent to the display status topic so even if the Pis reboot for whatever reason, the last known state is what they'll start up with again when they come up. And finally, instead of a cronjob set on each individual Pi to automatically turn the displays off at midnight and back on at 8am, I've got one running on the main Raspberry Pi 4B that runs the MQTT broker that just sends the required message to the MQTT topic and the Pis with the display attached dutifully turn on or off as necessary.
Posted on 11 September 2022, 11:36