Shelly 2.5 - MQTT - Wall Switch Immediately Flips Off

Hey all

Long time HA user, first time poster

I recently got some Shelly 2.5’s and I’m having issues with the setup/installation

PROBLEM:

EDIT: It appears the issue is coming from the “retain” flags, but I’m still not sure how to clear this up. everywhere I’m reading says “retain” should be set to false. I’m set Tasmota to SwithRetain 0, buttonRetain 1, buttonRetain 0, and powerretain 1. I think the retain flag is holding on to the prior values somehow.

EDIT 2: SOLVED -
I was able to solve this by in the Tasmota console setting switchtopic 1 and switchretain 1. This, I believe, passes the “retain = ‘y’” flag when you manually flip the light switch. For some reason, i needed ALL of my triggers to include the retain = y flag. This seems like a work around, but either way…it’s finally working

When I use the wall switch to turn the light on/off, it immediately flips back to the prior state.

MY SETUP:

1). I flashed my Shelly 2.5 with Tasmota (everything went perfect, as instructed by this link)

https://michlstechblog.info/blog/tasmota-flashing-and-setup-a-shelly-2-5/

2). I installed the Shelly 2.5 just as the image here.

https://skylerh.com/wp-content/uploads/2020/04/SkylerH-Shelly-2.5-Wiring-12.jpg

3). configuration.yaml is returning NO errors and is set as below

 - platform: mqtt
    entity_id: switch.kitchen_light_1
    name: "Kitchen Light 1"
    state_topic: "stat/playroom_kitchen_main/POWER2"
    command_topic: "cmnd/playroom_kitchen_main/POWER2"
    availability_topic: "tele/playroom_kitchen_main/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    optimistic: false
    qos: 1
    retain: true

4). In the Tasmota console I can see that the state is being updated when I use the wall switch (example: POWER: OFF becomes POWER:ON)

What am I missing?

Thanks all

Try optimistic true?

Any reason that you’re not using the Tasmota (beta) Integration or the original Tasmota/HA auto-discovery?

Unfortunately that didn’t work. Thanks though.

we’ll my initial response was going to be…

“I don’t know what that is”

…but after spending most of the day upgrading HA from 0.84 -> 0.103 (installing/uninstalling python, setting up virtual environments, resetting up my configuration.yaml, etc etc…sigh) and trying the “Auto discovery” it doesn’t seem to be working as expected. It’s probably a user error…but none the less I’m still having the same issue with using the Light Switch Manually. It immediately flips back to it’s previous state. I did however have to make a tweak to the configuration file as “entity_id” is deprecated.

 - platform: mqtt
    unique_id: switch.kitchen_light_1
    name: "Kitchen Light 1"
    state_topic: "stat/playroom_kitchen_main/POWER2"
    command_topic: "cmnd/playroom_kitchen_main/POWER2"
    availability_topic: "tele/playroom_kitchen_main/LWT"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    optimistic: false
    qos: 1
    retain: true