Properly enforce K's overnight mode for fan scheduling

This commit is contained in:
2023-05-08 16:31:34 -04:00
parent 30d1809354
commit 56f6bf33f3

View File

@@ -765,7 +765,9 @@
"a417e93366843249" "a417e93366843249"
], ],
"x": 14, "x": 14,
"y": 719 "y": 719,
"w": 1432,
"h": 582
}, },
{ {
"id": "e065b1ed4938b477", "id": "e065b1ed4938b477",
@@ -832,7 +834,9 @@
"1967e5238d3aa5a1" "1967e5238d3aa5a1"
], ],
"x": 14, "x": 14,
"y": 19 "y": 19,
"w": 2112,
"h": 682
}, },
{ {
"id": "5c50443a84910fb7", "id": "5c50443a84910fb7",
@@ -946,9 +950,7 @@
"febc179b34c8cf71" "febc179b34c8cf71"
], ],
"x": 34, "x": 34,
"y": 39, "y": 39
"w": 692,
"h": 682
}, },
{ {
"id": "46275dd0f9461013", "id": "46275dd0f9461013",
@@ -966,9 +968,7 @@
"ca88f85ba00a6744" "ca88f85ba00a6744"
], ],
"x": 34, "x": 34,
"y": 739, "y": 739
"w": 472,
"h": 202
}, },
{ {
"id": "ff6d8150e8d5e606", "id": "ff6d8150e8d5e606",
@@ -1347,9 +1347,7 @@
"51d05298561cfddb" "51d05298561cfddb"
], ],
"x": 754, "x": 754,
"y": 39, "y": 39
"w": 672,
"h": 262
}, },
{ {
"id": "b708cb6d93f40dee", "id": "b708cb6d93f40dee",
@@ -1423,9 +1421,7 @@
"5ba9cfc0194ef62a" "5ba9cfc0194ef62a"
], ],
"x": 754, "x": 754,
"y": 319, "y": 319
"w": 672,
"h": 622
}, },
{ {
"id": "fba69dfc80829db7", "id": "fba69dfc80829db7",
@@ -18217,7 +18213,7 @@
"y": 1000, "y": 1000,
"wires": [ "wires": [
[ [
"4341325f7ca23f24" "61405a43f61f3d60"
] ]
] ]
}, },
@@ -18252,8 +18248,8 @@
"override_payload": "msg", "override_payload": "msg",
"entity_location": "data", "entity_location": "data",
"override_data": "msg", "override_data": "msg",
"x": 255, "x": 695,
"y": 1000, "y": 1020,
"wires": [ "wires": [
[ [
"1c98de289e42377f" "1c98de289e42377f"
@@ -18284,8 +18280,8 @@
"mustacheAltTags": false, "mustacheAltTags": false,
"outputProperties": [], "outputProperties": [],
"queue": "none", "queue": "none",
"x": 360, "x": 830,
"y": 1000, "y": 1020,
"wires": [ "wires": [
[] []
] ]
@@ -18565,8 +18561,8 @@
"z": "72f99805df043603", "z": "72f99805df043603",
"g": "39a7ac02f2727f1d", "g": "39a7ac02f2727f1d",
"name": "Processing", "name": "Processing",
"func": "var states = global.get('homeassistant.homeAssistant.states')\nvar vacationMode = states['input_boolean.vacation_mode'].state\nvar overnight = states['input_boolean.kallen_overnight'].state\nvar kallenLoc = states['person.kallen_stork'].state\nvar nightVolume = states['input_number.kallen_bedroom_google_speaker_night_volume'].state\nvar brightness = states['switch.adaptive_lighting_kallen_bedroom'].attributes.brightness_pct\nvar fadeDay = states['input_number.wakeup_lights_fade_day'].state\nvar fadeNight = states['input_number.wakeup_lights_fade_night'].state\nvar toggle = msg.toggle\n\nif (vacationMode === 'off' && overnight === 'off' && kallenLoc === 'home') {\n if (toggle === 'off') {\n msg.brightness = brightness\n msg.fade_day = fadeDay * 60\n msg.fade_night = fadeNight * 60\n node.status({fill:\"green\",shape:\"dot\",text:\"Wakeup\"});\n return[null,msg,null]\n } else if (toggle === 'on') {\n msg.volume = nightVolume\n node.status({fill:\"green\",shape:\"dot\",text:\"Sleep\"});\n return[null,null,msg]\n }\n} else {\n msg.toggle = 'off'\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return [msg,null,null]\n}", "func": "var states = global.get('homeassistant.homeAssistant.states')\nvar vacationMode = states['input_boolean.vacation_mode'].state\nvar overnight = states['input_boolean.kallen_overnight'].state\nvar kallenLoc = states['person.kallen_stork'].state\nvar nightVolume = states['input_number.kallen_bedroom_google_speaker_night_volume'].state\nvar brightness = states['switch.adaptive_lighting_kallen_bedroom'].attributes.brightness_pct\nvar fadeDay = states['input_number.wakeup_lights_fade_day'].state\nvar fadeNight = states['input_number.wakeup_lights_fade_night'].state\nvar topic = msg.topic\nvar toggle = msg.toggle\n\nif (vacationMode === 'off' && overnight === 'off' && kallenLoc === 'home') {\n if (topic === 'kallen-fan') {\n node.status({fill:\"green\",shape:\"dot\",text:\"Fan\"});\n return[null,null,null,msg]\n } else if (toggle === 'off') {\n msg.brightness = brightness\n msg.fade_day = fadeDay * 60\n msg.fade_night = fadeNight * 60\n node.status({fill:\"green\",shape:\"dot\",text:\"Wakeup\"});\n return[null,msg,null,null]\n } else if (toggle === 'on') {\n msg.volume = nightVolume\n node.status({fill:\"green\",shape:\"dot\",text:\"Sleep\"});\n return[null,null,msg,null]\n }\n} else {\n if (topic === 'boolean') {\n msg.toggle = 'off'\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return [msg,null,null,null]\n } else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Blocked\"});\n return null\n }\n}",
"outputs": 3, "outputs": 4,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
@@ -18583,12 +18579,16 @@
], ],
[ [
"274d63b8df8f2dd0" "274d63b8df8f2dd0"
],
[
"4341325f7ca23f24"
] ]
], ],
"outputLabels": [ "outputLabels": [
"blocked", "blocked",
"wake", "wake",
"sleep" "sleep",
"fan"
] ]
}, },
{ {