Closed dh-harald closed 6 years ago
disconnects from wifi
power on is not wifi connected.
poweron is triggered after power loss, thats why its called poweron and not wificonnected...
Oh, I see... is it any parameter, to get this functionality on wifi reconnect?
nope, cuz normally their is no reconnect.
also the state does not get lost if the wifi disconnects.
relais on => wifi off => relais (stays) on
relais on => power loss => relais off => power on => relais on again
could be a mqtt server problem/misconfigured, but im out here.
Its quiet interesting, because I've got 2 S20 switches, and those are working correctly... I've restarted the mqtt server, results: Touch:
Apr 12 11:42:10 wsw02-3662 ESP-MQT: home/sonoff/tele/wsw02/STATE = {"Time":"2018-04-12T10:42:11","Uptime":"0T18:30:17","Vcc":3.483,"POWER":"ON","Wifi":{"AP":1,"SSId":"xxx","RSSI":100,"APMac":"xxx"}}
Apr 12 11:52:05 wsw02-3662 ESP-MQT: Attempting connection...
Apr 12 11:52:05 wsw02-3662 ESP-MQT: Connect failed to xxx:1883, rc -2. Retry in 10 sec
Apr 12 11:52:13 wsw02-3662 ESP-RSL: home/sonoff/tele/wsw02/STATE = {"Time":"2018-04-12T10:52:14","Uptime":"0T18:35:17","Vcc":3.473,"POWER":"ON","Wifi":{"AP":1,"SSId":"xxx","RSSI":100,"APMac":"xxx"}}
Apr 12 11:52:27 wsw02-3662 ESP-MQT: Attempting connection...
Apr 12 11:52:27 wsw02-3662 ESP-MQT: Connected
Apr 12 11:52:27 wsw02-3662 ESP-MQT: home/sonoff/tele/wsw02/LWT = Online (retained)
Apr 12 11:52:27 wsw02-3662 ESP-MQT: home/sonoff/cmnd/wsw02/POWER =
Apr 12 11:52:27 wsw02-3662 ESP-MQT: Subscribe to home/sonoff/cmnd/wsw02/#
Apr 12 11:52:27 wsw02-3662 ESP-MQT: Subscribe to home/sonoff/cmnd/sonoffs/#
Apr 12 11:52:27 wsw02-3662 ESP-MQT: Subscribe to cmnd/DVES_84CE4E/#
Apr 12 11:52:27 wsw02-3662 ESP-RSL: Group 0, Index 1, Command POWER, Data OFF
Apr 12 11:52:27 wsw02-3662 ESP-MQT: home/sonoff/stat/wsw02/RESULT = {"POWER":"OFF"}
Apr 12 11:52:27 wsw02-3662 ESP-MQT: home/sonoff/stat/wsw02/POWER = OFF (retained)
Apr 12 11:52:28 wsw02-3662 ESP-CFG: Saved to flash at FA, Count 9511, Bytes 1648
meanwhile S20:
Apr 12 11:43:23 acsw01-3515 ESP-MQT: home/sonoff/tele/acsw01/STATE = {"Time":"2018-04-12T11:43:19","Uptime":"1T07:20:12","Vcc":3.528,"POWER":"ON","Wifi":{"AP":1,"SSId":"xxx","RSSI":100,"APMac":"xxx"}}
Apr 12 11:52:05 acsw01-3515 ESP-MQT: Attempting connection...
Apr 12 11:52:05 acsw01-3515 ESP-MQT: Connect failed to xxx:1883, rc -2. Retry in 10 sec
Apr 12 11:53:00 acsw01-3515 ESP-MQT: Attempting connection...
Apr 12 11:53:00 acsw01-3515 ESP-MQT: Connected
Apr 12 11:53:00 acsw01-3515 ESP-MQT: home/sonoff/tele/acsw01/LWT = Online (retained)
Apr 12 11:53:00 acsw01-3515 ESP-MQT: home/sonoff/cmnd/acsw01/POWER =
Apr 12 11:53:00 acsw01-3515 ESP-MQT: Subscribe to home/sonoff/cmnd/acsw01/#
Apr 12 11:53:00 acsw01-3515 ESP-MQT: Subscribe to home/sonoff/cmnd/sonoffs/#
Apr 12 11:53:00 acsw01-3515 ESP-MQT: Subscribe to cmnd/DVES_acsw01/#
Apr 12 11:53:00 acsw01-3515 ESP-RSL: Group 0, Index 1, Command POWER, Data ON
Apr 12 11:53:00 acsw01-3515 ESP-MQT: home/sonoff/stat/acsw01/RESULT = {"POWER":"ON"}
Apr 12 11:53:00 acsw01-3515 ESP-MQT: home/sonoff/stat/acsw01/POWER = ON (retained)
their is a command with powerretain or sth, look retain up in the wiki. but how i said, im out now, iave no mqtt server i dont know more :p
OC:
08:32:09 CMD: PowerRetain
08:32:09 MQT: home/sonoff/stat/wsw01/RESULT = {"PowerRetain":"ON"}
I've realized, that the Sonoff Touch always writes the configuration into the Flash (Saved to flash at FA, Count 9511, Bytes 1648
), meanwhile S20 don't
check SaveData command for this
Same settings:
11:19:32 CMD: SaveData
11:19:32 MQT: home/sonoff/stat/wsw01/RESULT = {"SaveData":"ON"}
12:19:37 CMD: SaveData
12:19:37 MQT: home/sonoff/stat/acsw01/RESULT = {"SaveData":"ON"}
acsw == S20 / wsw == Sonoff Touch
On the Touch you have log messages set to 3 while on the S20 it is set to 2 and hence no info about flash updates.
@arendst: do you have any idea about the "real" issue?
Well looking at your initial issue it clearly states that it receives a Power off after power on most likely caused by power retain set.
As documented in answers given since then I do not go into discussing setting power retain on.
@arendst: yes, I'm setting PowerRetain on, hence I'm using homeassistant... All my experiences are weird, because with same config, S20 are working fine (they're keep turning on after reconnect), while Touches aren't
It looks, when I connects to the broker, it automatically sends an power off command:
2018-04-12 14:26:12.601 home/sonoff/stat/wsw01/POWER ON
---- [ mqtt restart here ] ----
2018-04-12 14:26:30.530 home/sonoff/tele/wsw01/LWT Online
2018-04-12 14:26:30.558 home/sonoff/cmnd/wsw01/POWER OFF
2018-04-12 14:26:30.583 home/sonoff/stat/wsw01/POWER ON
2018-04-12 14:26:50.897 home/sonoff/tele/wsw01/LWT Online
2018-04-12 14:26:50.942 home/sonoff/cmnd/wsw01/POWER (null)
2018-04-12 14:26:51.119 home/sonoff/stat/wsw01/RESULT {"POWER":"OFF"}
2018-04-12 14:26:51.163 home/sonoff/stat/wsw01/POWER OFF
No offend, why do so many people use HomeAssistant? I read so many problems with and about it. In my humble opinion for easy fast setup Domoticz is nice. For nearly everything OpenHab can be used. I took a short look at HA and found no reason for me to use. Setting up isnt realy simple and the things i wanted to do arent easy maybe impossible... I tried OpenHab and i am happy with that choice.
Jason, I am HA user. Be more specific-I use HASS.IO version. Why? (My point of view)
@arendst: I've investigated the issue, and I think, I've found the root cause. When you're using the switch with HA, it makes the command topic retained... So If I powered off a switch, the /cmnd/ topic got the last value retained into the mqtt (in this case powered off).... After reconnect, the switch subscribes to the /cmnd/ topic as well, and just because the topic has retained value, it thinks: got the power off command...
So, idea: could you add a config value and functionality to the command retain as well? So if you push the physical button/through webpage, the command into the topic should be retained as well (not just the power topic)... Edit: I can use not retained command topic in HA, problem solved
Hi, I have the same problem with sonoff touch, someone managed to solve?
Solution: don't use retain messages for a normal setup. Retain is meant for advance Management like for example retained variables for the mode of a thermostat. See the video from thehookup. Link in Tutorials in the wiki
@ascillato thanks I solved =)
Make sure these boxes are checked before submitting your issue - Thank you!
status 0
I'm using Sonoff Touch switches with almost default configuration. I facing that issue, if my switch disconnects from wifi, it doesn't pick up the last powered state. It came up with powered off state... Here's a sample log:
And of course, poweronstate set to 3:
Any ideas, what's wrong?