Help with mqtt switch config

Hi. I’ve bee having issue with my config file.

I currently have a Nodemcu using ESPEASY with a led connected to GPIO 14. I can run the web command from my browser http://192.168.0.31/control?cmd=GPIO,14,1Which turns the led on.

I need help setting up a switch in HA. When i connect my nodemcu and view the comm log it says its connected to my brooker, which is my RPI running HA. its says connected /mcu/#. mcu being the name of my nodemcu.

What would be command and state information be? This is the last issue i need to overcome.
After this i want HA to know if that switch is on or off. I am now sure how i would go about this.

Thanks!!!

A quick search of the forum revealed a number of results. This seemed to be a good answer

That looks like it makes sense!

Thank you!

still not working for me. placed this in my config

switch 4:
platform: mqtt
name: “mcu”
state_topic: “/mcu/relay/state”
command_topic: “/mcu/gpio/14”
payload_on: “1”
payload_off: “0”
qos: 1
retain: true

Still doesn’t change state.
http://192.168.0.31/control?cmd=GPIO,14,0
http://192.168.0.31/control?cmd=GPIO,14,1

Does change the state, please help

look like ive got it working.

:slight_smile: