How i can use (ui-led )node

I am using flowfuse dashboard 2 in node red from my SCADA system
Just I need help to use (ui-led) as a flashing depending on digital value

Do you mean that you want it to follow the digital value (in which case just feed the value in to the node) or something more complex?

i know that but i am talking about flashing
how i can do flashing

One way is to use a trigger node to send true then false, and a delay node to repeat.

To stop it flashing send msg.reset to both of those nodes and false to the LED to ensure it rests in the correct state.

[{"id":"555ba3c99c7c58c1","type":"ui-led","z":"c9ba220510e4ab97","name":"","group":"dce965f3d31773c8","order":-1,"width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","states":[{"value":"false","valueType":"bool","color":"#ff0000"},{"value":"true","valueType":"bool","color":"#00ff00"}],"allowColorForValueInMessage":false,"shape":"circle","showBorder":true,"showGlow":true,"x":590,"y":140,"wires":[]},{"id":"2ad7bd64e1a0a359","type":"inject","z":"c9ba220510e4ab97","name":"Start","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":100,"wires":[["46b2c5c15c6db080"]]},{"id":"46b2c5c15c6db080","type":"trigger","z":"c9ba220510e4ab97","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"2","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":340,"y":100,"wires":[["555ba3c99c7c58c1"],["1fdaa5f339ab2319","555ba3c99c7c58c1"]]},{"id":"1fdaa5f339ab2319","type":"delay","z":"c9ba220510e4ab97","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":340,"y":160,"wires":[["46b2c5c15c6db080"]]},{"id":"3b32b2a9a4c147ab","type":"inject","z":"c9ba220510e4ab97","name":"Reset","props":[{"p":"payload"},{"p":"reset","v":"true","vt":"bool"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":160,"wires":[["1fdaa5f339ab2319","46b2c5c15c6db080","2e4c632c947a4c7f"]]},{"id":"2e4c632c947a4c7f","type":"change","z":"c9ba220510e4ab97","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":220,"wires":[["555ba3c99c7c58c1"]]},{"id":"dce965f3d31773c8","type":"ui-group","name":"Demo","page":"25c18baf3989c674","width":6,"height":1,"order":1,"showTitle":true,"className":"","visible":"true","disabled":"false","groupType":"default"},{"id":"25c18baf3989c674","type":"ui-page","name":"demo","ui":"d45641ed6d39fea1","path":"/page1","icon":"home","layout":"grid","theme":"205d07c2cf7295b6","breakpoints":[{"name":"Default","px":"0","cols":"3"},{"name":"Tablet","px":"576","cols":"6"},{"name":"Small Desktop","px":"768","cols":"9"},{"name":"Desktop","px":"1024","cols":"12"}],"order":2,"className":"","visible":"true","disabled":"false"},{"id":"d45641ed6d39fea1","type":"ui-base","name":"This is my ui-base","path":"/dashboard","appIcon":"","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false,"headerContent":"page","navigationStyle":"default","titleBarStyle":"default","showReconnectNotification":false,"notificationDisplayTime":5,"showDisconnectNotification":false,"allowInstall":true},{"id":"205d07c2cf7295b6","type":"ui-theme","name":"Theme Name","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}},{"id":"bcf82963f2fafef9","type":"global-config","env":[],"modules":{"@flowfuse/node-red-dashboard-2-ui-led":"1.1.0","@flowfuse/node-red-dashboard":"1.30.2"}}]

You can also blink with CSS. See How to Create a Blinking Effect with CSS3 Animations

1 Like

If you're used to PLC and scada systems, a way that may be easier to wrap your head around may be something like this:

