Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
5440325aaf
|
|||
|
4aa305c9d2
|
14
climate/emma-bedroom/outdoor-threshold.js
Normal file
14
climate/emma-bedroom/outdoor-threshold.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const outdoor = global.get("outdoorTemp.tempInt")
|
||||||
|
const thresholdEntity = global.get("homeassistant.homeAssistant.states['input_number.emma_bedroom_aircon_mode_threshold'].state")
|
||||||
|
const threshold = parseInt(thresholdEntity)
|
||||||
|
|
||||||
|
msg.outdoor = outdoor
|
||||||
|
msg.modeThreshold = threshold
|
||||||
|
|
||||||
|
if (outdoor >= threshold) {
|
||||||
|
node.status({fill:"green",shape:"dot",text:`${outdoor} >= ${threshold}`})
|
||||||
|
return msg
|
||||||
|
} else {
|
||||||
|
node.status({fill:"red",shape:"ring",text:`${outdoor} < ${threshold}`})
|
||||||
|
return null
|
||||||
|
}
|
||||||
14
climate/master-bedroom/outdoor-threshold.js
Normal file
14
climate/master-bedroom/outdoor-threshold.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
const outdoor = global.get("outdoorTemp.tempInt")
|
||||||
|
const thresholdEntity = global.get("homeassistant.homeAssistant.states['input_number.master_bedroom_aircon_mode_threshold'].state")
|
||||||
|
const threshold = parseInt(thresholdEntity)
|
||||||
|
|
||||||
|
msg.outdoor = outdoor
|
||||||
|
msg.modeThreshold = threshold
|
||||||
|
|
||||||
|
if (outdoor >= threshold) {
|
||||||
|
node.status({fill:"green",shape:"dot",text:`${outdoor} >= ${threshold}`})
|
||||||
|
return msg
|
||||||
|
} else {
|
||||||
|
node.status({fill:"red",shape:"ring",text:`${outdoor} < ${threshold}`})
|
||||||
|
return null
|
||||||
|
}
|
||||||
@@ -5,7 +5,8 @@ const lux = parseInt(states['sensor.master_bedroom_illuminance'].state)
|
|||||||
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
|
const threshold = parseInt(states['input_number.master_bedroom_lux_threshold'].state)
|
||||||
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
|
const masterBedroomSleep = states['input_boolean.master_bedroom_sleeping'].state
|
||||||
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
|
const kallenBedroomSleep = states['input_boolean.kallen_sleeping'].state
|
||||||
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on')
|
const emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
|
||||||
|
const peopleSleeping = (masterBedroomSleep === 'on' || kallenBedroomSleep === 'on' || emmaBedroomSleep === 'on')
|
||||||
const nightMode = states['input_boolean.night_mode'].state
|
const nightMode = states['input_boolean.night_mode'].state
|
||||||
const payload = msg.payload
|
const payload = msg.payload
|
||||||
const newDuration = duration * 60
|
const newDuration = duration * 60
|
||||||
|
|||||||
@@ -2,11 +2,17 @@ const states = global.get('homeassistant.homeAssistant.states')
|
|||||||
const lights = states['light.upstairs_bathroom_lights'].state
|
const lights = states['light.upstairs_bathroom_lights'].state
|
||||||
const duration = states['input_number.upstairs_bathroom_motion_off_delay'].state
|
const duration = states['input_number.upstairs_bathroom_motion_off_delay'].state
|
||||||
const lux = parseInt(states['sensor.upstairs_bathroom_illuminance'].state)
|
const lux = parseInt(states['sensor.upstairs_bathroom_illuminance'].state)
|
||||||
const threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
|
|
||||||
const showerMode = states['input_boolean.shower_mode'].state
|
const showerMode = states['input_boolean.shower_mode'].state
|
||||||
|
const emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
|
||||||
const payload = msg.payload
|
const payload = msg.payload
|
||||||
const newDuration = duration * 60
|
const newDuration = duration * 60
|
||||||
|
|
||||||
|
let threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
|
||||||
|
|
||||||
|
if (emmaBedroomSleep === 'on') {
|
||||||
|
threshold = 10
|
||||||
|
}
|
||||||
|
|
||||||
let timerCancel = {
|
let timerCancel = {
|
||||||
"payload": "stop"
|
"payload": "stop"
|
||||||
}
|
}
|
||||||
@@ -32,11 +38,11 @@ if (showerMode === 'off') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
node.log("----- Upstairs Bathroom Motion Parameters Start -----")
|
node.log("----- Upstairs Bathroom Motion Parameters Start -----")
|
||||||
node.log("Upstairs Bathroom payload: " + payload)
|
node.log(`Upstairs Bathroom payload: ${payload}`)
|
||||||
node.log("Upstairs Bathroom lights: " + lights)
|
node.log(`Upstairs Bathroom lights: ${lights}`)
|
||||||
node.log("Upstairs Bathroom duration: " + duration)
|
node.log(`Upstairs Bathroom duration: ${duration}`)
|
||||||
node.log("Upstairs Bathroom newDuration: " + newDuration)
|
node.log(`Upstairs Bathroom newDuration: ${newDuration}`)
|
||||||
node.log("Upstairs Bathroom lux: " + lux)
|
node.log(`Upstairs Bathroom lux: ${lux}`)
|
||||||
node.log("Upstairs Bathroom threshold: " + threshold)
|
node.log(`Upstairs Bathroom threshold: ${threshold}`)
|
||||||
node.log("Upstairs Bathroom showerMode: " + showerMode)
|
node.log(`Upstairs Bathroom showerMode: ${showerMode}`)
|
||||||
node.log("----- Upstairs Bathroom Motion Parameters End -----")
|
node.log("----- Upstairs Bathroom Motion Parameters End -----")
|
||||||
Reference in New Issue
Block a user