Tasmota 8.3.1 on SOnOff 4CHProR2 - Switch turns off in 17 seconds everytime

Hi,

I have been trying to get my head around this problem since few days now. I have 2 4chpror2 having tasmota and connected to home assistant via external MQTT. One works fine but in the other one, when i turn on a switch from tasmota interface or HA, it turns off automatically in about 17 seconds. No mater what settings I try, it always turns off. As it turns off even if i use tasmota UI, i posted it first in tasmota forum but it looks like there is a MQTT power off message sent from HA; so it is something that HA is doing rather than tasmota. This device was added to HA via auto-discovery so no entries in configuration.yaml.

This is what appears in the console:

12:59:50 MQT: tele/Sonoff4chpro/STATE = {“Time”:“2020-06-03T12:59:50”,“Uptime”:“0T00:37:36”,“UptimeSec”:2256,“Heap”:26,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER1”:“OFF”,“POWER2”:“OFF”,“POWER3”:“OFF”,“POWER4”:“ON”,“Wifi”:{“AP”:1,“SSId”:“",“BSSId”:"”,“Channel”:2,“RSSI”:70,“Signal”:-65,“LinkCount”:1,“Downtime”:“0T00:00:05”}}

12:59:50 MQT: stat/Sonoff4chpro/RESULT = {“POWER4”:“ON”}

12:59:50 MQT: stat/Sonoff4chpro/POWER4 = ON (retained)

13:00:07 MQT: stat/Sonoff4chpro/BUTTON4T = {“TRIG”:“SINGLE”}

13:00:07 MQT: tele/Sonoff4chpro/STATE = {“Time”:“2020-06-03T13:00:07”,“Uptime”:“0T00:37:53”,“UptimeSec”:2273,“Heap”:25,“SleepMode”:“Dynamic”,“Sleep”:50,“LoadAvg”:19,“MqttCount”:1,“POWER1”:“OFF”,“POWER2”:“OFF”,“POWER3”:“OFF”,“POWER4”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“",“BSSId”:"”,“Channel”:2,“RSSI”:76,“Signal”:-62,“LinkCount”:1,“Downtime”:“0T00:00:05”}}

13:00:07 MQT: stat/Sonoff4chpro/RESULT = {“POWER4”:“OFF”}

13:00:07 MQT: stat/Sonoff4chpro/POWER4 = OFF (retained)

Exactly at 17th seconds there is this: stat/Sonoff4chpro/BUTTON4T = {“TRIG”:“SINGLE”}

Can some one help me out on this?

Thanks.

I think that is the culprit :

What are your retain settings ?

how do i check and/or change that? as mentioned, its auto-discovered device using “setoption19 1” so no entries in configuration.yaml.

@francisp

Thanks for the video but it doesn’t show how to disable retain flag for auto-discovered devices. I think it makes sense to do the other things in the video only if I can check and make sure that retain is off in HA for the device.

In the tasmota console, type

powerretain off + enter
buttonretain off + enter
switchretain off + enter

Then check with mqtt explorer if there are any retained messages left for Sonoff4chpro. If there are, delete them.

Annotation 2020-06-03 202723

Power, button and switch retain are all already off. In the image above you can see exactly whats going on - its a screenshot from MQTTExplorer. the one with ‘pujaroom’ works correctly. You can see that it has one entry for each channel. But the one that misbehaves ‘groundfloorvaranda’ has an additional entry:

BUTTON4T = {“TRIG”:“SINGLE”}

Even if i delete it, it gets added automatically when i turn on a relay. Any idea why and how to fix it?

The BUTTON’x)T {“TRIG”: “SINGLE”} were introduced in 8.3.1 , in 8.3.0 it was {“ACTION”: “SINGLE”}
I guess pujaroom is on another version of tasmota ?

yes. its on older version and added manually into configuration.yaml.

I also noticed that TRIG thing gets added when the switch is automatically turned off after 17 seconds - not when turned on as i mentioned previously. What does that TRIG thing mean and how do i make sure that the switch doesn’t run off automatically?

The TRIG messages are a way to enable multi-press functionality for buttons
if you press a button once you get {“TRIG”: “SINGLE”}, twice {“TRIG”: “DOUBLE”}, three times {“TRIG”: “TRIPLE”}, four times {“TRIG”:“QUAD”}, five times {“TRIG”:“PENTA”} (and then it stops)

But if you have no automation running listening to these mqtt events, the switch should not turn off.

Still strange you get this one retained :
stat/Sonoff4chpro/POWER4 = ON (retained)

Just tried with one of my 8.3.1 switches

17:16:16 MQT: lichteetkamer/stat/BUTTON1T = {"TRIG":"QUAD"}
17:18:12 MQT: lichteetkamer/tele/HASS_STATE = {"Version":"8.3.1(tasmota)","BuildDateTime":"2020-05-18T15:39:35","Module or Template":"Shelly 1","RestartReason":"Software/System restart","Uptime":"3T04:55:09","Hostname":"lichteetkamer-3978","IPAddress":"10.0.0.223","RSSI":"42","Signal (dBm)":"-79","WiFi LinkCount":1,"WiFi Downtime":"0T00:00:03","MqttCount":1,"LoadAvg":19}
17:18:19 MQT: lichteetkamer/tele/STATE = {"Time":"2020-06-03T17:18:19","Uptime":"3T04:55:16","UptimeSec":276916,"Heap":27,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SNOW","BSSId":"10:FE:ED:AF:44:7A","Channel":1,"RSSI":44,"Signal":-78,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:20:44 MQT: lichteetkamer/tele/STATE = {"Time":"2020-06-03T17:20:44","Uptime":"3T04:57:41","UptimeSec":277061,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":1,"POWER":"ON","Wifi":{"AP":1,"SSId":"SNOW","BSSId":"10:FE:ED:AF:44:7A","Channel":1,"RSSI":44,"Signal":-78,"LinkCount":1,"Downtime":"0T00:00:03"}}
17:20:44 MQT: lichteetkamer/stat/RESULT = {"POWER":"ON"}
17:20:44 MQT: lichteetkamer/stat/POWER = ON

The {“TRIG”:“QUAD”} was from looking what 4 presses send, but switching the relay from HA did not send a {“TRIG”:“SINGLE”} message.

And 17 seconds can not come from the dip-switches on the Sonoff 4CH PRO, it only goes to 16 seconds :

Edit: unless there is 1 second delay due to HA processing :slight_smile:

Now that I think about it : check your dipswitches ! if K5 is set to 0, and K6 to 0000, the relay will turn itself off after 16 seconds. Nothing to do with Tasmota, it is a hardware thing separate from the ESP.

image

Thats what I have been thinking too. But its a lot of time & work to take out the chpro from within the tight spot in the switch board, remove all the wires and check the physical switches. So wanted to check with the community if its a software issue first before I spent hours to check the physical switches. I am sure i didn’t touch the switches. Unless it came with altered switch position instead of default positions, there is no way it was altered by me.

So finally it looks like there is no other way. I will check the physical switches in a day or 2 and update here so others facing the same problem might get help with it. Thanks.

Got the culprit. K5 was all in ‘Off’ i.e. inching mode. And it still had that yellow plastic cover on the k5 switches which confirms that the switches came that way from factory, which is surprising because my other 3 sonoffs worked as expected out of the box. From next time onwards I have to test these by keeping it switched on for more than 17 seconds instead of usual quick tests before putting it off into some place hard to retrieve.

IMG_20200616_181607

Thanks for the help @francisp

1 Like