Light Automation based on multiple states


#1

Hi all, just started experimenting with node-red, so far it has been brilliant but I am trying to move automatons from HA into node red and I can’t figure one out.

I have some kitchen led strips which change colour based on the outside temperature, which is picked up from a weather sensor. I can get the sensor to output the reading to the switch node, which then sets the scene based on the range.

I am struggling to figure out how to only get the lights to switch scenes if the led state is ON only and not do anything if the led state is OFF, I tried to feed the state into the switch node but it turns on the scene regardless if light is off or on

I am sure there is a simple logic to it, but can’t crack it. my flow below


#2

[{"id":"ebde0188.6ec7c","type":"poll-state","z":"ffbd7f06.4a014","name":"","server":"2dad33ee.42bf5c","updateinterval":"10","outputinitially":false,"outputonchanged":false,"entity_id":"sensor.met_office_temperature","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":224,"y":672,"wires":[["9d2a5df4.5c0f9"]]},{"id":"9d2a5df4.5c0f9","type":"api-current-state","z":"ffbd7f06.4a014","name":"","server":"2dad33ee.42bf5c","outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.kithen_led","state_type":"str","state_location":"","override_payload":"none","entity_location":"","override_data":"none","x":536,"y":672,"wires":[["e734f0aa.3e34c"],[]]},{"id":"e734f0aa.3e34c","type":"switch","z":"ffbd7f06.4a014","name":"Temperature Check","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":778,"y":672,"wires":[[]]}]

#3

thank you so much, works perfectly now