I have a Pimoroni Automation Hat on a Pi, not my home assistant machine. Writing Python to get it to things is quite simple. I’ve been trying to integrate it in to HA this weekend using MQTT but I’ve had no luck. I’m not even getting past the first hurdle.
I’ve set up this switch
switch:
- platform: mqtt
unique_id: shed_outside
name: "Shed Switch"
state_topic: "shed/light/outside"
command_topic: "shed/light/outside/set"
payload_on: "ON"
payload_off: "OFF"
state_on: "ON"
state_off: "OFF"
optimistic: false
qos: 0
retain: true
And I’ve written code on the Automation Hat which subscribes to those topics. If I manually publish shed/light/outside/set with a payload of “ON” the light goes on. If I click the switch in the HA GUI, nothing happens. In fact, if I subscribe to shed/# there’s nothing published when I toggle the switch. So I think I’m missing something in the switch config but after wasting too much of my weekend on it I thought I’d ask if anyone has a working example I can look at.
Thanks
Steve