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

home_automation/HA-NerdFlows#32
This commit is contained in:
2025-05-29 17:30:44 -04:00
parent 054b498f51
commit ba7af1addf

View File

@ -2,12 +2,12 @@ const states = global.get('homeassistant.homeAssistant.states')
const luxThresholdLivingRoom = states['input_number.living_room_lux_threshold'].state const luxThresholdLivingRoom = states['input_number.living_room_lux_threshold'].state
const luxThresholdStairwell = states['input_number.stairwell_lux_threshold'].state const luxThresholdStairwell = states['input_number.stairwell_lux_threshold'].state
const luxThresholdOutdoor = states['input_number.sunset_lights_outdoor_lux_threshold'].state const luxThresholdOutdoor = states['input_number.sunset_lights_outdoor_lux_threshold'].state
const evening = states['binary_sensor.evening'].state const earlyNight = states['binary_sensor.early_night_mode'].state
const triggered = states['input_boolean.sunset_lights_triggered'].state const triggered = states['input_boolean.sunset_lights_triggered'].state
const level = msg.level const level = msg.level
const room = msg.room const room = msg.room
if (evening === 'on' && triggered === 'off') { if (earlyNight === 'on' && triggered === 'off') {
if (room === 'living-room' && level <= luxThresholdLivingRoom) { if (room === 'living-room' && level <= luxThresholdLivingRoom) {
node.status({fill:'green',shape:'dot',text:'Sent (Living Room)'}) node.status({fill:'green',shape:'dot',text:'Sent (Living Room)'})
node.send([msg,msg]) node.send([msg,msg])
@ -18,7 +18,7 @@ if (evening === 'on' && triggered === 'off') {
node.status({fill:'green',shape:'dot',text:'Sent (Outdoor)'}) node.status({fill:'green',shape:'dot',text:'Sent (Outdoor)'})
node.send([msg,msg]) node.send([msg,msg])
} }
} else if (evening === 'off') { } else if (earlyNight === 'off') {
node.status({fill:'red',shape:'ring',text:'Not Evening'}) node.status({fill:'red',shape:'ring',text:'Not Evening'})
} else if (triggered === 'on') { } else if (triggered === 'on') {
node.status({fill:'red',shape:'ring',text:'Already Triggered'}) node.status({fill:'red',shape:'ring',text:'Already Triggered'})