[
    {
        "id": "b761d4dc684ca9d2",
        "type": "group",
        "z": "5114d0e940ab3dee",
        "style": {
            "stroke": "#2b2b2b",
            "stroke-opacity": "1",
            "fill": "#181818",
            "fill-opacity": "0.5",
            "label": true,
            "label-position": "nw",
            "color": "#cccccc"
        },
        "nodes": [
            "37218aa1f36e192f",
            "72a54288888666ef",
            "3b197d876795e331",
            "0830e232f5830c9e",
            "2789650e4f20148c",
            "de8c14f281f67b1f",
            "a8654d553383748d"
        ],
        "x": 454,
        "y": 513,
        "w": 1012,
        "h": 228
    },
    {
        "id": "37218aa1f36e192f",
        "type": "change",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "switch1",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 950,
        "y": 580,
        "wires": [
            []
        ]
    },
    {
        "id": "72a54288888666ef",
        "type": "trigger",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "",
        "op1": "true",
        "op2": "0",
        "op1type": "bool",
        "op2type": "str",
        "duration": "-1000",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 780,
        "y": 700,
        "wires": [
            [
                "0830e232f5830c9e"
            ]
        ]
    },
    {
        "id": "3b197d876795e331",
        "type": "inject",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 570,
        "y": 700,
        "wires": [
            [
                "72a54288888666ef"
            ]
        ]
    },
    {
        "id": "0830e232f5830c9e",
        "type": "trigger",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "",
        "op1": "",
        "op2": "false",
        "op1type": "pay",
        "op2type": "bool",
        "duration": "500",
        "extend": false,
        "overrideDelay": false,
        "units": "ms",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 1000,
        "y": 700,
        "wires": [
            [
                "de8c14f281f67b1f"
            ]
        ]
    },
    {
        "id": "2789650e4f20148c",
        "type": "debug",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "your led node",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1340,
        "y": 700,
        "wires": []
    },
    {
        "id": "de8c14f281f67b1f",
        "type": "switch",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "",
        "property": "switch1",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1170,
        "y": 700,
        "wires": [
            [
                "2789650e4f20148c"
            ]
        ]
    },
    {
        "id": "a8654d553383748d",
        "type": "group",
        "z": "5114d0e940ab3dee",
        "g": "b761d4dc684ca9d2",
        "name": "your process input",
        "style": {
            "label": true
        },
        "nodes": [
            "d0e858d54aa2b720",
            "d9f1461e47f53ef9"
        ],
        "x": 634,
        "y": 539,
        "w": 172,
        "h": 122
    },
    {
        "id": "d0e858d54aa2b720",
        "type": "inject",
        "z": "5114d0e940ab3dee",
        "g": "a8654d553383748d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 730,
        "y": 580,
        "wires": [
            [
                "37218aa1f36e192f"
            ]
        ]
    },
    {
        "id": "d9f1461e47f53ef9",
        "type": "inject",
        "z": "5114d0e940ab3dee",
        "g": "a8654d553383748d",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 730,
        "y": 620,
        "wires": [
            [
                "37218aa1f36e192f"
            ]
        ]
    }
]

Thank you for your help

But can you send this code as a flow to me ??

I know you are new to the forum @sulaiman but folks have sent you three different but equally viable answers to your question.
"Can you send this code as a flow to me" does not convince me that you are making any efforts of your own to assess the options.

So before I try and help you any more, please take the time to show us how far you have got on your own, and describe what the results have been.

You might find it educational to share your flow by Exporting and posting it here using the </> button.

1 Like

You can import the codes already supplied. How to import/export a flow

You may also benefit from watching the essentials videos they have great information that will give you the basics of node-red.

hello

It's incomprehensible to me that you're speaking like this.

(does not convince me that you are making any efforts of your own to assess the options)

i am attached my node red code i do not now the error but it is not work properly

(attachments)

flows (23).json (7.57 KB)

yes thank you it is very good code thank you very much

1 Like

Thanks for posting your code.

Your two inject nodes are wrong.


Exactly what you inject for "start flashing" is unimportant since the trigger node will send msg.payload true followed by false.
However, I'm not sure that anything will be injected here at all because there is no message coming in to the inject node with a property msg.Start.
You can just inject the default timestamp, or a string "Start" but mot msg.Start.


Similarly here there is no msg.Reset.
The trigger and delay nodes will be reset if a message with the property msg.reset arrives. Not msg.topic as you have and not msg.Reset either because message property names are case sensitive.
And a little refinement: You could inject msg.payload false at the same time as msg.reset, then there is no need for the change node, wire the inject to the led node too.

The code for my example flow was attached to my post below the picture, It's the line of text below the picture.

No worries. I came into node-red from ladder logic/c++ so switching to event based flows required a shift in logic. For me, anytime an hmi or dashboard needs to animate,I try to transform my data within node-red to make that happen, vs altering front end (browser run) code, so it's all quite clear where the action is taking place within the flow and can be altered easily..also learn to use groups to keep flows organized, sometimes can be helpful to visualize the flow of data like a ladder rung.