Fix master bedroom A/C getting turned off on hot days

This commit is contained in:
2023-07-03 17:31:28 -04:00
parent 09eaa68bc7
commit 7d83dae7ae

View File

@@ -771,7 +771,9 @@
"f1dbb3a206dba921" "f1dbb3a206dba921"
], ],
"x": 14, "x": 14,
"y": 719 "y": 719,
"w": 1552,
"h": 642
}, },
{ {
"id": "e065b1ed4938b477", "id": "e065b1ed4938b477",
@@ -845,7 +847,9 @@
"64ad1f28cd8d243f" "64ad1f28cd8d243f"
], ],
"x": 14, "x": 14,
"y": 19 "y": 19,
"w": 2252,
"h": 682
}, },
{ {
"id": "5c50443a84910fb7", "id": "5c50443a84910fb7",
@@ -905,9 +909,7 @@
"f4bfbaca4d7fb1df" "f4bfbaca4d7fb1df"
], ],
"x": 14, "x": 14,
"y": 39, "y": 39
"w": 792,
"h": 142
}, },
{ {
"id": "50e4d951ee7b3e54", "id": "50e4d951ee7b3e54",
@@ -927,9 +929,7 @@
"603140fef1e2edaf" "603140fef1e2edaf"
], ],
"x": 14, "x": 14,
"y": 199, "y": 199
"w": 712,
"h": 142
}, },
{ {
"id": "fbbe69a14cbe0236", "id": "fbbe69a14cbe0236",
@@ -1022,7 +1022,9 @@
"7cb8056b3b41a9e8" "7cb8056b3b41a9e8"
], ],
"x": 34, "x": 34,
"y": 779 "y": 779,
"w": 1012,
"h": 442
}, },
{ {
"id": "f55a52c40b8b8749", "id": "f55a52c40b8b8749",
@@ -1067,7 +1069,9 @@
"318bee4424125dd5" "318bee4424125dd5"
], ],
"x": 34, "x": 34,
"y": 19 "y": 19,
"w": 832,
"h": 742
}, },
{ {
"id": "208284848b13b85b", "id": "208284848b13b85b",
@@ -1149,9 +1153,7 @@
"f44427c5a493c428" "f44427c5a493c428"
], ],
"x": 14, "x": 14,
"y": 359, "y": 359
"w": 1012,
"h": 222
}, },
{ {
"id": "eeafd13be593ae69", "id": "eeafd13be593ae69",
@@ -1185,7 +1187,9 @@
"f5fb96bf1a33b3cd" "f5fb96bf1a33b3cd"
], ],
"x": 54, "x": 54,
"y": 19 "y": 19,
"w": 1492,
"h": 282
}, },
{ {
"id": "0c81dfaed25d225c", "id": "0c81dfaed25d225c",
@@ -18926,7 +18930,7 @@
"z": "72f99805df043603", "z": "72f99805df043603",
"g": "e065b1ed4938b477", "g": "e065b1ed4938b477",
"name": "Hot Day?", "name": "Hot Day?",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar highTemp = states['sensor.today_corrected_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\n\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\n\nif (ac === 'on') {\n if (highTemp > dayThreshold) {\n node.status({fill:\"green\",shape:\"dot\",text:\"Hot Day\"});\n return[msg,null,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Normal\"});\n return[null,msg,msg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No A/C\"});\n return[null,null,msg]\n}", "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar ac = global.get('mb_aircon_installed')\nvar highTemp = states['sensor.today_corrected_high_temp'].state\nvar dayThreshold = states['input_number.master_bedroom_daytime_threshold'].state\nvar dayTemp = states['input_number.master_bedroom_daytime_temp'].state\nvar nightTemp = states['input_number.master_bedroom_night_temp'].state\nvar hotDay = states['input_boolean.hot_day'].state\n\nmsg.daytemp = dayTemp\nmsg.nighttemp = nightTemp\n\nif (ac === 'on') {\n if (highTemp > dayThreshold || hotDay === 'on') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Hot Day\"});\n return[msg,null,msg]\n } else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Normal\"});\n return[null,msg,msg]\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"No A/C\"});\n return[null,null,msg]\n}",
"outputs": 3, "outputs": 3,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",