Make folder for goodnight flow because it needs multiple functions
This commit is contained in:
30
housewide/goodnight/goodnight.js
Normal file
30
housewide/goodnight/goodnight.js
Normal file
@ -0,0 +1,30 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const schoolToday = states['input_boolean.kallen_school_today'].state
|
||||
const kallen = states['person.kallen_stork'].state
|
||||
const morning = states['binary_sensor.morning'].state
|
||||
|
||||
let basement = {
|
||||
"payload": {
|
||||
"action": "script.goodnight_in_basement"
|
||||
}
|
||||
}
|
||||
|
||||
let firstFloor = {
|
||||
"payload": {
|
||||
"action": "script.goodnight_on_first_floor"
|
||||
}
|
||||
}
|
||||
|
||||
let secondFloor = {
|
||||
"payload": {
|
||||
"action": "script.goodnight_on_second_floor"
|
||||
}
|
||||
}
|
||||
|
||||
if (schoolToday === 'on' && kallen === 'home' && morning === 'on') {
|
||||
node.send([basement,secondFloor])
|
||||
node.status({fill:'yellow',shape:'dot',text:'Kallen waiting for school bus'})
|
||||
} else {
|
||||
node.send([basement,firstFloor,secondFloor])
|
||||
node.status({fill:'green',shape:'dot',text:'All scripts sent'})
|
||||
}
|
Reference in New Issue
Block a user