Hello everybody!
I am new to both NR and this forum, so I hope someone can give me a solution.
I am using Rpi 3 with NR 0.19.5 , Sonoff-SV with Tasmota and Mosquitto.
I have mounted 2 magnetic sensors. One Opened and one Closed. If both are "0" the port is in the middle. If both are "1": ERROR. The sensors is on GPIO 4 and 5.
I have one Button that I change 4 icons and 4 colors from a function node.
PROBLEM:
If I leave NR for say 4hours and then change the state of the sensors, only the icon change. Not the color. Now I move something in the flow (move a node), so I have to deploy. And wow, now it works again!! ??!!
Can anyone explain or/and have a solution? I have made a simulator, that have the same problem. Here is the flow:
[{"id":"63163740.2d4508","type":"tab","label":"TESTBOARD","disabled":false,"info":""},{"id":"535a18ea.47f1f8","type":"ui_button","z":"63163740.2d4508","name":"","group":"89295a31.c00768","order":5,"width":"6","height":"3","passthru":false,"label":"","color":"{{color}}","bgcolor":"{{bgcolor}}","icon":"{{icon}}","payload":"","payloadType":"str","topic":"","x":750,"y":160,"wires":[[]]},{"id":"9c7f5b9e.f3e318","type":"function","z":"63163740.2d4508","name":"FixIconColor","func":"var k = msg.payload\nif (k===0) node.send({ui_control:{color:\"#FFFF00\",bgcolor:\"black\",icon:\"fa-4x fa-spinner fa-pulse\"}});\nif (k===1) node.send({ui_control:{color:\"#00FF00\",bgcolor:\"black\",icon:\"fa-4x fa-download\"}});\nif (k===2) node.send({ui_control:{color:\"#FF0000\",bgcolor:\"black\",icon:\"fa-4x fa-upload\"}});\nif (k===3) node.send({ui_control:{color:\"#FF0000\",bgcolor:\"black\",icon:\"fa-4x fa-exclamation-triangle\"}});\n\n/* 0=moving\n 1=closed\n 2=opened\n 3=error */\nmsg.payload = k;\nreturn [null];","outputs":1,"noerr":0,"x":470,"y":160,"wires":[["535a18ea.47f1f8"]]},{"id":"d1362218.b5d5e","type":"ui_button","z":"63163740.2d4508","name":"","group":"89295a31.c00768","order":2,"width":0,"height":0,"passthru":false,"label":"InMiddle","color":"","bgcolor":"","icon":"","payload":"0","payloadType":"num","topic":"","x":160,"y":220,"wires":[["9c7f5b9e.f3e318"]]},{"id":"2e15ddfb.c2d3e2","type":"ui_button","z":"63163740.2d4508","name":"","group":"89295a31.c00768","order":3,"width":0,"height":0,"passthru":false,"label":"Closed","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":160,"y":260,"wires":[["9c7f5b9e.f3e318"]]},{"id":"6bdd972a.905108","type":"ui_button","z":"63163740.2d4508","name":"","group":"89295a31.c00768","order":1,"width":0,"height":0,"passthru":false,"label":"Opened","color":"","bgcolor":"","icon":"","payload":"2","payloadType":"num","topic":"","x":160,"y":180,"wires":[["9c7f5b9e.f3e318"]]},{"id":"4161a979.0b0a18","type":"ui_button","z":"63163740.2d4508","name":"","group":"89295a31.c00768","order":4,"width":0,"height":0,"passthru":false,"label":"ErrOpenAndClosed","color":"","bgcolor":"","icon":"","payload":"3","payloadType":"num","topic":"","x":190,"y":140,"wires":[["9c7f5b9e.f3e318"]]},{"id":"89295a31.c00768","type":"ui_group","z":"","name":"GPortSimulator 1","tab":"1309dc77.e283d4","order":13,"disp":true,"width":"6","collapse":false},{"id":"1309dc77.e283d4","type":"ui_tab","z":"","name":"TestBord","icon":"dashboard","order":1}]