MQTT tasmota - one switch works perfectly, second switch does nothing?

So I’ve got 2 switches, 1 is running on a Sonoff (works perfectly), and the second is running off a Shelly. I flashed both with Tasmota.

When I go directly to the IP address of the non-working shelly switch (called warehouselight in my .yaml file), I can toggle it on and off just fine from the tasmota interface. However in HA, I cannot toggle it (switch moves to on, a few seconds later it moves back to off).

I cannot spot an error, but here is my conf.yaml code for this:

switch:
- platform: mqtt
  name: "patbedroomlamp"
  command_topic: "cmnd/patbedroomlamp/power"
  state_topic: "stat/patbedroomlamp/POWER"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: true
- platform: mqtt
  name: "warehouselight"
  command_topic: "cmnd/warehouselight/power"
  state_topic: "stat/warehouselight/POWER"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: true

I have triple checked, the switch is in fact named ‘warehouselight’ inside tasmoto, the same as I setup the bedroom lamp. Since the Shelly works just fine by going directly to it, I assume the issue is with my HA .yaml file. Any idea what might be going on??

Thank you!!

Check the actual topic on the broker using mqtt explorer or a similar PC client.

Also you are going to have a bad time with retain set to true.

1 Like

Thanks, that video explains why when I had it working the lights would randomly turn off!

I lost my original config (no backup, SD failure), so I’m rebuilding it, but I put it together about a year ago so I’m pretty rusty…appreciate the help.