Goodnight should leave first floor alone if Kallen is waiting for school
home_automation/HA-NerdFlows#29
This commit is contained in:
18
housewide/goodnight.js
Normal file
18
housewide/goodnight.js
Normal file
@ -0,0 +1,18 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const schoolToday = states['input_boolean.kallen_school_today'].state
|
||||
const kallen = states['person.kallen_stork'].state
|
||||
|
||||
let scripts = ['script.goodnight_in_basement','script.goodnight_on_second_floor']
|
||||
|
||||
if ((schoolToday === 'on' && kallen != 'home') || schoolToday === 'off') {
|
||||
scripts.push('script.goodnight_on_first_floor')
|
||||
}
|
||||
|
||||
let sendScripts = {
|
||||
"payload": {
|
||||
"action": scripts
|
||||
}
|
||||
}
|
||||
|
||||
node.send(sendScripts)
|
||||
node.status({fill:'green',shape:'dot',text:'Scripts Sent'})
|
Reference in New Issue
Block a user