Use early night mode instead of evening, lights were triggering early

#32
This commit is contained in:
2025-05-29 17:20:40 -04:00
parent d06b0a247b
commit 80e756e19c

View File

@ -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,