That should be the case, I even enabled retain for the button that I dont ever use:
#define MQTT_BUTTON_RETAIN 1 // [ButtonRetain] Button may send retain flag (0 = off, 1 = on)
#define MQTT_POWER_RETAIN 1 // [PowerRetain] Power status message may send retain flag (0 = off, 1 = on)
#define MQTT_SWITCH_RETAIN 1 // [SwitchRetain] Switch may send retain flag (0 = off, 1 = on)
The console in the sonoff shows:
15:11:31 MQTT: tele/sonoff1/RESULT = {"Info1":{"AppName":"Sonoff 8266 Module", "Version":"3.2.13", "FallbackTopic":"DVES_958A7A", "GroupTopic":"sonoffs"}}
15:11:31 MQTT: tele/sonoff1/RESULT = {"Info2":{"WebserverMode":"Admin", "Hostname":"sonoff1-2682", "IPaddress":"192.168.1.242"}}
15:11:33 MQTT: stat/sonoff1/RESULT = {"POWER":"ON"}
15:11:33 MQTT: stat/sonoff1/POWER = ON
15:11:40 MQTT: tele/sonoff1/TELEMETRY = {"Time":"2017-02-24T15:11:40", "Uptime":0, "POWER":"ON", "Wifi":{"AP":1, "SSID":"Home Benissa", "RSSI":92}}
15:12:00 MQTT: Attempting connection...
15:12:01 mDNS: Query done with 0 mqtt services found
15:12:12 MQTT: Attempting connection...
15:12:13 mDNS: Query done with 0 mqtt services found
15:12:13 MQTT: Connected
15:12:13 MQTT: tele/sonoff1/LWT = Online (retained)
15:16:42 MQTT: tele/sonoff1/TELEMETRY = {"Time":"2017-02-24T15:16:42", "Uptime":0, "POWER":"ON", "Wifi":{"AP":1, "SSID":"Home Benissa", "RSSI":92}}
The restart is at 15:12:00. There’s no stat going over the line?
Is there a way for homeassistant to react to the telemetry messages?
only when I set the switch to on (again) in homeassistant, a STAT is sent:
15:16:42 MQTT: tele/sonoff1/TELEMETRY = {"Time":"2017-02-24T15:16:42", "Uptime":0, "POWER":"ON", "Wifi":{"AP":1, "SSID":"Home Benissa", "RSSI":92}}
15:21:42 MQTT: tele/sonoff1/TELEMETRY = {"Time":"2017-02-24T15:21:42", "Uptime":0, "POWER":"ON", "Wifi":{"AP":1, "SSID":"Home Benissa", "RSSI":90}}
15:26:17 MQTT: stat/sonoff1/RESULT = {"POWER":"ON"}
15:26:17 MQTT: stat/sonoff1/POWER = ON
15:26:42 MQTT: tele/sonoff1/TELEMETRY = {"Time":"2017-02-24T15:26:42", "Uptime":0, "POWER":"ON", "Wifi":{"AP":1, "SSID":"Home Benissa", "RSSI":94}}
I also tried ‘LEGACY’ message format instead of ‘JSON’ but… to no avail.