Compare commits

...

4 Commits

3 changed files with 21 additions and 6 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

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