Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
0980c3b1ec
|
|||
86730c48ef
|
|||
4029a7992f
|
|||
d4bf2e3f23
|
21
climate/emma-bedroom/set-temp-vars.js
Normal file
21
climate/emma-bedroom/set-temp-vars.js
Normal file
@ -0,0 +1,21 @@
|
||||
const topic = msg.topic
|
||||
const payload = msg.payload
|
||||
const lastMode = flow.get('emmaBedroom.lastMode', 'diskCon')
|
||||
|
||||
if (topic === 'daytemp') {
|
||||
flow.set('emmaBedroom.dayTemp', payload, 'diskCon')
|
||||
} else if (topic === 'nighttemp') {
|
||||
flow.set("emmaBedroom.nightTemp", payload, "diskCon")
|
||||
} else if (topic === 'bedtemp') {
|
||||
flow.set("emmaBedroom.bedTemp", payload, "diskCon")
|
||||
}
|
||||
|
||||
if (lastMode === 'day') {
|
||||
flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.dayTemp', 'diskCon'), 'diskCon')
|
||||
} else if (lastMode === 'night') {
|
||||
flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.nightTemp', 'diskCon'), 'diskCon')
|
||||
} else if (lastMode === 'bedtime') {
|
||||
flow.set('emmaBedroom.airconTargetTemp', flow.get('emmaBedroom.bedTemp', 'diskCon'), 'diskCon')
|
||||
}
|
||||
|
||||
node.status({fill:'green',shape:'dot',text:`Set ${topic} to ${payload}`})
|
@ -1,5 +1,6 @@
|
||||
const states = global.get('homeassistant.homeAssistant.states')
|
||||
const earlyNightMode = states['binary_sensor.early_night_mode'].state
|
||||
const outdoorLux = parseInt(states['sensor.home_tempest_illuminance'].state)
|
||||
const threshold = parseInt(states['input_number.front_porch_lux_threshold'].state)
|
||||
const frontPorchToggle = states['input_boolean.front_porch_light_on'].state
|
||||
const holidaymode = states['input_boolean.holiday_mode'].state
|
||||
const currentholiday = states['input_select.holiday_animation'].state
|
||||
@ -9,7 +10,7 @@ let holidayMsg = {
|
||||
"holiday": holiday
|
||||
}
|
||||
|
||||
if (earlyNightMode === 'on' && frontPorchToggle === 'on') {
|
||||
if ((outdoorLux <= threshold) && frontPorchToggle === 'on') {
|
||||
if (holidaymode === 'on') {
|
||||
node.status({fill:"blue",shape:"dot",text:"Holiday On"})
|
||||
node.send([holidayMsg,msg])
|
||||
@ -20,7 +21,7 @@ if (earlyNightMode === 'on' && frontPorchToggle === 'on') {
|
||||
} else {
|
||||
if (frontPorchToggle === 'off') {
|
||||
node.status({ fill: "red", shape: "ring", text: "Disabled" })
|
||||
} else if (earlyNightMode === 'off') {
|
||||
} else if (outdoorLux > threshold) {
|
||||
node.status({ fill: "red", shape: "ring", text: "Daytime" })
|
||||
}
|
||||
}
|
@ -3,11 +3,13 @@ const lights = states['light.kallen_bedroom_lights'].state
|
||||
const duration = states['input_number.kallen_bedroom_lights_off_delay'].state
|
||||
const lux = parseInt(states['sensor.kallen_bedroom_illuminance'].state)
|
||||
const threshold = parseInt(states['input_number.kallen_bedroom_lux_threshold'].state)
|
||||
const sleeping = states['input_boolean.kallen_sleeping'].state
|
||||
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
|
||||
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
|
||||
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')
|
||||
const payload = msg.payload
|
||||
const newDuration = duration * 60
|
||||
|
||||
if (sleeping === 'off') {
|
||||
if (peopleSleeping === false) {
|
||||
if (payload === 'on') {
|
||||
if (lux <= threshold && lights === 'off') {
|
||||
node.status({fill:'green',shape:'dot',text:'Turning lights on'})
|
||||
|
Reference in New Issue
Block a user