diff --git a/climate/basement/basement_on.js b/climate/basement/basement_on.js new file mode 100644 index 0000000..3f4401e --- /dev/null +++ b/climate/basement/basement_on.js @@ -0,0 +1,24 @@ +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 + +let power = {} + +if (todaysHighTemp < 55 || outsideTemp < 40) { + power = 'on' +} else { + power = 'off' +} + +if (allowed === 'on') { + if (power === 'on') { + node.status({fill:'green',shape:'dot',text:'Heater Needed'}) + node.send(msg,null) + } else { + node.status({fill:'red',shape:'ring',text:'Heater Not Needed'}) + node.send(null,msg) + } +} else { + node.status({fill:'red',shape:'ring',text:'Heat Disabled'}) +}