From ad9de77f72494484bbfed70fe1037c34efe506da Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Tue, 11 Mar 2025 02:01:29 -0400 Subject: [PATCH] Improve logic for when basement heater is needed --- flows.json | 78 ++++++++++++++++++++---------------------------------- 1 file changed, 28 insertions(+), 50 deletions(-) diff --git a/flows.json b/flows.json index 242753b..861c850 100644 --- a/flows.json +++ b/flows.json @@ -1252,11 +1252,11 @@ "73078f818abdc6c2", "2516c6e3146cc851", "d6e7197427bb4d1b", - "6c1ffa37c98be592", "4b7ed8ad595ee9cb", "b7022ac46a70a7d8", "a64928d7a0b836cf", - "aecc95a3db3369e2" + "aecc95a3db3369e2", + "bd6bdc6ed9aded9d" ], "x": 34, "y": 579, @@ -15430,7 +15430,7 @@ "11aabd786c07244f", "ea5306d6f92d9550", "d6e7197427bb4d1b", - "6c1ffa37c98be592" + "bd6bdc6ed9aded9d" ] ] }, @@ -15518,7 +15518,7 @@ "11aabd786c07244f", "ea5306d6f92d9550", "d6e7197427bb4d1b", - "6c1ffa37c98be592" + "bd6bdc6ed9aded9d" ] ] }, @@ -15578,7 +15578,7 @@ "2516c6e3146cc851", "ea5306d6f92d9550", "d6e7197427bb4d1b", - "6c1ffa37c98be592" + "bd6bdc6ed9aded9d" ] ], "l": false @@ -16435,50 +16435,6 @@ [] ] }, - { - "id": "6c1ffa37c98be592", - "type": "api-current-state", - "z": "47f17992fab9b4f5", - "g": "550e5b2d99316b12", - "name": "Heat Allowed", - "server": "9e87348d.9c1c48", - "version": 3, - "outputs": 2, - "halt_if": "on", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_boolean.basement_studio_heat_allowed", - "state_type": "str", - "blockInputOverrides": true, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "", - "valueType": "entityState" - } - ], - "for": "0", - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 390, - "y": 800, - "wires": [ - [ - "4b7ed8ad595ee9cb" - ], - [] - ], - "outputLabels": [ - "yes", - "no" - ] - }, { "id": "4b7ed8ad595ee9cb", "type": "api-call-service", @@ -16743,7 +16699,7 @@ "y": 800, "wires": [ [ - "6c1ffa37c98be592" + "bd6bdc6ed9aded9d" ], [] ], @@ -17300,6 +17256,28 @@ [] ] }, + { + "id": "bd6bdc6ed9aded9d", + "type": "function", + "z": "47f17992fab9b4f5", + "g": "550e5b2d99316b12", + "name": "Heat Logic", + "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.basement_studio_heat_allowed'].state\nconst outsideTemp = states['weather.iron_nerd_weather_station'].attributes.temperature\nconst todaysHighTemp = states['sensor.todays_high_temp'].state\n\nlet power = {}\n\nif (todaysHighTemp < 55 || outsideTemp < 40) {\n power = 'on'\n} else {\n power = 'off'\n}\n\nif (allowed === 'on') {\n if (power === 'on') {\n node.status({fill:'green',shape:'dot',text:'Heater Needed'})\n node.send(msg,null)\n } else {\n node.status({fill:'red',shape:'ring',text:'Heater Not Needed'})\n node.send(null,msg)\n }\n} else {\n node.status({fill:'red',shape:'ring',text:'Heat Disabled'})\n}\n", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 390, + "y": 800, + "wires": [ + [ + "4b7ed8ad595ee9cb" + ] + ], + "icon": "node-red-contrib-huemagic/hue-temperature.svg" + }, { "id": "091390f43bfeddf5", "type": "api-call-service",