Disable E's climate watchdog if aircon not in use
home_automation/Home-Assistant-Configs#265
This commit is contained in:
@@ -1,9 +1,27 @@
|
|||||||
const states = global.get('homeassistant.homeAssistant.states')
|
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 === true && allowed === 'on' && schedMode === 'AC' && coolingActive === 'on') {
|
||||||
|
proceed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
if (sleeping != 'on') {
|
||||||
node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})
|
node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})
|
||||||
return null
|
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']
|
const airconEntity = ['climate.emma_bedroom_aircon']
|
||||||
|
|||||||
Reference in New Issue
Block a user