Momentary button with status from PLC

I'm a newbie here and I'm trying to build a home automation system based on a PLC that controls lighting. I'm trying to use Node Red Dashboard for a simple visualization. I'm stuck with a momentary button with the current status.
Momentary button (true when press and false when release) controls the virtual PLC input. The status is taken from the PLC output. In this setting I have two separate widgets. I would like to have a one wide button that changes color depending on the output status or a button with the LED symbol that changes color when the output status changes.
Thanks for any help.

[{"id":"1affd278.f4a41e","type":"s7 in","z":"8b5b138e.348db","endpoint":"54664c51.163b54","mode":"single","variable":"out light","diff":true,"name":"PLC Status","x":330,"y":120,"wires":[["e9e1904e.97b73"]]},{"id":"79684685.c52278","type":"s7 out","z":"8b5b138e.348db","endpoint":"54664c51.163b54","variable":"in light","name":"Light On Off Pulse","x":610,"y":220,"wires":},{"id":"6d3f4e5d.dee14","type":"ui_template","z":"8b5b138e.348db","group":"37bd40fc.ddb8b","name":"DS Ligcht ","order":7,"width":"0","height":"0","format":"<div class="momentary1">\n DS Light \n\n\n","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":300,"y":220,"wires":[["79684685.c52278"]],"icon":"node-red/light.svg"},{"id":"e9e1904e.97b73","type":"ui_led","z":"8b5b138e.348db","group":"37bd40fc.ddb8b","order":6,"width":"0","height":"0","label":"","labelPlacement":"right","labelAlignment":"right","colorForValue":[{"color":"grey","value":"false","valueType":"bool"},{"color":"yellow","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":630,"y":120,"wires":},{"id":"54664c51.163b54","type":"s7 endpoint","z":"","transport":"iso-on-tcp","address":"192.168.1.211","port":"102","rack":"0","slot":"2","localtsaphi":"02","localtsaplo":"00","remotetsaphi":"01","remotetsaplo":"00","connmode":"tsap","adapterauto":true,"adapterport":"","busaddr":"2","adapteraddr":"0","cycletime":"500","timeout":"1500","verbose":"default","name":"","vartable":[{"addr":"DB1,X4.3","name":"in light"},{"addr":"DB1,X8.3","name":"out light"},{"addr":"DB1,X4.4","name":"in fan"},{"addr":"DB1,X8.4","name":"out fan"},{"addr":"","name":""}]},{"id":"37bd40fc.ddb8b","type":"ui_group","z":"","name":"Light GF","tab":"9823101f.becc","disp":true,"width":"6","collapse":false},{"id":"9823101f.becc","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

As far as I remember, the dashboard button doesn't have this functionality, you'll need to implement the button using the template node, and then add this two events (touchstart and touchended) to your button. This maybe helps you: https://www.kirupa.com/html5/press_and_hold.htm

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.