Compare commits

...

7 Commits

8 changed files with 66 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ let fanOnlyMsg = {
"topic": "Emma AC Mode: Fan Only"
}
if (topic === 'emmabedroom-cooling') {
if (topic === 'emmabedroom-climate') {
if (acMode === 'AC') {
node.status({fill:"green",shape:"dot",text:"AC Cooling"})
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.log("Emma Bedroom Climate: Blocked (sleep mode)")
} else {
if (topic === 'emmabedroom-cooling' && ac === 'on') {
if (topic === 'emmabedroom-climate' && ac === 'on') {
node.status({ fill: "green", shape: "dot", text: "Cooling Schedule" })
node.send([[sendDisplay, sendHvac, sendTemp, sendAcFan, sendEco], null, null])
node.log("Emma Bedroom Climate: Auto/Cooling")

View File

@@ -1,15 +1,30 @@
const states = global.get('homeassistant.homeAssistant.states')
const sleeping = states['input_boolean.emma_sleeping'].state
if (sleeping !== 'on') {
// Check if all settings support aircon usage
const ac = global.get('emmaBedroom.aircon.installed', "diskCon")
const allowed = states['input_boolean.emma_bedroom_climate_protocol'].state
const schedMode = states['input_select.scheduled_climate_mode_emma_bedroom'].state
const coolingActive = states["input_boolean.emma_bedroom_cooling_on"].state
const sleeping = states["input_boolean.emma_sleeping"].state
let proceed = false
if (ac === 'on' && allowed === 'on' && schedMode === 'AC' && coolingActive === 'on') {
proceed = true
}
if (sleeping != 'on') {
node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})
return null
} else if (proceed === false) {
node.status({fill:'red',shape:'ring',text:'Aircon not in use, watchdog disabled'})
return null
}
const airconEntity = ['climate.emma_bedroom_aircon']
// Gather relevant attributes from the aircon entity
const airconEntity = ['climate.emma_bedroom_aircon']
const airconState = msg.payload.state
const airconAttributes = msg.payload.attributes
const airconEco = airconAttributes['eco_mode']

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
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")
if (sleeping === 'on' && topic != 'mrbedroom-wakeup') {
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 masterBedroomSleep = states['input_boolean.master_bedroom_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 payload = msg.payload
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 duration = states['input_number.upstairs_bathroom_motion_off_delay'].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 emmaBedroomSleep = states['input_boolean.emma_sleeping'].state
const payload = msg.payload
const newDuration = duration * 60
let threshold = parseInt(states['input_number.upstairs_bathroom_lux_threshold'].state)
if (emmaBedroomSleep === 'on') {
threshold = 10
}
let timerCancel = {
"payload": "stop"
}
@@ -32,11 +38,11 @@ if (showerMode === 'off') {
}
node.log("----- Upstairs Bathroom Motion Parameters Start -----")
node.log("Upstairs Bathroom payload: " + payload)
node.log("Upstairs Bathroom lights: " + lights)
node.log("Upstairs Bathroom duration: " + duration)
node.log("Upstairs Bathroom newDuration: " + newDuration)
node.log("Upstairs Bathroom lux: " + lux)
node.log("Upstairs Bathroom threshold: " + threshold)
node.log("Upstairs Bathroom showerMode: " + showerMode)
node.log(`Upstairs Bathroom payload: ${payload}`)
node.log(`Upstairs Bathroom lights: ${lights}`)
node.log(`Upstairs Bathroom duration: ${duration}`)
node.log(`Upstairs Bathroom newDuration: ${newDuration}`)
node.log(`Upstairs Bathroom lux: ${lux}`)
node.log(`Upstairs Bathroom threshold: ${threshold}`)
node.log(`Upstairs Bathroom showerMode: ${showerMode}`)
node.log("----- Upstairs Bathroom Motion Parameters End -----")