Fix hallway lighting weirdness

This commit is contained in:
2024-02-01 18:21:11 -05:00
parent 0e520df7a7
commit e58ee15b31
2 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,8 @@ const earlyNightMode = states['binary_sensor.early_night_mode'].state
const nightMode = states['input_boolean.night_mode'].state
const goodnight = states['input_boolean.goodnight'].state
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')
const duration = states['input_number.stairwell_lights_off_delay'].state
const lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state)
const threshold = parseInt(states['input_number.stairwell_lux_threshold'].state)
@ -17,7 +19,7 @@ let hallwayAction = {}
if (payload === 'on') {
if (goodnight === 'on') {
hallwayAction = 'off'
} else if (nightMode === 'on' || masterBedroomSleep === 'on') {
} else if (nightMode === 'on' || peopleSleeping === true) {
hallwayAction = 'on'
hallwayScene = 'Dimmed'
} else if (earlyNightMode === 'on') {

View File

@ -7,9 +7,9 @@ const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
let hallwayScene = {}
let hallwayAction = {}
if (goodnight === 'on') {
if (goodnight === 'on' || masterBedroomSleep === 'on') {
hallwayAction = 'off'
} else if (masterBedroomSleep === 'off' && (earlyNightMode === 'on' || nightMode === 'on')) {
} else if (earlyNightMode === 'on' || nightMode === 'on') {
hallwayAction = 'on'
hallwayScene = 'Nightlight'
} else {