From 80e756e19c511ac13601769d53eb15ea77208a16 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Thu, 29 May 2025 17:20:40 -0400 Subject: [PATCH] Use early night mode instead of evening, lights were triggering early #32 --- flows.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flows.json b/flows.json index c9564fc..6bc5473 100644 --- a/flows.json +++ b/flows.json @@ -9426,7 +9426,7 @@ "type": "function", "z": "e44b1e7a8ef7ae1d", "name": "Light Level Filter", - "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst luxThresholdLivingRoom = states['input_number.living_room_lux_threshold'].state\nconst luxThresholdStairwell = states['input_number.stairwell_lux_threshold'].state\nconst luxThresholdOutdoor = states['input_number.sunset_lights_outdoor_lux_threshold'].state\nconst evening = states['binary_sensor.evening'].state\nconst triggered = states['input_boolean.sunset_lights_triggered'].state\nconst level = msg.level\nconst room = msg.room\n\nif (evening === 'on' && triggered === 'off') {\n if (room === 'living-room' && level <= luxThresholdLivingRoom) {\n node.status({fill:'green',shape:'dot',text:'Sent (Living Room)'})\n node.send([msg,msg])\n } else if (room === 'stairwell-bottom' && level <= luxThresholdStairwell) {\n node.status({fill:'green',shape:'dot',text:'Sent (Stairwell Bottom)'})\n node.send([msg,msg])\n } else if (room === 'outdoor' && level <= luxThresholdOutdoor) {\n node.status({fill:'green',shape:'dot',text:'Sent (Outdoor)'})\n node.send([msg,msg])\n }\n} else if (evening === 'off') {\n node.status({fill:'red',shape:'ring',text:'Not Evening'})\n} else if (triggered === 'on') {\n node.status({fill:'red',shape:'ring',text:'Already Triggered'})\n} else {\n node.status({fill:'red',shape:'ring',text:'No Action'})\n}", + "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst luxThresholdLivingRoom = states['input_number.living_room_lux_threshold'].state\nconst luxThresholdStairwell = states['input_number.stairwell_lux_threshold'].state\nconst luxThresholdOutdoor = states['input_number.sunset_lights_outdoor_lux_threshold'].state\nconst earlyNight = states['binary_sensor.early_night_mode'].state\nconst triggered = states['input_boolean.sunset_lights_triggered'].state\nconst level = msg.level\nconst room = msg.room\n\nif (earlyNight === 'on' && triggered === 'off') {\n if (room === 'living-room' && level <= luxThresholdLivingRoom) {\n node.status({fill:'green',shape:'dot',text:'Sent (Living Room)'})\n node.send([msg,msg])\n } else if (room === 'stairwell-bottom' && level <= luxThresholdStairwell) {\n node.status({fill:'green',shape:'dot',text:'Sent (Stairwell Bottom)'})\n node.send([msg,msg])\n } else if (room === 'outdoor' && level <= luxThresholdOutdoor) {\n node.status({fill:'green',shape:'dot',text:'Sent (Outdoor)'})\n node.send([msg,msg])\n }\n} else if (earlyNight === 'off') {\n node.status({fill:'red',shape:'ring',text:'Not Evening'})\n} else if (triggered === 'on') {\n node.status({fill:'red',shape:'ring',text:'Already Triggered'})\n} else {\n node.status({fill:'red',shape:'ring',text:'No Action'})\n}", "outputs": 2, "timeout": 0, "noerr": 0,