Hi everybody,
I have all my tasmota controlled devices set up as mqtt switches. Most of the time, most of them display the correct state (so if I had turned on my office fan, the switch would be on
).
However, some other times, this does not work. A device that is currently on is displayed as off; the only way to fix this (when using the webinterface on my smartphone, for example) is to click the switch with precise timing.
Let’s say my office fan is actually on, but home-assistant displays it as off; I will have to switch it to on, but then it will change back to off after a few seconds. If I switch it on, then back off, it will stay on, but still display off. If I time it just right, I will turn the switch to on (which the device already is), wait a second or so, then turn it to off. If the timing is right, the device will turn off and the status will be correct.
This is pretty annoying and I am sure this can be fixed, so would somebody please help me do so?
This is an example switch from my configuration
- name: "Arbeitszimmer Rechner"
command_topic: "cmnd/tasmota-1834/POWER"
state_topic: "stat/tasmota-1834/POWER"
icon: mdi:laptop
<<: &meintemplate
platform: mqtt
qos: 2
retain: false
payload_on: "ON"
payload_off: "OFF"
state_on: "ON"
state_off: "OFF"
The tasmota device (it is a Gosund SP1
) has the following options set that might be relevant
-
teleperiod 10
(report current status each 10 seconds) -
powerretain 1
(retain power value) -
sensorretain 1
(device measures energy consumption; if I retain this, I will get the most recent stats right when (re)starting home-assistant instead of having to wait for them to be reported again)
I used to have retain: true
set in the switch .yaml
file. However, this would cause devices to keep this state, even if I didn’t want them to (for example, manually turning of a switch by hand instead of via home-assistant would result in it turning back on a few seconds later).
I considered using tele/tasmota-1834/STATE
and then using the appropriate json value for this, but if I manually observe stat/tasmota-1834/POWER
via command line and change the status, it will display the correct result; so home-assistant should know the current state; also, since all my tasmota devices have powerretain ON
, I’d expect each device to constantly display it’s status (or rather, each switch in home-assistant being set to the correct value).
Have I made an obvious mistake in my configuration that I didn’t see? Btw., the <<: &meintemplate
line is just so that I can have these very values in each following switch in that file without having to copying and pasting the same lines over and over again.
Thanks in advance for your help