Help controlling GPIO output in Home Assistant
asmaran85 opened this issue · comments
I connected a relay to pin P21 of the ESP32 on which NukiHub runs.
GPIO configuration -> GPIO 21 -> general output
In the configuration.yaml file I added the lines:
mqtt: switch: - unique_id: suoneria_citofono name: "Suoneria citofono" command_topic: "gpio/pin_21/state" payload_on: "1" payload_off: "0"
In Home Assistant I see the new switch but I can't control it.
I'm not very good at mqtt. I tried with different payload (on/off, 1/0, high/low)
I tried also "command_topic: "nuki/gpio/pin_21/state""
Thanks
"nuki/gpio/pin_21/state" should be correct, unless you changed the MQTT path for the lock. Write "0" or "1" into this topic ... if that doesn't work, use an MQTT Client like MQTT explorer and monitor what happens on that topic if you toggle the switch.
Is this good?
mqtt:
switch:
- unique_id: suoneria_citofono
name: "Suoneria citofono"
command_topic: "nuki/gpio/pin_21/state"
state_topic: "nuki/gpio/pin_21/state"
payload_on: "1"
payload_off: "0"
it doesn'work
It all looks correct. Could you get logs while switching the GPIO? You can use HTERM and connect the ESP to your PC, then look at the output while switching. Baud rate is 115200, you should line break to CR+LF.
I changed the relay using a 2-relays-board and everything works!
Thank you very much!
ok, glad it works now