From 944cde7ee70d947c9fc9c88d853feaf6372086f7 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sat, 29 Mar 2025 01:12:17 -0400 Subject: [PATCH] Emma aircon flow and associated supporting nodes --- flows.json | 1323 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1301 insertions(+), 22 deletions(-) diff --git a/flows.json b/flows.json index 94f4e97..fac87de 100644 --- a/flows.json +++ b/flows.json @@ -1448,12 +1448,16 @@ "a09f10883f07aad0", "464e9271285f8450", "9c8056404bfcafed", - "a8d7f5e5d4f549b0" + "a8d7f5e5d4f549b0", + "706c517f3575c162", + "4a507797422a5369", + "a232c2f584013596", + "738e35a2f51ff0e0" ], "x": 34, "y": 579, - "w": 732, - "h": 162 + "w": 792, + "h": 302 }, { "id": "931cc27100c9317e", @@ -1472,7 +1476,7 @@ "f9bc4d36a0df7947" ], "x": 34, - "y": 759, + "y": 899, "w": 672, "h": 222 }, @@ -1582,7 +1586,7 @@ "15f7382daddb4b3e" ], "x": 34, - "y": 999, + "y": 1139, "w": 632, "h": 82 }, @@ -2311,7 +2315,7 @@ "7b2670a81b8d3967" ], "x": 34, - "y": 1099, + "y": 1239, "w": 392, "h": 82 }, @@ -2352,6 +2356,47 @@ "w": 792, "h": 82 }, + { + "id": "5802ea32c1de36e8", + "type": "group", + "z": "72f99805df043603", + "name": "Emma Bedroom", + "style": { + "label": true + }, + "nodes": [ + "e0ccc1c73ecf40cb", + "c0b160cbf7cb26d9", + "2370770ce10c8a17", + "69a01541c0c04367", + "4a4335e390443134", + "be5db4b6e0dc6207", + "a2635913609af931", + "3421222c0667a9ef", + "c9d1ed9d0ea401e6", + "34d7881576b29949", + "1e2abb7eff658e81", + "f5d407ee3f07dee6", + "b4f3d9fd20c0637e", + "ccb3a655b7d6836b", + "7561647f2cdf58d3", + "8c5fb72719e1917d", + "fc5cad0242d957aa", + "33d2a06ed0659a13", + "61f25466213cb85c", + "f6755ee93883b34d", + "7631b8823839f4b1", + "884ffbd2493411f9", + "15b160d6bfe30b15", + "03c668f84022cc23", + "a273dadf7a256af1", + "8bb8dc720af76714" + ], + "x": 14, + "y": 1319, + "w": 1072, + "h": 502 + }, { "id": "fba69dfc80829db7", "type": "junction", @@ -5038,6 +5083,246 @@ "resend": false, "debugEnabled": false }, + { + "id": "47b0f8d963c82cce", + "type": "ha-device-config", + "name": "Emma Bedroom Climate", + "hwVersion": "", + "manufacturer": "Node-RED", + "model": "", + "swVersion": "" + }, + { + "id": "6bbeae1a731c6fa2", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Bedtime Mode", + "version": 6, + "entityType": "button", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Bedtime Mode" + }, + { + "property": "icon", + "value": "mdi:bed" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "a7edd9c339d922b1", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Cooling Schedule", + "version": 6, + "entityType": "switch", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Cooling Schedule" + }, + { + "property": "icon", + "value": "" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "a41edb9d72f72766", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Wakeup", + "version": 6, + "entityType": "switch", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Wakeup Schedule" + }, + { + "property": "icon", + "value": "" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "774a5097399e1169", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Night Mode", + "version": 6, + "entityType": "button", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Night Mode" + }, + { + "property": "icon", + "value": "mdi:lightbulb-night" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "46dadc28a60d6dd8", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Day Mode", + "version": 6, + "entityType": "button", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Day Mode" + }, + { + "property": "icon", + "value": "mdi:sun" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "41b47b5dcb51a9c7", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Climate Reset", + "version": 6, + "entityType": "button", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Climate Reset" + }, + { + "property": "icon", + "value": "mdi:backup-restore" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, + { + "id": "0295918c27c0b70b", + "type": "ha-entity-config", + "server": "9e87348d.9c1c48", + "deviceConfig": "47b0f8d963c82cce", + "name": "Emma Bedroom Fan Only", + "version": 6, + "entityType": "button", + "haConfig": [ + { + "property": "name", + "value": "Emma Bedroom Fan Only" + }, + { + "property": "icon", + "value": "mdi:fan" + }, + { + "property": "entity_picture", + "value": "" + }, + { + "property": "entity_category", + "value": "" + }, + { + "property": "device_class", + "value": "" + } + ], + "resend": false, + "debugEnabled": false + }, { "id": "afead614fabc01bb", "type": "function", @@ -21590,7 +21875,7 @@ "z": "72f99805df043603", "g": "e065b1ed4938b477", "name": "Meltdown Center", - "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst toggle = msg.payload\nconst ac = global.get('mb_aircon_installed', \"diskCon\")\nconst lastMode = flow.get(\"lastMode\", \"diskCon\")\nconst bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\n\nlet setTemp = bedTemp\nlet setEco = 'none'\nlet setHvac = 'cool'\nlet setAcFan = 'High'\nlet setFan = 'turn_off'\n\nlet sendFan = {\n \"payload\": {\n \"action\": `fan.${setFan}`,\n \"target\": {\n \"entity_id\": [\"fan.master_bedroom_fan\"]\n },\n \"data\": {}\n }\n}\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"hvac_mode\": setHvac\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"temperature\": setTemp\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": \"climate.set_preset_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"preset_mode\": setEco\n }\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"fan_mode\": setAcFan\n }\n }\n}\n\nlet reset = {\n \"topic\": \"Reset\"\n}\n\nif (toggle === 'on') {\n node.status({fill:\"red\",shape:\"dot\",text:\"DANGER MODE ACTIVE\"})\n node.send([null,sendFan,null])\n if (ac === 'on') {\n node.send([[sendHvac,sendTemp,sendEco,sendTemp],null,null])\n }\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Danger Mode Off\"})\n node.send([null,null,reset])\n}", + "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst toggle = msg.payload\nconst ac = global.get('mb_aircon_installed', \"diskCon\")\nconst mbrLastMode = flow.get(\"mbrLastMode\", \"diskCon\")\nconst bedTemp = states['input_number.master_bedroom_bedtime_temp'].state\n\nlet setTemp = bedTemp\nlet setEco = 'none'\nlet setHvac = 'cool'\nlet setAcFan = 'High'\nlet setFan = 'turn_off'\n\nlet sendFan = {\n \"payload\": {\n \"action\": `fan.${setFan}`,\n \"target\": {\n \"entity_id\": [\"fan.master_bedroom_fan\"]\n },\n \"data\": {}\n }\n}\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"hvac_mode\": setHvac\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"temperature\": setTemp\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": \"climate.set_preset_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"preset_mode\": setEco\n }\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": [\"climate.master_bedroom_aircon\"]\n },\n \"data\": {\n \"fan_mode\": setAcFan\n }\n }\n}\n\nlet reset = {\n \"topic\": \"Reset\"\n}\n\nif (toggle === 'on') {\n node.status({fill:\"red\",shape:\"dot\",text:\"DANGER MODE ACTIVE\"})\n node.send([null,sendFan,null])\n if (ac === 'on') {\n node.send([[sendHvac,sendTemp,sendEco,sendTemp],null,null])\n }\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Danger Mode Off\"})\n node.send([null,null,reset])\n}", "outputs": 3, "timeout": "", "noerr": 0, @@ -21736,7 +22021,7 @@ "z": "72f99805df043603", "g": "e065b1ed4938b477", "name": "Set Mode", - "func": "const states = global.get(\"homeassistant.homeAssistant.states\")\nconst sleeping = states[\"input_boolean.master_bedroom_sleeping\"].state\nconst earlyNight = states[\"binary_sensor.early_night_mode\"].state\nconst giveMeDarkness = states[\"input_boolean.give_me_darkness\"].state\nconst nightMode = states[\"input_boolean.night_mode\"].state\nconst goodnight = states[\"input_boolean.goodnight\"].state\nconst coolingActive = states['input_boolean.master_bedroom_cooling_on'].state\n\nlet lastMode = []\n\nif (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {\n lastMode = 'bedtime'\n} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {\n lastMode = 'night'\n} else {\n lastMode = 'day'\n}\n\nflow.set(\"lastMode\", lastMode, \"diskCon\")\nnode.status({ fill: \"green\", shape: \"dot\", text: `Last Mode Set: ${lastMode}`})", + "func": "const states = global.get(\"homeassistant.homeAssistant.states\")\nconst sleeping = states[\"input_boolean.master_bedroom_sleeping\"].state\nconst earlyNight = states[\"binary_sensor.early_night_mode\"].state\nconst giveMeDarkness = states[\"input_boolean.give_me_darkness\"].state\nconst nightMode = states[\"input_boolean.night_mode\"].state\nconst goodnight = states[\"input_boolean.goodnight\"].state\nconst coolingActive = states['input_boolean.master_bedroom_cooling_on'].state\n\nlet mbrLastMode = []\n\nif (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {\n mbrLastMode = 'bedtime'\n} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {\n mbrLastMode = 'night'\n} else {\n mbrLastMode = 'day'\n}\n\nflow.set(\"mbrLastMode\", mbrLastMode, \"diskCon\")\nnode.status({ fill: \"green\", shape: \"dot\", text: `Last Mode Set: ${mbrLastMode}`})", "outputs": 0, "timeout": "", "noerr": 0, @@ -21905,7 +22190,7 @@ "z": "72f99805df043603", "g": "e065b1ed4938b477", "name": "Reset", - "func": "const lastMode = flow.get('lastMode', \"diskCon\")\nconst linkSource = msg._linkSource\n\nlet setTime = []\nlet setType = []\nlet setTopic = []\n\nif (lastMode === 'day') {\n setTime = 'day'\n setType = 'manual'\n setTopic = 'manual-day'\n} else if (lastMode === 'night') {\n setTime = 'night'\n setType = 'manual'\n setTopic = 'manual-night'\n} else if (lastMode === 'bedtime') {\n setTime = 'bedtime'\n setType = 'manual'\n setTopic = 'manual-bedtime'\n}\n\nlet reset = {\n \"type\": setType,\n \"time\": setTime,\n \"topic\": setTopic,\n \"_linkSource\": linkSource\n}\n\nnode.send(reset)\nnode.status({ fill: \"green\", shape: \"dot\", text: `Mode reset to ${setTopic}`})", + "func": "const mbrLastMode = flow.get('mbrLastMode', \"diskCon\")\nconst linkSource = msg._linkSource\n\nlet setTime = []\nlet setType = []\nlet setTopic = []\n\nif (mbrLastMode === 'day') {\n setTime = 'day'\n setType = 'manual'\n setTopic = 'manual-day'\n} else if (mbrLastMode === 'night') {\n setTime = 'night'\n setType = 'manual'\n setTopic = 'manual-night'\n} else if (mbrLastMode === 'bedtime') {\n setTime = 'bedtime'\n setType = 'manual'\n setTopic = 'manual-bedtime'\n}\n\nlet reset = {\n \"type\": setType,\n \"time\": setTime,\n \"topic\": setTopic,\n \"_linkSource\": linkSource\n}\n\nnode.send(reset)\nnode.status({ fill: \"green\", shape: \"dot\", text: `Mode reset to ${setTopic}`})", "outputs": 1, "timeout": "", "noerr": 0, @@ -22611,6 +22896,862 @@ [] ] }, + { + "id": "e0ccc1c73ecf40cb", + "type": "server-state-changed", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Meltdown Protocol", + "server": "9e87348d.9c1c48", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_boolean.meltdown_protocol" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "0", + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": true, + "ignorePrevStateUnavailable": true, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "danger", + "propertyType": "flow", + "value": "", + "valueType": "entityState" + } + ], + "x": 170, + "y": 1360, + "wires": [ + [ + "61f25466213cb85c" + ] + ] + }, + { + "id": "c0b160cbf7cb26d9", + "type": "ha-button", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "EB Bedtime Mode", + "version": 0, + "debugenabled": false, + "outputs": 1, + "entityConfig": "6bbeae1a731c6fa2", + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "manual-bedtime", + "valueType": "str" + }, + { + "property": "time", + "propertyType": "msg", + "value": "bedtime", + "valueType": "str" + }, + { + "property": "type", + "propertyType": "msg", + "value": "manual", + "valueType": "str" + } + ], + "x": 170, + "y": 1420, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "2370770ce10c8a17", + "type": "ha-button", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "EB Night Mode", + "version": 0, + "debugenabled": false, + "outputs": 1, + "entityConfig": "774a5097399e1169", + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "type", + "propertyType": "msg", + "value": "manual", + "valueType": "str" + }, + { + "property": "time", + "propertyType": "msg", + "value": "night", + "valueType": "str" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "manual-night", + "valueType": "str" + } + ], + "x": 180, + "y": 1600, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "69a01541c0c04367", + "type": "ha-button", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "EB Day Mode", + "version": 0, + "debugenabled": false, + "outputs": 1, + "entityConfig": "46dadc28a60d6dd8", + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "time", + "propertyType": "msg", + "value": "day", + "valueType": "str" + }, + { + "property": "type", + "propertyType": "msg", + "value": "manual", + "valueType": "str" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "manual-day", + "valueType": "str" + } + ], + "x": 190, + "y": 1660, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "4a4335e390443134", + "type": "server-state-changed", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Sleep Switch", + "server": "9e87348d.9c1c48", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_boolean.emma_sleeping" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "0", + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": true, + "ignorePrevStateUnknown": true, + "ignorePrevStateUnavailable": true, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "type", + "propertyType": "msg", + "value": "sleep", + "valueType": "str" + } + ], + "x": 190, + "y": 1720, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "be5db4b6e0dc6207", + "type": "ha-time", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Emma Bedroom Cooling", + "server": "9e87348d.9c1c48", + "version": 4, + "exposeAsEntityConfig": "a7edd9c339d922b1", + "entityId": "input_datetime.emma_bedroom_cooling", + "property": "", + "offset": "0", + "offsetType": "num", + "offsetUnits": "minutes", + "randomOffset": false, + "repeatDaily": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "time", + "propertyType": "msg", + "value": "night", + "valueType": "str" + }, + { + "property": "type", + "propertyType": "msg", + "value": "auto", + "valueType": "str" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "emmabedroom-cooling", + "valueType": "str" + } + ], + "sunday": true, + "monday": true, + "tuesday": true, + "wednesday": true, + "thursday": true, + "friday": true, + "saturday": true, + "ignorePastDate": false, + "x": 150, + "y": 1480, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "a2635913609af931", + "type": "ha-time", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Emma Bedroom Wakeup", + "server": "9e87348d.9c1c48", + "version": 4, + "exposeAsEntityConfig": "a41edb9d72f72766", + "entityId": "input_datetime.emma_wakeup", + "property": "", + "offset": "0", + "offsetType": "num", + "offsetUnits": "minutes", + "randomOffset": false, + "repeatDaily": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "time", + "propertyType": "msg", + "value": "day", + "valueType": "str" + }, + { + "property": "type", + "propertyType": "msg", + "value": "auto", + "valueType": "str" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "emmabedroom-wakeup", + "valueType": "str" + } + ], + "sunday": true, + "monday": true, + "tuesday": true, + "wednesday": true, + "thursday": true, + "friday": true, + "saturday": true, + "ignorePastDate": false, + "x": 150, + "y": 1540, + "wires": [ + [ + "34d7881576b29949" + ] + ] + }, + { + "id": "3421222c0667a9ef", + "type": "ha-button", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Reset", + "version": 0, + "debugenabled": false, + "outputs": 1, + "entityConfig": "41b47b5dcb51a9c7", + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "reset", + "valueType": "str" + } + ], + "x": 210, + "y": 1780, + "wires": [ + [ + "03c668f84022cc23" + ] + ] + }, + { + "id": "c9d1ed9d0ea401e6", + "type": "ha-button", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "A/C Fan Only", + "version": 0, + "debugenabled": false, + "outputs": 1, + "entityConfig": "0295918c27c0b70b", + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + } + ], + "x": 650, + "y": 1720, + "wires": [ + [ + "a273dadf7a256af1" + ] + ] + }, + { + "id": "34d7881576b29949", + "type": "function", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Processing", + "func": "node.log(\"Emma Bedroom Climate: Processing Started\");\n// pull in the necessary information\n\nconst states = global.get('homeassistant.homeAssistant.states')\nconst allowed = states['input_boolean.emma_bedroom_climate_protocol'].state\nconst ac = global.get('emmaBedroom.aircon.installed', \"diskCon\")\nconst temp = global.get(\"outdoorTemp.tempStr\")\nconst payload = msg.payload\nconst vacation = states['input_boolean.vacation_mode'].state\nconst dayTemp = states['input_number.emma_bedroom_daytime_temp'].state\nconst nightTemp = states['input_number.emma_bedroom_night_temp'].state\nconst bedTemp = states['input_number.emma_bedroom_bedtime_temp'].state\nconst acMode = states['input_select.scheduled_climate_mode_emma_bedroom'].state\nconst sleeping = states['input_boolean.emma_sleeping'].state\nconst hotDay = states['input_boolean.hot_day'].state\nconst heatWarning = states[\"binary_sensor.heat_warning\"].state\nconst earlyNight = states[\"binary_sensor.early_night_mode\"].state\nconst danger = states['binary_sensor.heat_warning'].attributes.danger\nconst meltdown = states['input_boolean.meltdown_protocol'].state\nconst coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state\nnode.log(\"Emma Bedroom Climate: Constants Set\")\n\n// Define some entity IDs\n\nconst emmaBedroomAircon = \"climate.emma_bedroom_aircon\"\n\n// Helper function to convert a string to title case\n\nfunction convertToTitleCase(str) {\n if (!str) {\n return \"\";\n }\n return str.toLowerCase().replace(/\\b\\w/g, (s) => s.toUpperCase());\n}\n\n// init variables\n\nlet setTemp = []\nlet setEco = []\nlet setHvac = []\nlet setCool = []\nlet setSleep = []\nlet setPeople = []\nlet setDisplay = []\nlet time = []\nlet type = msg.type\nlet topic = msg.topic\nlet isWakeup = context.get(\"isWakeup\")\nnode.log(\"Emma Bedroom Climate: Variables Defined\")\n\n// Sleep Switch Handling\nif (type === 'sleep' && payload === 'off') {\n setDisplay = 'turn_on'\n setPeople = 'turn_on'\n if (coolingActive === 'on') {\n time = 'night'\n } else {\n time = 'day'\n }\n} else if (type === 'sleep' && payload === 'on') {\n setDisplay = 'turn_off'\n time = 'bedtime'\n} else {\n time = msg.time\n}\n\nif (topic === 'emmabedroom-wakeup') {\n setSleep = 'turn_off'\n}\n\n// Day Time\nif (time === 'day') {\n if (type === 'auto') {\n setCool = 'turn_off'\n }\n if (earlyNight === 'off') {\n if (ac === 'on') {\n if (danger === 'Extreme') {\n setTemp = nightTemp\n setEco = \"eco\"\n setHvac = \"cool\"\n } else if (hotDay === 'on' || heatWarning === 'on') {\n setTemp = dayTemp\n setEco = \"eco\"\n setHvac = \"cool\"\n } else {\n setTemp = nightTemp\n setEco = \"eco\"\n setHvac = \"off\"\n }\n }\n } else if (earlyNight === 'on') {\n if (ac === 'on') {\n if (danger === 'Extreme') {\n setTemp === bedTemp\n } else {\n setTemp = nightTemp\n }\n if (acMode === 'AC') {\n setHvac = 'cool'\n } else if (acMode === 'fan') {\n setHvac = 'fan_only'\n } else {\n setHvac = 'off'\n }\n if (hotDay === 'on') {\n setEco = 'none'\n } else {\n setEco = 'eco'\n }\n }\n }\n// Night Time\n} else if (time === 'night') {\n // If this is being run at scheduled time, turn on input_boolean.emma_bedroom_cooling_on\n if (type === 'auto') {\n setCool = 'turn_on'\n }\n // Decide temperature\n if (type === 'sleep' && payload === 'off') {\n setTemp = dayTemp\n } else if (danger === 'Extreme') {\n setTemp = bedTemp\n } else {\n setTemp = nightTemp\n }\n // Decide eco mode\n if (sleeping === 'on') {\n setEco = 'none'\n } else {\n setEco = 'eco'\n }\n // Decide HVAC mode\n if (acMode === 'AC') {\n setHvac = 'cool'\n } else if (acMode === 'Fan') {\n setHvac = 'fan_only'\n } else {\n setHvac = 'off'\n }\n// Bed Time\n} else if (time === 'bedtime') {\n setPeople = 'turn_off'\n if (ac === 'on') {\n setTemp = bedTemp\n setEco = 'none'\n if (acMode === 'AC') {\n setHvac = 'cool'\n } else if (acMode === 'Fan') {\n setHvac = \"fan_only\"\n } else {\n setHvac = \"off\"\n }\n }\n}\nnode.log(\"Emma Bedroom Climate: Decision Logic Complete\")\n\n// Define message payloads\n\nlet sendCool = {\n \"payload\": {\n \"action\": `input_boolean.${setCool}`,\n \"target\": {\n \"entity_id\": [\"input_boolean.emma_bedroom_cooling_on\"]\n },\n \"data\": {}\n }\n}\n\nlet sendSleep = {\n \"payload\": {\n \"action\": `input_boolean.${setSleep}`,\n \"target\": {\n \"entity_id\": [\"input_boolean.emma_sleeping\"]\n },\n \"data\": {}\n }\n}\n\nlet sendPeople = {\n \"payload\": {\n \"action\": `input_boolean.${setPeople}`,\n \"target\": {\n \"entity_id\": [\"input_boolean.emma_awake\"]\n },\n \"data\": {}\n }\n}\n\nlet sendDisplay = {\n \"payload\": {\n \"action\": `switch.${setDisplay}`,\n \"target\": {\n \"entity_id\": [\"switch.emma_bedroom_aircon_display\"]\n },\n \"data\": {}\n }\n}\n\nlet notify = {\n \"topic\": topic,\n \"nighttemp\": nightTemp,\n \"acmode\": acMode\n}\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": emmaBedroomAircon\n },\n \"data\": {\n \"hvac_mode\": setHvac\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": emmaBedroomAircon\n },\n \"data\": {\n \"temperature\": setTemp\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": \"climate.set_preset_mode\",\n \"target\": {\n \"entity_id\": emmaBedroomAircon\n },\n \"data\": {\n \"preset_mode\": setEco\n }\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": emmaBedroomAircon\n },\n \"data\": {\n \"fan_mode\": \"auto\"\n }\n }\n}\n\nnode.log(\"Emma Bedroom Climate: Message Payloads Defined\")\n\n// Log the parameters that were chosen, for debugging purposes\n\nnode.log(\"----- Emma Bedroom Climate: Set Parameters -----\")\nnode.log(`setTemp: ${setTemp}`)\nnode.log(`setEco: ${setEco}`)\nnode.log(`setHvac: ${setHvac}`)\nnode.log(`setCool: ${setCool}`)\nnode.log(`setSleep: ${setSleep}`)\nnode.log(`setPeople: ${setPeople}`)\nnode.log(`setDisplay: ${setDisplay}`)\nnode.log(`time: ${time}`)\nnode.log(`type: ${type}`)\nnode.log(`topic: ${topic}`)\nnode.log(\"----- Emma Bedroom Climate: End Parameters -----\")\n\n// If this was an automated trigger, set the cooling context for the bedroom accordingly.\n\nif (type === 'auto' && time != 'bedtime') {\n node.send([null, sendCool, null])\n node.log(\"Emma Bedroom Climate: Cooling Context Set\")\n}\n\nif (type === 'auto' && allowed === 'on' && meltdown === 'off' && vacation === 'off') {\n node.log(\"Emma Bedroom Climate: Auto\")\n if (sleeping === 'on' && topic != 'emmabedroom-wakeup') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Blocked (sleep mode)\" })\n node.log(\"Emma Bedroom Climate: Blocked (sleep mode)\")\n } else {\n if (topic === 'emmabedroom-cooling' && ac === 'on') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Cooling Schedule\" })\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Auto/Cooling\")\n } else if (topic === 'emmabedroom-bedtime') {\n node.send([null, sendPeople, null])\n node.status({ fill: \"green\", shape: \"dot\", text: \"Bedtime\" })\n node.log(\"Emma Bedroom Climate: Auto/Bedtime\")\n if (ac === 'on') {\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Auto/Bedtime/AC\")\n }\n } else if (topic === 'emmabedroom-wakeup') {\n node.status({ fill: \"green\", shape: \"dot\", text: \"Wakeup Schedule\" })\n node.log(\"Emma Bedroom Climate: Auto/Wakeup\")\n if (sleeping === 'off') {\n context.set(\"isWakeup\", false)\n node.log(\"Emma Bedroom Climate: Auto/Wakeup/Sleep Off\")\n if (ac === 'on') {\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Auto/Wakeup/AC On\")\n }\n } else if (sleeping === 'on') {\n context.set(\"isWakeup\", true)\n node.send([null, sendSleep, null])\n node.log(\"Emma Bedroom Climate: Auto/Wakeup/Sleep On\")\n }\n }\n }\n// Manual Responses\n} else if (type === 'manual') {\n node.log(\"Emma Bedroom Climate: Manual\")\n if (time === 'night') {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Manual Night\" })\n node.log(\"Emma Bedroom Climate: Manual/Night\")\n if (ac === 'on') {\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Manual/Night/AC\")\n }\n } else if (time === 'day') {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Manual Day\" })\n node.log(\"Emma Bedroom Climate: Manual/Day\")\n if (ac === 'on') {\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Manual/Day/AC\")\n }\n } else if (time === 'bedtime') {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Manual Bedtime\" })\n node.log(\"Emma Bedroom Climate: Manual/Bedtime\")\n if (ac === 'on') {\n node.send([[sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Manual/Bedtime/AC\")\n }\n }\n context.set(\"isWakeup\", false)\n// Sleep Switch Responses\n} else if (type === 'sleep') {\n if (payload === 'off') {\n node.send([null, sendPeople, null])\n }\n node.log(\"Emma Bedroom Climate: Sleep\")\n if (time === 'bedtime') {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Sleep\" })\n node.send([null, sendPeople, null])\n node.log(\"Emma Bedroom Climate: Sleep/Bedtime\")\n if (ac === 'on') {\n node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(\"Emma Bedroom Climate: Sleep/Bedtime/AC\")\n }\n } else {\n node.status({ fill: \"blue\", shape: \"dot\", text: \"Wakeup\" })\n node.log(\"Emma Bedroom Climate: Sleep/Day\")\n if (ac === 'on') {\n node.send([[sendDisplay, sendHvac, sendTemp, sendEco, sendAcFan], null, null])\n node.log(`Emma Bedroom Climate: Sleep/${convertToTitleCase(time)}/AC`)\n }\n }\n context.set(\"isWakeup\", false)\n} else if (meltdown === 'on') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Blocked (Meltdown Protocol)\" })\n node.log(\"Emma Bedroom Climate: Blocked (Meltdown Protocol)\")\n} else if (vacation === 'on') {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Blocked (Vacation Mode)\" })\n node.log(\"Emma Bedroom Climate: Blocked (Vacation Mode)\")\n} else {\n node.status({ fill: \"red\", shape: \"ring\", text: \"Blocked (Automation Disabled)\" })\n node.log(\"Emma Bedroom Climate: Blocked (Automation Disabled)\")\n}\n\nnode.log(\"Emma Bedroom Climate: Processing Complete\")\n", + "outputs": 3, + "timeout": "", + "noerr": 0, + "initialize": "context.set(\"isWakeup\", false)", + "finalize": "", + "libs": [], + "x": 470, + "y": 1540, + "wires": [ + [ + "1e2abb7eff658e81" + ], + [ + "f5d407ee3f07dee6" + ], + [ + "b4f3d9fd20c0637e" + ] + ], + "outputLabels": [ + "A/C", + "Boolean", + "Notify" + ], + "icon": "node-red-contrib-cpu/cpu.png" + }, + { + "id": "1e2abb7eff658e81", + "type": "api-call-service", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "AC Settings", + "server": "9e87348d.9c1c48", + "version": 7, + "debugenabled": false, + "action": "", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "", + "service": "", + "x": 650, + "y": 1480, + "wires": [ + [] + ] + }, + { + "id": "f5d407ee3f07dee6", + "type": "api-call-service", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Bool Settings", + "server": "9e87348d.9c1c48", + "version": 7, + "debugenabled": false, + "action": "", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "", + "service": "", + "x": 650, + "y": 1540, + "wires": [ + [] + ] + }, + { + "id": "b4f3d9fd20c0637e", + "type": "function", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Notifications", + "func": "const topic = msg.topic\nconst nightTemp = msg.nighttemp\nconst acMode = msg.acmode\n\nlet coolMsg = {\n \"payload\": `Emma bedroom AC temp has been set to ${nightTemp} °F as scheduled`,\n \"topic\": 'Emma AC Mode: Cooling'\n}\nlet fanOnlyMsg = {\n \"payload\": 'Mildly chilly outside, AC running fan only.',\n \"topic\": \"Emma AC Mode: Fan Only\"\n}\n\nif (topic === 'emmabedroom-cooling') {\n if (acMode === 'AC') {\n node.status({fill:\"green\",shape:\"dot\",text:\"AC Cooling\"})\n return coolMsg\n } else if (acMode === 'Fan') {\n node.status({fill:\"green\",shape:\"dot\",text:\"AC Fan Only\"})\n return fanOnlyMsg\n }\n} else {\n node.status({fill:\"red\",shape:\"ring\",text:\"Notification not sent\"})\n return null\n}", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 650, + "y": 1600, + "wires": [ + [ + "ccb3a655b7d6836b" + ] + ] + }, + { + "id": "ccb3a655b7d6836b", + "type": "api-call-service", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "iOS Notifications", + "server": "9e87348d.9c1c48", + "version": 7, + "debugenabled": false, + "action": "script.text_notify", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [], + "labelId": [], + "data": "{\t \"who\":\"parents\",\t \"title\": topic,\t \"message\": payload,\t \"type\": \"normal\",\t \"tag\": \"emma-bedroom-climate\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "script", + "service": "text_notify", + "x": 840, + "y": 1600, + "wires": [ + [] + ] + }, + { + "id": "7561647f2cdf58d3", + "type": "function", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Set Mode", + "func": "const states = global.get(\"homeassistant.homeAssistant.states\")\nconst sleeping = states[\"input_boolean.emma_sleeping\"].state\nconst earlyNight = states[\"binary_sensor.early_night_mode\"].state\nconst giveMeDarkness = states[\"input_boolean.give_me_darkness\"].state\nconst nightMode = states[\"input_boolean.night_mode\"].state\nconst goodnight = states[\"input_boolean.goodnight\"].state\nconst coolingActive = states['input_boolean.emma_bedroom_cooling_on'].state\n\nlet lastMode = []\n\nif (sleeping === 'on' || nightMode === 'on' || goodnight === 'on') {\n lastMode = 'bedtime'\n} else if (earlyNight === 'on' || giveMeDarkness === 'on' || coolingActive === 'on') {\n lastMode = 'night'\n} else {\n lastMode = 'day'\n}\n\nflow.set(\"emmaBedroom.lastMode\", lastMode, \"diskCon\")\nnode.status({ fill: \"green\", shape: \"dot\", text: `Last Mode Set: ${lastMode}`})", + "outputs": 0, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1000, + "y": 1420, + "wires": [] + }, + { + "id": "8c5fb72719e1917d", + "type": "inject", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "", + "props": [ + { + "p": "payload" + } + ], + "repeat": "300", + "crontab": "", + "once": true, + "onceDelay": "60", + "topic": "", + "payload": "", + "payloadType": "date", + "x": 885, + "y": 1360, + "wires": [ + [ + "7561647f2cdf58d3" + ] + ], + "l": false + }, + { + "id": "fc5cad0242d957aa", + "type": "complete", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "", + "scope": [ + "34d7881576b29949", + "4a4335e390443134", + "e0ccc1c73ecf40cb" + ], + "uncaught": false, + "x": 830, + "y": 1480, + "wires": [ + [ + "7561647f2cdf58d3" + ] + ] + }, + { + "id": "33d2a06ed0659a13", + "type": "server-state-changed", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Monitor Entities", + "server": "9e87348d.9c1c48", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_boolean.give_me_darkness", + "binary_sensor.early_night_mode", + "input_boolean.night_mode", + "input_boolean.goodnight", + "input_boolean.emma_sleeping", + "input_boolean.emma_bedroom_cooling_on" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "0", + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + } + ], + "x": 820, + "y": 1420, + "wires": [ + [ + "7561647f2cdf58d3" + ] + ] + }, + { + "id": "61f25466213cb85c", + "type": "function", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Meltdown Center", + "func": "const states = global.get('homeassistant.homeAssistant.states')\nconst toggle = msg.payload\nconst ac = global.get('emmaBedroom.aircon.installed', \"diskCon\")\nconst lastMode = flow.get(\"emmaBedroom.lastMode\", \"diskCon\")\nconst bedTemp = states['input_number.emma_bedroom_bedtime_temp'].state\n\nlet setTemp = bedTemp\nlet setEco = 'none'\nlet setHvac = 'cool'\nlet setAcFan = 'High'\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": [\"climate.emma_bedroom_aircon\"]\n },\n \"data\": {\n \"hvac_mode\": setHvac\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": [\"climate.emma_bedroom_aircon\"]\n },\n \"data\": {\n \"temperature\": setTemp\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": \"climate.set_preset_mode\",\n \"target\": {\n \"entity_id\": [\"climate.emma_bedroom_aircon\"]\n },\n \"data\": {\n \"preset_mode\": setEco\n }\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": [\"climate.emma_bedroom_aircon\"]\n },\n \"data\": {\n \"fan_mode\": setAcFan\n }\n }\n}\n\nlet reset = {\n \"topic\": \"Reset\"\n}\n\nif (toggle === 'on') {\n node.status({fill:\"red\",shape:\"dot\",text:\"DANGER MODE ACTIVE\"})\n if (ac === 'on') {\n node.send([[sendHvac,sendTemp,sendEco,sendTemp],null])\n }\n} else {\n node.status({fill:\"green\",shape:\"dot\",text:\"Danger Mode Off\"})\n node.send([null,reset])\n}", + "outputs": 2, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 410, + "y": 1360, + "wires": [ + [ + "1e2abb7eff658e81" + ], + [ + "15b160d6bfe30b15" + ] + ], + "outputLabels": [ + "On (AC)", + "Off" + ], + "icon": "node-red-contrib-huemagic/hue-temperature.svg" + }, + { + "id": "f6755ee93883b34d", + "type": "function", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Reset", + "func": "const lastMode = flow.get(\"emmaBedroom.lastMode\", \"diskCon\")\nconst linkSource = msg._linkSource\n\nlet setTime = []\nlet setType = []\nlet setTopic = []\n\nif (lastMode === 'day') {\n setTime = 'day'\n setType = 'manual'\n setTopic = 'manual-day'\n} else if (lastMode === 'night') {\n setTime = 'night'\n setType = 'manual'\n setTopic = 'manual-night'\n} else if (lastMode === 'bedtime') {\n setTime = 'bedtime'\n setType = 'manual'\n setTopic = 'manual-bedtime'\n}\n\nlet reset = {\n \"type\": setType,\n \"time\": setTime,\n \"topic\": setTopic,\n \"_linkSource\": linkSource\n}\n\nnode.status({ fill: \"green\", shape: \"dot\", text: `Mode reset to ${setTopic}`})\nreturn(reset)", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 665, + "y": 1660, + "wires": [ + [ + "884ffbd2493411f9" + ] + ], + "l": false + }, + { + "id": "7631b8823839f4b1", + "type": "link in", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "EB Climate Reset - In", + "links": [], + "x": 595, + "y": 1660, + "wires": [ + [ + "f6755ee93883b34d" + ] + ] + }, + { + "id": "884ffbd2493411f9", + "type": "link out", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "EB Climate Reset - Out", + "mode": "return", + "links": [], + "x": 735, + "y": 1660, + "wires": [] + }, + { + "id": "15b160d6bfe30b15", + "type": "link call", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "", + "links": [ + "7631b8823839f4b1" + ], + "linkType": "static", + "timeout": "30", + "x": 335, + "y": 1420, + "wires": [ + [ + "34d7881576b29949" + ] + ], + "l": false + }, + { + "id": "03c668f84022cc23", + "type": "link call", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Reset", + "links": [ + "7631b8823839f4b1" + ], + "linkType": "static", + "timeout": "30", + "x": 315, + "y": 1780, + "wires": [ + [ + "34d7881576b29949" + ] + ], + "l": false + }, + { + "id": "a273dadf7a256af1", + "type": "api-call-service", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Set to Fan", + "server": "9e87348d.9c1c48", + "version": 7, + "debugenabled": false, + "action": "climate.set_hvac_mode", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "climate.emma_bedroom_aircon" + ], + "labelId": [], + "data": "{\t \"hvac_mode\":\"fan_only\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "climate", + "service": "set_hvac_mode", + "x": 830, + "y": 1720, + "wires": [ + [ + "8bb8dc720af76714" + ] + ] + }, + { + "id": "8bb8dc720af76714", + "type": "api-call-service", + "z": "72f99805df043603", + "g": "5802ea32c1de36e8", + "name": "Eco Off", + "server": "9e87348d.9c1c48", + "version": 7, + "debugenabled": false, + "action": "climate.set_preset_mode", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "climate.emma_bedroom_aircon" + ], + "labelId": [], + "data": "{\t \"preset_mode\":\"none\"\t}", + "dataType": "jsonata", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "climate", + "service": "set_preset_mode", + "x": 1000, + "y": 1720, + "wires": [ + [] + ] + }, { "id": "48b8af9419ed18d6", "type": "subflow:384eaf2f63dcb5db", @@ -33396,7 +34537,7 @@ "account": "be975ce229701797", "event": "ws-device-activity", "x": 150, - "y": 860, + "y": 1000, "wires": [ [ "266634bf3c6019c8", @@ -33418,7 +34559,7 @@ "finalize": "", "libs": [], "x": 380, - "y": 860, + "y": 1000, "wires": [ [ "4560584de593b5c1" @@ -33451,7 +34592,7 @@ "inputOverride": "allow", "outputProperties": [], "x": 610, - "y": 800, + "y": 940, "wires": [ [] ] @@ -33470,7 +34611,7 @@ "inputOverride": "allow", "outputProperties": [], "x": 610, - "y": 860, + "y": 1000, "wires": [ [] ] @@ -33489,7 +34630,7 @@ "inputOverride": "allow", "outputProperties": [], "x": 620, - "y": 920, + "y": 1060, "wires": [ [] ] @@ -33509,7 +34650,7 @@ "statusVal": "", "statusType": "auto", "x": 360, - "y": 940, + "y": 1080, "wires": [] }, { @@ -33910,7 +35051,7 @@ "payload": "", "payloadType": "date", "x": 150, - "y": 1040, + "y": 1180, "wires": [ [ "274be2385ae894ce" @@ -33931,7 +35072,7 @@ "finalize": "", "libs": [], "x": 540, - "y": 1040, + "y": 1180, "wires": [] }, { @@ -33945,7 +35086,7 @@ "initialize": "", "finalize": "", "libs": [], - "x": 1040, + "x": 1120, "y": 620, "wires": [] }, @@ -33966,7 +35107,7 @@ "topic": "", "payload": "", "payloadType": "date", - "x": 880, + "x": 960, "y": 620, "wires": [ [ @@ -33993,7 +35134,7 @@ "onceDelay": "30", "topic": "", "x": 130, - "y": 1140, + "y": 1280, "wires": [ [ "7b2670a81b8d3967" @@ -34014,7 +35155,7 @@ "finalize": "", "libs": [], "x": 330, - "y": 1140, + "y": 1280, "wires": [], "icon": "font-awesome/fa-user" }, @@ -34032,13 +35173,151 @@ "templateLocation": "", "templateLocationType": "none", "x": 320, - "y": 1040, + "y": 1180, "wires": [ [ "15f7382daddb4b3e" ] ] }, + { + "id": "706c517f3575c162", + "type": "server-state-changed", + "z": "3e4ba157b540d183", + "g": "265593f442864b6a", + "name": "Emma Aircon Installed", + "server": "9e87348d.9c1c48", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_boolean.emma_bedroom_aircon_installed" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "0", + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + } + ], + "x": 180, + "y": 760, + "wires": [ + [ + "738e35a2f51ff0e0" + ] + ] + }, + { + "id": "4a507797422a5369", + "type": "api-current-state", + "z": "3e4ba157b540d183", + "g": "265593f442864b6a", + "name": "Emma Aircon Installed", + "server": "9e87348d.9c1c48", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_boolean.emma_bedroom_aircon_installed", + "state_type": "str", + "blockInputOverrides": false, + "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": 360, + "y": 840, + "wires": [ + [ + "738e35a2f51ff0e0" + ] + ] + }, + { + "id": "a232c2f584013596", + "type": "inject", + "z": "3e4ba157b540d183", + "g": "265593f442864b6a", + "name": "", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": "120", + "topic": "", + "payload": "", + "payloadType": "date", + "x": 150, + "y": 840, + "wires": [ + [ + "4a507797422a5369" + ] + ] + }, + { + "id": "738e35a2f51ff0e0", + "type": "change", + "z": "3e4ba157b540d183", + "g": "265593f442864b6a", + "name": "", + "rules": [ + { + "t": "set", + "p": "#:(diskCon)::emmaBedroom.aircon.installed", + "pt": "global", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 640, + "y": 760, + "wires": [ + [] + ] + }, { "id": "e038489eca14b1dd", "type": "discordMessage",