Functions code for Emma's bedroom climate flow

This commit is contained in:
2025-03-28 21:35:05 -04:00
parent 71db65fca2
commit 02ce030fe7
5 changed files with 516 additions and 0 deletions

View 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}`})