Closed alexhk closed 3 years ago
Thx for this very detailed bug report.
I found the issue. I was introduced by the parsing of variable which worked fine for true and false but not for other strings like ON and OFF.
I'll try to release a fixed version the next days.
Thanks for the quick update. It works, but please note only if I use 'ON' and 'OFF', not if it's lowercase 'on' or 'off' etc.
Do you have an example where this would be useful? The casing of the values shouldn't change during the usage?
It was more a FYI and a surprise to myself that it is case sensitive.
Hmm, examples. I am not the MQTT specialist, but at least for checking the result of the subscription I would lowercase both the received value and the entered value first before the comparison and setting the switch state in the javascript. So if we get back "On", "ON" or "on" it's all the same. I am using a variety of Tasmota devices (stock and modified firmwares), they are configurable, sometimes it could be ON, sometimes On. A long time ago (early versions) it was also true/false if I remember correctly. But on the other hand, don't bother wasting your time!
Having a Go MQTT running in the backend would be much more useful :)
Again, thanks for providing this useful plugin!
Hi @geeks-r-us , I've been looking forward to using your plugin for a long time and just now finally found the time.
I don't have any MQTT device where I could test with
true
andfalse
, but I am trying to create a switch withON
andOFF
values which doesn't seem to work. However, when I setup a panel next to it with TEXT, it does indeed show ON/OFF is received without problems from mosquitto, also I can use a Button which also works well so as a workaround I can use Text with a additional button.And since Github now supports video, here's a 84kb MP4.
https://user-images.githubusercontent.com/1495412/103644030-f8ce0d80-4f55-11eb-89c9-5ba86a12fb02.mp4
Left (text) reflects changes when I switch externally. Right doesn't show anything and flipping the switch seems to send a message to mosquitto but nothing happens. I suspect the ON/OFF strings somehow don't work?
They are setup in the same way:
Buttons work but I am not sure why there is a subscribe topic in the settings:
-- // --
I also noticed there are lots of different mqttjs_dd0be95a clients connected. And to make sure it's not one of my browser plugins on Firefox, I tried on a virgin Edge browser with the same result.
Here's a log where I switch externally and the result is shown in the Text type, and once I try to switch with the switch type panel.