I want to be able to turn the switch on and off, but here is the problem.
The status of the Sonoff S31 is updated every five minutes when Sonoff sends this:
19:31:34 MQT: tele/Washer/STATE = {"Time":"2019-08-20T19:31:34","Uptime":"0T20:36:11","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"MYSSID","BSSId":"70:3A:CB:26:8B:E8","Channel":11,"RSSI":86,"LinkCount":1,"Downtime":"0T00:00:05"}}
19:31:34 MQT: tele/Washer/SENSOR = {"Time":"2019-08-20T19:31:34","ENERGY":{"TotalStartTime":"2019-08-19T22:12:19","Total":0.058,"Yesterday":0.007,"Today":0.052,"Period":0,"Power":1,"ApparentPower":6,"ReactivePower":6,"Factor":0.21,"Voltage":121,"Current":0.051}}
This is the switch that I created for this device:
- platform: mqtt
name: "Washer Plug"
command_topic: 'cmnd/Washer/POWER'
state_topic: "tele/Washer/STATE"
value_template: "{{value_json['POWER'] }}"
availability_topic: "tele/Washer/LWT"
qos: 1
payload_available: "Online"
payload_not_available: "Offline"
payload_on: 'ON'
payload_off: 'OFF'
It works, but HA does not update the switch status until the update comes from Sonoff. For example, if it is off and I turn it on using HA, the switch is turning on, but HA shows me that it is off until the next update is received. It can take up to five minutes.
The same if it is on and I try to turn it off. The switch is turning off, but HA shows me that it is on until the next update. It can take up to five minutes for HA to show different status.
Is it possible to fix?