Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
436f0fb1fa
|
|||
|
d1b5de7eb6
|
|||
|
522a3017e7
|
|||
|
5ab2e85844
|
|||
|
6991cfa35a
|
91
flows.json
91
flows.json
@@ -1745,7 +1745,8 @@
|
||||
"8a84615173fd7e97",
|
||||
"f260e2410571356a",
|
||||
"b497fe229c8f2eea",
|
||||
"f47a0d107875d550"
|
||||
"f47a0d107875d550",
|
||||
"f34011787b8474ef"
|
||||
],
|
||||
"x": 34,
|
||||
"y": 139,
|
||||
@@ -2862,12 +2863,13 @@
|
||||
"de09ef54cbab864a",
|
||||
"5c919106ebd7c9d4",
|
||||
"75072695f27adae7",
|
||||
"12e0c7c54a58f849"
|
||||
"12e0c7c54a58f849",
|
||||
"23e419f1270da94b"
|
||||
],
|
||||
"x": 54,
|
||||
"y": 239,
|
||||
"w": 1092,
|
||||
"h": 382
|
||||
"h": 442
|
||||
},
|
||||
{
|
||||
"id": "7d1c0a1099be4427",
|
||||
@@ -3016,10 +3018,12 @@
|
||||
"id": "9e87348d.9c1c48",
|
||||
"type": "server",
|
||||
"name": "Home Assistant",
|
||||
"version": 5,
|
||||
"version": 6,
|
||||
"addon": true,
|
||||
"rejectUnauthorizedCerts": true,
|
||||
"ha_boolean": "",
|
||||
"ha_boolean": [
|
||||
""
|
||||
],
|
||||
"connectionDelay": false,
|
||||
"cacheJson": false,
|
||||
"heartbeat": false,
|
||||
@@ -24928,7 +24932,7 @@
|
||||
"z": "72f99805df043603",
|
||||
"g": "5802ea32c1de36e8",
|
||||
"name": "Watchdog",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\nconst sleeping = states['input_boolean.emma_sleeping'].state\n\nif (sleeping !== 'on') {\n node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})\n return null\n}\n\nconst airconEntity = ['climate.emma_bedroom_aircon']\n\n// Gather relevant attributes from the aircon entity\n\nconst airconState = msg.payload.state\nconst airconAttributes = msg.payload.attributes\nconst airconEco = airconAttributes['eco_mode']\nconst airconTargetTemp = airconAttributes['temperature']\nconst airconFanMode = airconAttributes['fan_mode']\nconst airconDisplay = airconAttributes['screen_display']\n\n// Gather the last explicitly sent configuration from the context\n\nconst airconHvacCfg = flow.get('emmaBedroom.airconHvacMode', 'diskCon')\nconst airconEcoCfg = flow.get('emmaBedroom.airconEco', 'diskCon')\nconst airconTargetTempCfg = parseFloat(flow.get('emmaBedroom.airconTargetTemp', 'diskCon'))\nconst airconFanModeCfg = flow.get('emmaBedroom.airconFanMode', 'diskCon')\nconst airconDisplayCfg = flow.get('emmaBedroom.airconDisplay', 'diskCon')\n\n// Compare the current state with the last sent configuration\n\nlet ecoMatch = {}\nlet displayMatch = {}\nlet counter = 0\n\nlet sendDisplay = {\n \"payload\": {\n \"action\": `switch.${airconDisplayCfg}`,\n \"target\": {\n \"entity_id\": [\"switch.emma_bedroom_aircon_display\"]\n },\n \"data\": {}\n }\n}\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"hvac_mode\": airconHvacCfg\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"temperature\": airconTargetTempCfg\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": `switch.${airconEcoCfg}`,\n \"target\": {\n \"entity_id\": [\"switch.emma_bedroom_aircon_eco_mode\"]\n },\n \"data\": {}\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"fan_mode\": airconFanModeCfg\n }\n }\n}\n\n// Fix hvac mode if mismatch\n\nif (airconState != airconHvacCfg) {\n node.log(`Emma Bedroom Aircon HVAC mode mismatch: ${airconState} vs ${airconHvacCfg}`)\n node.send(sendHvac)\n counter += 1\n}\n\n// Fix eco mode if mismatch\n\nif (airconEco === false && airconEcoCfg === 'turn_off') {\n ecoMatch = true\n} else if (airconEco === true && airconEcoCfg === 'turn_on') {\n ecoMatch = true\n} else {\n ecoMatch = false\n}\n\nif (ecoMatch === false) {\n node.log(`Emma Bedroom Aircon Eco mode mismatch: ${airconEco} vs ${airconEcoCfg}`)\n node.send(sendEco)\n counter += 1\n}\n\n// Fix target temperature if mismatch\n\nif (airconTargetTemp != airconTargetTempCfg) {\n node.log(`Target temperature mismatch: ${airconTargetTemp} vs ${airconTargetTempCfg}`)\n node.send(sendTemp)\n counter += 1\n}\n\n// Fix fan mode if mismatch\n\nif (airconFanMode != airconFanModeCfg) {\n node.log(`Fan mode mismatch: ${airconFanMode} vs ${airconFanModeCfg}`)\n node.send(sendAcFan)\n counter += 1\n}\n\n// Fix display mode if mismatch\n\nif (airconDisplay === false && airconDisplayCfg === 'turn_off') {\n displayMatch = true\n} else if (airconDisplay === true && airconDisplayCfg === 'turn_on') {\n displayMatch = true\n} else {\n displayMatch = false\n}\n\nif (displayMatch === false) {\n node.log(`Emma Bedroom Aircon Display mode mismatch: ${airconDisplay} vs ${airconDisplayCfg}`)\n node.send(sendDisplay)\n counter += 1\n}\n\nif (counter > 0) {\n node.log(`Emma Bedroom Aircon: ${counter} configuration(s) fixed`)\n node.status({fill:'yellow',shape:'dot',text:`${counter} config(s) fixed`})\n} else {\n node.status({fill:'green',shape:'dot',text:`No config changes`})\n}",
|
||||
"func": "const states = global.get('homeassistant.homeAssistant.states')\n\n// Check if all settings support aircon usage\n\nconst ac = global.get('emmaBedroom.aircon.installed', \"diskCon\")\nconst allowed = states['input_boolean.emma_bedroom_climate_protocol'].state\nconst schedMode = states['input_select.scheduled_climate_mode_emma_bedroom'].state\nconst coolingActive = states[\"input_boolean.emma_bedroom_cooling_on\"].state\nconst sleeping = states[\"input_boolean.emma_sleeping\"].state\n\nlet proceed = false\n\nif (ac === 'on' && allowed === 'on' && schedMode === 'AC' && coolingActive === 'on') {\n proceed = true\n}\n\nif (sleeping != 'on') {\n node.status({fill:'red',shape:'ring',text:'Emma not sleeping, watchdog disabled'})\n return null\n} else if (proceed === false) {\n node.status({fill:'red',shape:'ring',text:'Aircon not in use, watchdog disabled'})\n return null\n}\n\n// Gather relevant attributes from the aircon entity\n\nconst airconEntity = ['climate.emma_bedroom_aircon']\nconst airconState = msg.payload.state\nconst airconAttributes = msg.payload.attributes\nconst airconEco = airconAttributes['eco_mode']\nconst airconTargetTemp = airconAttributes['temperature']\nconst airconFanMode = airconAttributes['fan_mode']\nconst airconDisplay = airconAttributes['screen_display']\n\n// Gather the last explicitly sent configuration from the context\n\nconst airconHvacCfg = flow.get('emmaBedroom.airconHvacMode', 'diskCon')\nconst airconEcoCfg = flow.get('emmaBedroom.airconEco', 'diskCon')\nconst airconTargetTempCfg = parseFloat(flow.get('emmaBedroom.airconTargetTemp', 'diskCon'))\nconst airconFanModeCfg = flow.get('emmaBedroom.airconFanMode', 'diskCon')\nconst airconDisplayCfg = flow.get('emmaBedroom.airconDisplay', 'diskCon')\n\n// Compare the current state with the last sent configuration\n\nlet ecoMatch = {}\nlet displayMatch = {}\nlet counter = 0\n\nlet sendDisplay = {\n \"payload\": {\n \"action\": `switch.${airconDisplayCfg}`,\n \"target\": {\n \"entity_id\": [\"switch.emma_bedroom_aircon_display\"]\n },\n \"data\": {}\n }\n}\n\nlet sendHvac = {\n \"payload\": {\n \"action\": \"climate.set_hvac_mode\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"hvac_mode\": airconHvacCfg\n }\n }\n}\n\nlet sendTemp = {\n \"payload\": {\n \"action\": \"climate.set_temperature\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"temperature\": airconTargetTempCfg\n }\n }\n}\n\nlet sendEco = {\n \"payload\": {\n \"action\": `switch.${airconEcoCfg}`,\n \"target\": {\n \"entity_id\": [\"switch.emma_bedroom_aircon_eco_mode\"]\n },\n \"data\": {}\n }\n}\n\nlet sendAcFan = {\n \"payload\": {\n \"action\": \"climate.set_fan_mode\",\n \"target\": {\n \"entity_id\": airconEntity\n },\n \"data\": {\n \"fan_mode\": airconFanModeCfg\n }\n }\n}\n\n// Fix hvac mode if mismatch\n\nif (airconState != airconHvacCfg) {\n node.log(`Emma Bedroom Aircon HVAC mode mismatch: ${airconState} vs ${airconHvacCfg}`)\n node.send(sendHvac)\n counter += 1\n}\n\n// Fix eco mode if mismatch\n\nif (airconEco === false && airconEcoCfg === 'turn_off') {\n ecoMatch = true\n} else if (airconEco === true && airconEcoCfg === 'turn_on') {\n ecoMatch = true\n} else {\n ecoMatch = false\n}\n\nif (ecoMatch === false) {\n node.log(`Emma Bedroom Aircon Eco mode mismatch: ${airconEco} vs ${airconEcoCfg}`)\n node.send(sendEco)\n counter += 1\n}\n\n// Fix target temperature if mismatch\n\nif (airconTargetTemp != airconTargetTempCfg) {\n node.log(`Target temperature mismatch: ${airconTargetTemp} vs ${airconTargetTempCfg}`)\n node.send(sendTemp)\n counter += 1\n}\n\n// Fix fan mode if mismatch\n\nif (airconFanMode != airconFanModeCfg) {\n node.log(`Fan mode mismatch: ${airconFanMode} vs ${airconFanModeCfg}`)\n node.send(sendAcFan)\n counter += 1\n}\n\n// Fix display mode if mismatch\n\nif (airconDisplay === false && airconDisplayCfg === 'turn_off') {\n displayMatch = true\n} else if (airconDisplay === true && airconDisplayCfg === 'turn_on') {\n displayMatch = true\n} else {\n displayMatch = false\n}\n\nif (displayMatch === false) {\n node.log(`Emma Bedroom Aircon Display mode mismatch: ${airconDisplay} vs ${airconDisplayCfg}`)\n node.send(sendDisplay)\n counter += 1\n}\n\nif (counter > 0) {\n node.log(`Emma Bedroom Aircon: ${counter} configuration(s) fixed`)\n node.status({fill:'yellow',shape:'dot',text:`${counter} config(s) fixed`})\n} else {\n node.status({fill:'green',shape:'dot',text:`No config changes`})\n}",
|
||||
"outputs": 1,
|
||||
"timeout": 0,
|
||||
"noerr": 0,
|
||||
@@ -28233,7 +28237,8 @@
|
||||
"50e351d1ee6108b3",
|
||||
"334c28e08be1db12",
|
||||
"20b3699a56b0e901",
|
||||
"12e0c7c54a58f849"
|
||||
"12e0c7c54a58f849",
|
||||
"23e419f1270da94b"
|
||||
]
|
||||
]
|
||||
},
|
||||
@@ -28266,7 +28271,7 @@
|
||||
"domain": "switch",
|
||||
"service": "turn_on",
|
||||
"x": 880,
|
||||
"y": 520,
|
||||
"y": 580,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@@ -28296,7 +28301,7 @@
|
||||
"domain": "script",
|
||||
"service": "turn_on",
|
||||
"x": 890,
|
||||
"y": 580,
|
||||
"y": 640,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
@@ -28429,7 +28434,7 @@
|
||||
"finalize": "",
|
||||
"libs": [],
|
||||
"x": 680,
|
||||
"y": 580,
|
||||
"y": 640,
|
||||
"wires": [
|
||||
[
|
||||
"9bd4665845af0545"
|
||||
@@ -28916,7 +28921,7 @@
|
||||
"entity_location": "data",
|
||||
"override_data": "msg",
|
||||
"x": 670,
|
||||
"y": 520,
|
||||
"y": 580,
|
||||
"wires": [
|
||||
[
|
||||
"f30486c8e11db0e4"
|
||||
@@ -28928,6 +28933,38 @@
|
||||
"Off"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "23e419f1270da94b",
|
||||
"type": "api-call-service",
|
||||
"z": "9824adcf61e30734",
|
||||
"g": "f4057835848d0904",
|
||||
"name": "Turn off Basement Fan",
|
||||
"server": "9e87348d.9c1c48",
|
||||
"version": 7,
|
||||
"debugenabled": false,
|
||||
"action": "fan.turn_off",
|
||||
"floorId": [],
|
||||
"areaId": [],
|
||||
"deviceId": [],
|
||||
"entityId": [
|
||||
"fan.basement_fan"
|
||||
],
|
||||
"labelId": [],
|
||||
"data": "",
|
||||
"dataType": "jsonata",
|
||||
"mergeContext": "",
|
||||
"mustacheAltTags": false,
|
||||
"outputProperties": [],
|
||||
"queue": "none",
|
||||
"blockInputOverrides": true,
|
||||
"domain": "fan",
|
||||
"service": "turn_off",
|
||||
"x": 700,
|
||||
"y": 520,
|
||||
"wires": [
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "6f84caa4bd59a747",
|
||||
"type": "ha-button",
|
||||
@@ -34678,6 +34715,38 @@
|
||||
[]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "f34011787b8474ef",
|
||||
"type": "inject",
|
||||
"z": "ebd5561c4f077718",
|
||||
"g": "4329e464360d0afa",
|
||||
"name": "Manual Trigger",
|
||||
"props": [
|
||||
{
|
||||
"p": "payload"
|
||||
},
|
||||
{
|
||||
"p": "duration",
|
||||
"v": "10",
|
||||
"vt": "num"
|
||||
}
|
||||
],
|
||||
"repeat": "",
|
||||
"crontab": "",
|
||||
"once": false,
|
||||
"onceDelay": 0.1,
|
||||
"topic": "",
|
||||
"payload": "on",
|
||||
"payloadType": "str",
|
||||
"x": 160,
|
||||
"y": 300,
|
||||
"wires": [
|
||||
[
|
||||
"70f795fb061cbfef",
|
||||
"b2c0d6629b2603b7"
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "1f7af146c06b8b85",
|
||||
"type": "ha-select",
|
||||
|
||||
Reference in New Issue
Block a user