Fix hallway lighting weirdness
This commit is contained in:
@ -5,6 +5,8 @@ const earlyNightMode = states['binary_sensor.early_night_mode'].state
|
|||||||
const nightMode = states['input_boolean.night_mode'].state
|
const nightMode = states['input_boolean.night_mode'].state
|
||||||
const goodnight = states['input_boolean.goodnight'].state
|
const goodnight = states['input_boolean.goodnight'].state
|
||||||
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].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 duration = states['input_number.stairwell_lights_off_delay'].state
|
||||||
const lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state)
|
const lux = parseInt(states['sensor.stairwell_bottom_illuminance'].state)
|
||||||
const threshold = parseInt(states['input_number.stairwell_lux_threshold'].state)
|
const threshold = parseInt(states['input_number.stairwell_lux_threshold'].state)
|
||||||
@ -17,7 +19,7 @@ let hallwayAction = {}
|
|||||||
if (payload === 'on') {
|
if (payload === 'on') {
|
||||||
if (goodnight === 'on') {
|
if (goodnight === 'on') {
|
||||||
hallwayAction = 'off'
|
hallwayAction = 'off'
|
||||||
} else if (nightMode === 'on' || masterBedroomSleep === 'on') {
|
} else if (nightMode === 'on' || peopleSleeping === true) {
|
||||||
hallwayAction = 'on'
|
hallwayAction = 'on'
|
||||||
hallwayScene = 'Dimmed'
|
hallwayScene = 'Dimmed'
|
||||||
} else if (earlyNightMode === 'on') {
|
} else if (earlyNightMode === 'on') {
|
||||||
|
@ -7,9 +7,9 @@ const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
|
|||||||
let hallwayScene = {}
|
let hallwayScene = {}
|
||||||
let hallwayAction = {}
|
let hallwayAction = {}
|
||||||
|
|
||||||
if (goodnight === 'on') {
|
if (goodnight === 'on' || masterBedroomSleep === 'on') {
|
||||||
hallwayAction = 'off'
|
hallwayAction = 'off'
|
||||||
} else if (masterBedroomSleep === 'off' && (earlyNightMode === 'on' || nightMode === 'on')) {
|
} else if (earlyNightMode === 'on' || nightMode === 'on') {
|
||||||
hallwayAction = 'on'
|
hallwayAction = 'on'
|
||||||
hallwayScene = 'Nightlight'
|
hallwayScene = 'Nightlight'
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user