Rename floor-based folders
This commit is contained in:
34
second-floor/stairwell/timer-finished.js
Normal file
34
second-floor/stairwell/timer-finished.js
Normal file
@ -0,0 +1,34 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
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')
|
||||
|
||||
let hallwayScene = {}
|
||||
let hallwayAction = {}
|
||||
|
||||
if (goodnight === 'on' || peopleSleeping === true) {
|
||||
hallwayAction = 'off'
|
||||
} else if (earlyNightMode === 'on' || nightMode === 'on') {
|
||||
hallwayAction = 'on'
|
||||
hallwayScene = 'Nightlight'
|
||||
} else {
|
||||
hallwayAction = 'off'
|
||||
}
|
||||
|
||||
msg.hallway = hallwayAction
|
||||
|
||||
// Turn off Stairwell LED Strip
|
||||
node.send([null,null,msg])
|
||||
|
||||
// Hallway actions
|
||||
if (hallwayAction === 'on') {
|
||||
msg.scene = hallwayScene
|
||||
node.status({fill:'green',shape:'dot',text:'Hallway ' + hallwayScene})
|
||||
node.send([msg,null,null])
|
||||
} else if (hallwayAction === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Hallway Off'})
|
||||
node.send([null,msg,null])
|
||||
}
|
Reference in New Issue
Block a user