diff --git a/second-floor/kallen-bedroom/kallen-bedroom.js b/second-floor/kallen-bedroom/kallen-bedroom.js index 7248183..5a71fb8 100644 --- a/second-floor/kallen-bedroom/kallen-bedroom.js +++ b/second-floor/kallen-bedroom/kallen-bedroom.js @@ -3,11 +3,13 @@ const lights = states['light.kallen_bedroom_lights'].state const duration = states['input_number.kallen_bedroom_lights_off_delay'].state const lux = parseInt(states['sensor.kallen_bedroom_illuminance'].state) const threshold = parseInt(states['input_number.kallen_bedroom_lux_threshold'].state) -const sleeping = states['input_boolean.kallen_sleeping'].state +const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state +const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state +const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on') const payload = msg.payload const newDuration = duration * 60 -if (sleeping === 'off') { +if (peopleSleeping === false) { if (payload === 'on') { if (lux <= threshold && lights === 'off') { node.status({fill:'green',shape:'dot',text:'Turning lights on'})