Functions code for Emma's bedroom climate flow
This commit is contained in:
20
climate/emma-bedroom/set-mode.js
Normal file
20
climate/emma-bedroom/set-mode.js
Normal file
@ -0,0 +1,20 @@
|
||||
const states = global.get("homeassistant.homeAssistant.states")
|
||||
const sleeping = states["input_boolean.emma_sleeping"].state
|
||||
const earlyNight = states["binary_sensor.early_night_mode"].state
|
||||
const giveMeDarkness = states["input_boolean.give_me_darkness"].state
|
||||
const nightMode = states["input_boolean.night_mode"].state
|
||||
const goodnight = states["input_boolean.goodnight"].state
|
||||
const coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state
|
||||
|
||||
let lastMode = []
|
||||
|
||||
if (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {
|
||||
lastMode = 'bedtime'
|
||||
} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {
|
||||
lastMode = 'night'
|
||||
} else {
|
||||
lastMode = 'day'
|
||||
}
|
||||
|
||||
flow.set("emmaBedroom.lastMode", lastMode, "diskCon")
|
||||
node.status({ fill: "green", shape: "dot", text: `Last Mode Set: ${lastMode}`})
|
Reference in New Issue
Block a user