Sonoff sv triggers after HA reboot

Hi all,

I have a few Sonoff SV and Sonoff Basic devices running Tasmota spread out around the house. Almost all units are working perfectly, that is except for one… Im thinking it is a hardware issue but just wanted to run it by everyone.

Basically, i want to use the unit to trigger a push button connection which will ignite my fireplace… I am using DrZzs process for building a garage door opener (https://www.youtube.com/watch?v=QMepwpyjMCY&t=210s) as my basis, as this is the same concept (outside of the reed switch, but im not using that)… To give further background, i have already configured and installed a garage door opener using his process and it works perfectly, ie does not suffer the same issues as the fireplace sonoff sv.

Anyway, my issue is that whenever my HA instance reboots, the sonoff sv will trigger into an ON status. I have narrowed down the cause of the issue to the automation i am using (which is the same as the one i am using for the garage door sonoff sv). When i comment out the fireplace automation below, the issue does not appear. When i remove the comment and bring back the automation, the issue reappears.

Can anyone see anything with my automation which may be causing the issue?

CONFIGURATION

  - platform: mqtt
    name: "Fireplace"
    command_topic: "cmnd/s_sv_fire/power"
    state_topic: "stat/fire_temp/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
#    optomistic: false
    retain: true

AUTOMATION

- id: '1538973800659'
  alias: fireplace_button_press
  trigger:
  - payload: 'ON'
platform: mqtt
topic: cmnd/s_sv_fire/power
  condition: []
  action:
  - delay: 00:00:01
  - data:
  payload: 'OFF'
  topic: cmnd/s_sv_fire/power
service: mqtt.publish

Also, if i change the name of the Sonoff sv, the issue disappears, but then when i update the automation to use the new name, the issue reappears. I have also tried Switchretain 1 and Powerretain 1 to no avail.

Any help is appreciated.

thanks

As you are using Tasmota, pretty sure you’ll need to make retain: false. See Rob’s video here https://www.youtube.com/watch?v=31IyfM1gygo

I think the problem is that you have set the topic cmnd/s_sv_fire/power to be retained by your HA switch configuration. This causes the broker to save this message and send it whenever a client subscribes to the topic.

When HA restarts, it subscribes to that topic because that is the trigger of the automation, so the broker sends the message and triggers the automation. The automation does not set the retain flag when it sends the MQTT message, so the broker keeps the previous message for the topic in its database (with the payload “ON”).

I think you can specify to send the retain flag in the automation, which would be the simplest option.

To be safe though, I think I would remove the retain flag from the switch, but set the message in the broker database to send “OFF” when a client is connected, so when the fire client connected, it is always turned off.

Hi All,

Thanks for your feedback… I tried Retain: SwitchRetain Off, ButtonRetain On, ButtonRetain Off and PowerRetain On (individually and in all manner of combinations, to no avail. In the end i just took an image of my working Garage SV, restore that on the troublesome Fireplace SV, dumped the portions of both Configuration and Automation yamls which were specific to the Firplace SV, and copied over the Garage SV comments in both… I updated the topic to point to the new instance of (the reimaged) Fireplace SV (with renamed topic of course so as not to cause a duplicate on the network), and it worked… I then updated the class from Cover: to Switch and to my surprise, it still works…

The Retain things should have fixed it (it makes sense) but it didn’t…

thanks anyway to everyone who tried to assist.

Now, onto the next task, configuring a flashing LED diode when the garage door is open (reed sensor = open).

1 Like