Continue improving basement heater logic, as the weather warms up
This commit is contained in:
@ -2,18 +2,27 @@ const states = global.get('homeassistant.homeAssistant.states')
|
||||
const allowed = states['input_boolean.basement_studio_heat_allowed'].state
|
||||
const outsideTemp = states['weather.iron_nerd_weather_station'].attributes.temperature
|
||||
const todaysHighTemp = states['sensor.todays_high_temp'].state
|
||||
const basementTemp = states['sensor.basement_studio_temperature'].state
|
||||
|
||||
let power = {}
|
||||
let reason = {}
|
||||
|
||||
if (todaysHighTemp < 55 || outsideTemp < 40) {
|
||||
if (todaysHighTemp < 55) {
|
||||
power = 'on'
|
||||
reason = 'Todays High Temperature'
|
||||
} else if (outsideTemp < 40) {
|
||||
power = 'on'
|
||||
reason = 'Outside Temperature'
|
||||
} else if (basementTemp < 64) {
|
||||
power = 'on'
|
||||
reason = 'Basement Temperature'
|
||||
} else {
|
||||
power = 'off'
|
||||
}
|
||||
|
||||
if (allowed === 'on') {
|
||||
if (power === 'on') {
|
||||
node.status({fill:'green',shape:'dot',text:'Heater Needed'})
|
||||
node.status({fill:'green',shape:'dot',text:'Heater Needed: ' + reason})
|
||||
node.send(msg,null)
|
||||
} else {
|
||||
node.status({fill:'red',shape:'ring',text:'Heater Not Needed'})
|
||||
|
Reference in New Issue
Block a user