Active rate
I see this in your code, which may be a clue:
// Low rate come's from MQTT (svalue1)
I expect you have some understanding of how an msg.payload.svalue1 equal to "1358069" indicates that the low rate is currently active, but you don't seem to have explained it.
However, here is a function node which will compare a value extracted from message.payload with the previously seen value stored in context.
const thisvalue = msg.payload // Extract the latest value from payload
const lastvalue = context.get("lastvalue") || 0 // and previous value from context
if (thisvalue > lastvalue) { // Do some sort of comparison
msg.payload = "LARGER"
}
else {
msg.payload = "NO LARGER"
}
context.set("lastvalue", thisvalue)
return msg;
You might be able to adapt this to your input data. Note that your msg.payload.svalue1 is a string not a number, and you may wish to convert it to a number before doing any comparison.
Making an LED flash
My preferred way would be to use a custom class and CSS animation for this.
While there is an LED widget for both dashboard 1 and 2, neither of them has the ability to accept a custom class.
Therefore you need some jiggery-pokery to apply the CSS animation to the LED.
This is an example using Dashboard 2
[{"id":"f6ed848e6f96a4f5","type":"ui-template","z":"dc69179c349b2cd7","group":"","page":"b3ca132d0792292e","ui":"","name":"CSS","order":0,"width":0,"height":0,"head":"","format":"@keyframes blink-animation {\n50% {\nvisibility: hidden;\n}\n}\n\n.myClass:has(.blink) .nrdb-ui-led {\n animation: blink-animation 1s steps(1, start) 0s infinite;\n}\n\n.myclass:has(.noblink) .nrdb-ui-led {\nanimation: none;\n}","storeOutMessages":true,"passthru":true,"resendOnRefresh":true,"templateScope":"page:style","className":"","x":800,"y":50,"wires":[[]]},{"id":"a53524c1ceccc021","type":"ui-button","z":"dc69179c349b2cd7","group":"2bf45d898cab6025","name":"Blink","label":"Blink","order":4,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"blink","payloadType":"str","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":366,"y":111,"wires":[["3fc49ca1d0a1a7e1"]]},{"id":"17f68243bed3b672","type":"ui-button","z":"dc69179c349b2cd7","group":"2bf45d898cab6025","name":"No Blink","label":"Noblink","order":5,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"noblink","payloadType":"str","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":376,"y":151,"wires":[["3fc49ca1d0a1a7e1"]]},{"id":"3fc49ca1d0a1a7e1","type":"change","z":"dc69179c349b2cd7","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ui_update.class","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":590,"y":125,"wires":[["ab11f1e8284fa144"]]},{"id":"15bccb2e95d0f039","type":"ui-led","z":"dc69179c349b2cd7","name":"","group":"2bf45d898cab6025","order":1,"width":"2","height":"2","label":"","labelPlacement":"left","labelAlignment":"left","states":[{"value":"false","valueType":"bool","color":"#ff0000"},{"value":"true","valueType":"bool","color":"#00ff00"}],"allowColorForValueInMessage":false,"shape":"circle","showBorder":false,"showGlow":true,"x":550,"y":250,"wires":[]},{"id":"ab11f1e8284fa144","type":"ui-text","z":"dc69179c349b2cd7","group":"2bf45d898cab6025","order":6,"width":"2","height":"1","name":"Dummy text widget","label":" ","format":"{{msg.payload}}","layout":"row-left","style":false,"font":"","fontSize":16,"color":"#717171","wrapText":false,"className":"","value":" ","valueType":"str","x":835,"y":125,"wires":[]},{"id":"d8877d4e349e1aba","type":"ui-button","z":"dc69179c349b2cd7","group":"2bf45d898cab6025","name":"Red","label":"Red","order":2,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"false","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":375,"y":200,"wires":[["15bccb2e95d0f039","7e6ba07426701994"]]},{"id":"373be2e7dc7d25bc","type":"ui-button","z":"dc69179c349b2cd7","group":"2bf45d898cab6025","name":"Green","label":"Green","order":3,"width":"1","height":"1","emulateClick":false,"tooltip":"","color":"","bgcolor":"","className":"","icon":"","iconPosition":"left","payload":"true","payloadType":"bool","topic":"topic","topicType":"msg","buttonColor":"","textColor":"","iconColor":"","enableClick":true,"enablePointerdown":false,"pointerdownPayload":"","pointerdownPayloadType":"str","enablePointerup":false,"pointerupPayload":"","pointerupPayloadType":"str","x":375,"y":250,"wires":[["15bccb2e95d0f039","7e6ba07426701994"]]},{"id":"7e6ba07426701994","type":"change","z":"dc69179c349b2cd7","name":"","rules":[{"t":"set","p":"ui_update.class","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":200,"wires":[["ab11f1e8284fa144"]]},{"id":"b3ca132d0792292e","type":"ui-page","name":"Test","ui":"d45641ed6d39fea1","path":"/test","icon":"home","layout":"grid","theme":"c835807cdc98644e","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":1,"className":"","visible":"true","disabled":"false"},{"id":"2bf45d898cab6025","type":"ui-group","name":"GroupTest","page":"b3ca132d0792292e","width":"6","height":"1","order":1,"showTitle":true,"className":"myClass","visible":"true","disabled":"false","groupType":"default"},{"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":"c835807cdc98644e","type":"ui-theme","name":"Default Theme","colors":{"surface":"#ffffff","primary":"#0094CE","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"density":"default","pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}},{"id":"9cb7e77d8f8d7575","type":"global-config","env":[],"modules":{"@flowfuse/node-red-dashboard":"1.30.2","@flowfuse/node-red-dashboard-2-ui-led":"1.1.0"}}]
An alternative would be some nodes to alternately send the codes for red and grey when the rate is active, but you have to be able to control the flash rate and stop flashing in the right state when the rate is no longer active.