Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

red foreach loop

MQTT_Array = ["sonoff/sonoff082/STATUS8","sonoff/sonoff084/SENSOR","sonoff/sonoff085/STATUS8","sonoff/sonoff086/STATUS8","sonoff/sonoff087/STATUS8","sonoff/sonoff089/SENSOR","sonoff/sonoff091/STATUS8","sonoff/sonoff092/SENSOR"]


for ("every element in MQTT_Array")
{
    var value = global.get('array_element.Value'); 
    if (value > 5) 
    {
        return msg;
    }
    else
    {
        return null;
    }
}
Source by discourse.nodered.org #
 
PREVIOUS NEXT
Tagged: #red #foreach #loop
ADD COMMENT
Topic
Name
3+7 =