Files
HA-NerdFlows-Functions/climate/basement/basement_off.js

17 lines
687 B
JavaScript

const states = global.get('homeassistant.homeAssistant.states')
const allowed = states['input_boolean.basement_studio_heat_allowed'].state
const idleTemp = states['input_number.basement_studio_idle_temp'].state
const outsideTemp = states['weather.iron_nerd_weather_station'].attributes.temperature
if (allowed === 'on') {
if (outsideTemp <= 32) {
msg.idle_temp = parseFloat(idleTemp)
node.status({fill:'green',shape:'dot',text:'Idle Temp Set'})
node.send(msg,null)
} else {
node.status({fill:'red',shape:'ring',text:'Heater Shutoff'})
node.send(null,msg)
}
} else {
node.status({fill:'red',shape:'ring',text:'Heat Not Allowed'})
}