Don't turn on master bedroom light when K is sleeping
This commit is contained in:
@ -3,12 +3,14 @@ const lights = states['light.master_bedroom_lights'].state
|
|||||||
const duration = states['input_number.master_bedroom_lights_off_delay'].state
|
const duration = states['input_number.master_bedroom_lights_off_delay'].state
|
||||||
const lux = parseInt(states['sensor.master_bedroom_illuminance'].state)
|
const lux = parseInt(states['sensor.master_bedroom_illuminance'].state)
|
||||||
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
|
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
|
||||||
const sleeping = 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 nightMode = states['input_boolean.night_mode'].state
|
const nightMode = states['input_boolean.night_mode'].state
|
||||||
const payload = msg.payload
|
const payload = msg.payload
|
||||||
const newDuration = duration * 60
|
const newDuration = duration * 60
|
||||||
|
|
||||||
if (sleeping === 'off' && nightMode === 'off') {
|
if (peopleSleeping === true && nightMode === 'off') {
|
||||||
if (payload === 'on') {
|
if (payload === 'on') {
|
||||||
if (lux <= threshold || lights === 'on') {
|
if (lux <= threshold || lights === 'on') {
|
||||||
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
node.status({fill:'green',shape:'dot',text:'Lights On'})
|
||||||
|
Reference in New Issue
Block a user