A little Swift app for macOS which lets you sleep and wake your Mac’s display over MQTT.
make install MQTT_URL=mqtt://…
This will compile the binary, install it into
~/.local/bin, and create a launch agent to run at login.
Example Home Assistant switch configuration
mqtt: switch: - name: MacBook display icon: mdi:laptop command_topic: mymacbook/display/set payload_on: "on" payload_off: "off" state_topic: mymacbook/display state_on: "on" state_off: "off" availability_topic: mymacbook/display/available payload_available: "online" payload_not_available: "offline"