I have a couple of Tasmota
devices connected.
Looking, the LWT
message is retained. So I would think that when the machine is powered up the message is received and should be affected.
Sorry it is a bit messed up in layout, but this is the code:
[{"id":"3f35b888.962a","type":"mqtt in","z":"26262ba1.62dcbc","name":"Bulb-1 *","topic":"BULB-1/#","qos":"2","datatype":"auto","broker":"378c0403.8cda04","x":2480,"y":300,"wires":[["49320631.8fafc8","3c073047.1c12"]],"info":"This needs editing for different BULBS"},{"id":"3c073047.1c12","type":"switch","z":"26262ba1.62dcbc","name":"TOPICS *","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"BULB-1/cmnd/power1","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":2660,"y":300,"wires":[["c0671188.49e67","f0e5a33c.047358"],["ff9438db.05a24","4af31854.bb2928"]],"outputLabels":["State","LWT"],"info":"This needs editing for different BULBS"},{"id":"ff9438db.05a24","type":"switch","z":"26262ba1.62dcbc","name":"LWT","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Online","vt":"str"},{"t":"eq","v":"Offline","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":2480,"y":390,"wires":[["c1e2fde4.9eac38","650e33e.943974c"],["6f2a3190.8deba8"]]},{"id":"6f2a3190.8deba8","type":"function","z":"26262ba1.62dcbc","name":"BAN","func":"msg = {icon: '<font color = \"red\"><i class=\"fa fa-ban fa-3x\"></i></font>'};\nreturn msg;","outputs":1,"noerr":0,"x":2650,"y":420,"wires":[["ac1d9aac.bbcae"]]},{"id":"ac1d9aac.bbcae","type":"change","z":"26262ba1.62dcbc","name":"Disable","rules":[{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2850,"y":420,"wires":[["c8ea1741.fbff8"]]},{"id":"c8ea1741.fbff8","type":"ui_button","z":"26262ba1.62dcbc","name":"BULB#1","group":"7893c6c4.30ede","order":2,"width":"1","height":"2","passthru":false,"label":"{{msg.icon}}","tooltip":"","color":"","bgcolor":"{{msg.background}}","icon":"","payload":"X","payloadType":"str","topic":"","x":3060,"y":380,"wires":[["b31baea6.87a2f"]]},{"id":"378c0403.8cda04","type":"mqtt-broker","z":"","name":"MQTT HOST","broker":"192.168.0.99","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"7893c6c4.30ede","type":"ui_group","z":"","name":"BULB-1","tab":"aa487daa.33c1c","order":4,"disp":true,"width":"3","collapse":false},{"id":"aa487daa.33c1c","type":"ui_tab","z":"","name":"Real_World_Control","icon":"dashboard","order":6,"disabled":false,"hidden":false}]
The idea is that if a LWT
message is received with Offline
it puts a fa-ban
icon on the button and disables it.
But the button is active and has the wrong icon.
This is a picture from MQTT Explorer
showing the message is retained:
The BAUHN-1 is unplugged and is showing the right icon/s.
The bulb is also unplugged and showing the wrong icon.
(Where's the elephant?)