Closed JHurk closed 1 year ago
I have the same since HA upgrade, I've not yet figured out how to fix it. As I switched off the pool, will be complex to troubleshoot before post winter. It might be a general question to be asked in HA forum as it's related to how MQTT switches behave since last HA release. Will further investigate on the forum and revert if any findings
Understood, if I can do anything to test, please let me know. I still have my pool operational for a week, max. two. So I can do some testing if you like, with different settings or yaml.
- unique_id: "pool_lights"
name: "MQTT Pool Lights"
device_class: switch
command_topic: "cmnd/SmartPool/NPLight"
state_topic: "stat/SmartPool/NPLIGHT"
value_template: >-
{% set values = { 'OFF':'0', 'ON':'1' } %}
{{ values[value_json["NPLight"]] if value_json["NPLight"] in values.keys() else '99' }}
payload_on: "1"
payload_off: "0"
using tool like MQTT explorer, could you check you get a topic value in "stat/SmartPool/NPLIGHT" ?
Sorry, deleted my previous answer because it got a little complex.
When I publish the following command, I get no result in HA explorer
But after a few minutes I do get an answer, probably because the automation SmartPool_Sensors_Updated got triggered.
same here, status of the MQTT switch remains "unknown" even after posting to stat/SmartPool/NPLIGHT
Same her, both for the lights and the pump switch. So something with the yaml? Or maybe the Tasmota doesn't publish the expected state?
it worked all fine for me before the latest HA upgrade, might be something has changed in the release.
So I woul not touch yaml nor tasmota. It's a new HA behavior that we need to figure out
That is good call, will look into the latest HA upgrade to see if anything changed regarding MQTT and/or switch behaviour and state. But for now will stay away from editing Tasmota or yaml :)
The only thing in the release notes that comes close to MQTT or this issue is; https://github.com/home-assistant/core/pull/101670 As far as I can tell, but my knowledge is not that extensive regarding bug fixing and coding.
got this working
mqtt: switch:
if I send OFF or ON to state/mySwitch, the dashboard item is updated accordingly. troubleshooting...
Don't know if this is helping, seeing you already found some things during testing. But looked at the previous release notes of September and found the following changes/fixes that might be related;
September 8 release https://github.com/home-assistant/core/pull/99943 September 12 release https://github.com/home-assistant/core/pull/100168 (Tasmota related change/fix) September 24 release https://github.com/home-assistant/core/pull/100707 (MQTT state related)
Nope, this doesn't change anything. The buttons work (On makes the gui in Tasmota change the lights to On), but the state is not visible in the dashboard. And via the developers tool --> status is still unknow The strange thing is that the last updated time is somewhere around 13:04, while I just changed the status via de the switch button on the dashboard, around 14:35. Correct; the time has changed after a refresh, so disregard this last comment.
You need to send 0 or 1 to command_topic: "cmnd/SmartPool/NPLight"
next Tasmota module will answer with ON or OFF on state_topic: "stat/SmartPool/NPLIGHT"
Somehow, when I combine value_template and payload_on payload_off. the state of the swith is no longer updated.
Does this help?
Damned, coffee helped :) go to your tasmota console and enter the following command
setoption4 1
That's it!!! The switch turned into a on/off switch instantly and shows the status. Thanks for this!
you're welcome. it will also resolve the pump switch status
Thanks again, and to confirm; the pump switch is also working now!
Got the dashboard to work and after enabling the SetOption19 in Tasmota the entities became visible in HA.
One question; I connected the pool lights to my Sugar Valley and I can control them with the switch on the dashboard. But how do I get the switch to show the current state, just like a normal switch or light bulb in HA? I know I can add it a a separate sensor to the dashboard, I did this for the Acid pump. But would like it to show up like a normal light in HA.
I tried making it a different device (from switch to light), it still functions but the state is also not visible. For extra info; I did not add a gui switch in Tasmota for the light (maybe I need to do that so it will transfer this to HA via MQTT??)