Compare commits

..

4 Commits

7 changed files with 47 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ let fanOnlyMsg = {
"topic": "Emma AC Mode: Fan Only" "topic": "Emma AC Mode: Fan Only"
} }
if (topic === 'emmabedroom-cooling') { if (topic === 'emmabedroom-climate') {
if (acMode === 'AC') { if (acMode === 'AC') {
node.status({fill:"green",shape:"dot",text:"AC Cooling"}) node.status({fill:"green",shape:"dot",text:"AC Cooling"})
return coolMsg return coolMsg

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

View File

@@ -322,7 +322,7 @@ if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'o
node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" }) node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" })
node.log("Emma Bedroom Climate: Blocked (sleep mode)") node.log("Emma Bedroom Climate: Blocked (sleep mode)")
} else { } else {
if (topic === 'emmabedroom-cooling' && ac === 'on') { if (topic === 'emmabedroom-climate' && ac === 'on') {
node.status({ fill: "green", shape: "dot", text: "Cooling Schedule" }) node.status({ fill: "green", shape: "dot", text: "Cooling Schedule" })
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null]) node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null])
node.log("Emma Bedroom Climate: Auto/Cooling") node.log("Emma Bedroom Climate: Auto/Cooling")

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

View File

@@ -348,7 +348,7 @@ if (type === 'auto' && time != 'bedtime') {
} }
// Automated responses // Automated responses
if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'off') { if (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'off') { //! allowed === 'off' currently because of upstairs heat issues. Need to figure out a way to still allow wakeup flow to run.
node.log("Master Bedroom Climate: Auto") node.log("Master Bedroom Climate: Auto")
if (sleeping === 'on' && topic != 'mrbedroom-wakeup') { if (sleeping === 'on' && topic != 'mrbedroom-wakeup') {
node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" }) node.status({ fill: "red", shape: "ring", text: "Blocked (sleep mode)" })

View File

@@ -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

View File

@@ -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 -----")