From cb8bead629d57609da3406c3ecca6e9997f537ab Mon Sep 17 00:00:00 2001 From: m038 Date: Sun, 28 Jun 2026 00:17:41 +0200 Subject: [PATCH] Update flow files --- flows.json | 4462 ++++++++++++++++++++++++++-------------------------- 1 file changed, 2231 insertions(+), 2231 deletions(-) diff --git a/flows.json b/flows.json index 0052cd9..bfba662 100644 --- a/flows.json +++ b/flows.json @@ -63,6 +63,14 @@ "info": "", "env": [] }, + { + "id": "c7f876875da48b87", + "type": "tab", + "label": "[Bathroom] Lights", + "disabled": false, + "info": "", + "env": [] + }, { "id": "97e0f1338e182d76", "type": "tab", @@ -86,14 +94,6 @@ "type": "tab", "label": "[Kitchen] Lights" }, - { - "id": "b70ee13eafa73823", - "type": "tab", - "label": "[Living Room] Lights", - "disabled": false, - "info": "", - "env": [] - }, { "id": "b73eb220c60f9f8b", "type": "tab", @@ -103,9 +103,9 @@ "env": [] }, { - "id": "c7f876875da48b87", + "id": "b70ee13eafa73823", "type": "tab", - "label": "[Bathroom] Lights", + "label": "[Living Room] Lights", "disabled": false, "info": "", "env": [] @@ -10076,6 +10076,1679 @@ [] ] }, + { + "id": "13c933aa7d791e63", + "type": "subflow:52430f5e9f9ee267", + "z": "c7f876875da48b87", + "name": "", + "x": 670, + "y": 160, + "wires": [ + [ + "cc46642a3ea04954" + ], + [ + "cc46642a3ea04954" + ], + [ + "cc46642a3ea04954" + ], + [ + "1ae97faec6bec4ae" + ], + [ + "1ae97faec6bec4ae" + ], + [ + "bath_br_state_01" + ] + ] + }, + { + "id": "812f8294add5575c", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom lights on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "light.bathroom_switch_left" + ], + "substring": [], + "regex": [] + }, + "outputInitially": true, + "stateType": "str", + "ifState": "on", + "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": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 150, + "y": 240, + "wires": [ + [ + "eab005bf8b682c46" + ], + [] + ] + }, + { + "id": "23f3fd10ac242022", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom Humidity Changed", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "sensor.bathroom_temperature_humidity" + ], + "substring": [], + "regex": [] + }, + "outputInitially": true, + "stateType": "", + "ifState": "0", + "ifStateType": "num", + "ifStateOperator": "gte", + "outputOnlyOnStateChange": true, + "for": 0, + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 180, + "y": 1140, + "wires": [ + [ + "f1a2b3c4d5e60001" + ], + [] + ] + }, + { + "id": "b2a9a137a909e257", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn on fan", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "switch.turn_on", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "switch.bathroom_switch_right" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [ + { + "property": "fan_state", + "propertyType": "msg", + "value": "on", + "valueType": "str" + } + ], + "queue": "all", + "blockInputOverrides": false, + "domain": "switch", + "service": "turn_on", + "output_location": "", + "output_location_type": "none", + "x": 970, + "y": 1200, + "wires": [ + [ + "bthrm_audio_acs_01" + ] + ] + }, + { + "id": "7e4f4bb9c0c9ef2b", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 5:00", + "op1": "", + "op2": "5 minutes past", + "op1type": "nul", + "op2type": "str", + "duration": "300", + "extend": false, + "overrideDelay": false, + "units": "s", + "reset": "off", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 810, + "y": 980, + "wires": [ + [ + "82599133dd2b9883" + ] + ] + }, + { + "id": "82599133dd2b9883", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Get Bathroom Humidity", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "0", + "halt_if_type": "num", + "halt_if_compare": "gte", + "entity_id": "sensor.bathroom_temperature_humidity", + "state_type": "", + "blockInputOverrides": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "entity" + } + ], + "for": "0", + "forType": "num", + "forUnits": "minutes", + "override_topic": false, + "state_location": "payload", + "override_payload": "msg", + "entity_location": "data", + "override_data": "msg", + "x": 1030, + "y": 980, + "wires": [ + [ + "d6e7f8a9b0c10002" + ], + [] + ] + }, + { + "id": "27d9e5846a679b8b", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off fan", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "switch.turn_off", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "switch.bathroom_switch_right" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "switch", + "service": "turn_off", + "output_location": "", + "output_location_type": "none", + "x": 1570, + "y": 1120, + "wires": [ + [] + ] + }, + { + "id": "4548a32796918fd8", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathroom ventilator automation shower", + "info": "", + "x": 210, + "y": 1000, + "wires": [] + }, + { + "id": "3d44cb85e182a197", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom fan turned on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "switch.bathroom_switch_right" + ], + "substring": [], + "regex": [] + }, + "outputInitially": true, + "stateType": "str", + "ifState": "on", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "", + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": false, + "ignoreCurrentStateUnavailable": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 160, + "y": 1040, + "wires": [ + [ + "7e4f4bb9c0c9ef2b", + "bthrm_fan_hard_01" + ], + [] + ] + }, + { + "id": "ebb5b8c2c3eb6ff5", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom motion sensor on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "binary_sensor.bathroom_motion_occupancy" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "on", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": 0, + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": false, + "ignoreCurrentStateUnavailable": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 180, + "y": 320, + "wires": [ + [ + "eab005bf8b682c46", + "580c3afd65deefed", + "cbba47369f1e6479" + ], + [ + "52af4ffdf85f60e4" + ] + ] + }, + { + "id": "cc46642a3ea04954", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Bright", + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_bright", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1290, + "y": 120, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] + }, + { + "id": "ed2d549e91e1399d", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn on Scene", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "scene.turn_on", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "{{ entity_id }}" + ], + "labelId": [], + "data": "{\"transition\":0}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "all", + "blockInputOverrides": false, + "domain": "scene", + "service": "turn_on", + "output_location": "", + "output_location_type": "none", + "x": 1600, + "y": 140, + "wires": [ + [] + ] + }, + { + "id": "1ae97faec6bec4ae", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Evening", + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_evening", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1290, + "y": 160, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] + }, + { + "id": "ddf62bacca5574f6", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Night", + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_night", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1280, + "y": 200, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] + }, + { + "id": "bdccd31c131b65fb", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathroom automated lights", + "info": "", + "x": 170, + "y": 200, + "wires": [] + }, + { + "id": "38ff5b8ecfcbfdd0", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathmode turned on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_boolean.bath_mode" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "on", + "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": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 150, + "y": 100, + "wires": [ + [ + "20da8eedd69886b0", + "f4a8732084a282d7" + ], + [ + "13c933aa7d791e63" + ] + ] + }, + { + "id": "20da8eedd69886b0", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Bath", + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_bath", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1280, + "y": 80, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] + }, + { + "id": "b8f30c8224cf9d74", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathmode ", + "info": "", + "x": 120, + "y": 60, + "wires": [] + }, + { + "id": "eab005bf8b682c46", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Noone bathing?", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "off", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_boolean.bath_mode", + "state_type": "str", + "blockInputOverrides": true, + "outputProperties": [], + "for": "0", + "forType": "num", + "forUnits": "minutes", + "override_topic": false, + "state_location": "payload", + "override_payload": "msg", + "entity_location": "data", + "override_data": "msg", + "x": 440, + "y": 220, + "wires": [ + [ + "13c933aa7d791e63" + ], + [] + ] + }, + { + "id": "cbba47369f1e6479", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait 1:30 min", + "op1": "", + "op2": "90", + "op1type": "nul", + "op2type": "num", + "duration": "90", + "extend": false, + "overrideDelay": false, + "units": "s", + "reset": "on", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 640, + "y": 660, + "wires": [ + [ + "e12d8801b6c6f320" + ] + ] + }, + { + "id": "580c3afd65deefed", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 2:00 min", + "op1": "", + "op2": "120", + "op1type": "nul", + "op2type": "num", + "duration": "120", + "extend": false, + "overrideDelay": false, + "units": "s", + "reset": "on", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 650, + "y": 620, + "wires": [ + [ + "e12d8801b6c6f320" + ] + ] + }, + { + "id": "26f9395831aa077c", + "type": "change", + "z": "c7f876875da48b87", + "name": "Flash at brightness 100%", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1250, + "y": 800, + "wires": [ + [ + "b1e7dd85582b7d3e" + ] + ] + }, + { + "id": "b1e7dd85582b7d3e", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Execute effect on lights bathroom", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "light.turn_on", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "light.bathroom_lights" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "light", + "service": "turn_on", + "output_location": "", + "output_location_type": "none", + "x": 1580, + "y": 800, + "wires": [ + [] + ] + }, + { + "id": "07d4571f236fd04b", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Noone bathing?", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "off", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_boolean.bath_mode", + "state_type": "str", + "blockInputOverrides": true, + "outputProperties": [], + "for": "0", + "forType": "num", + "forUnits": "minutes", + "override_topic": false, + "state_location": "payload", + "override_payload": "msg", + "entity_location": "data", + "override_data": "msg", + "x": 1100, + "y": 640, + "wires": [ + [ + "bthrm_presence_acs_01" + ], + [] + ] + }, + { + "id": "a8ad8572dc926e44", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off lights bathroom", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "light.turn_off", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "light.bathroom_lights" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "light", + "service": "turn_off", + "output_location": "", + "output_location_type": "none", + "x": 1550, + "y": 740, + "wires": [ + [] + ] + }, + { + "id": "52af4ffdf85f60e4", + "type": "change", + "z": "c7f876875da48b87", + "name": "Store motion off time", + "rules": [ + { + "t": "set", + "p": "motion_off_at", + "pt": "msg", + "to": "data.last_changed", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 340, + "y": 600, + "wires": [ + [ + "580c3afd65deefed", + "cbba47369f1e6479" + ] + ] + }, + { + "id": "e12d8801b6c6f320", + "type": "change", + "z": "c7f876875da48b87", + "name": "Store which delay", + "rules": [ + { + "t": "set", + "p": "delay", + "pt": "msg", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 890, + "y": 640, + "wires": [ + [ + "07d4571f236fd04b" + ] + ] + }, + { + "id": "bbd7dc3adff7b866", + "type": "switch", + "z": "c7f876875da48b87", + "name": "2:00 or 1:30 min delay", + "property": "delay", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "120", + "vt": "num" + }, + { + "t": "eq", + "v": "90", + "vt": "num" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 900, + "y": 740, + "wires": [ + [ + "a8ad8572dc926e44" + ], + [ + "26f9395831aa077c" + ] + ] + }, + { + "id": "f4a8732084a282d7", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 5 hours", + "op1": "", + "op2": "", + "op1type": "nul", + "op2type": "num", + "duration": "5", + "extend": false, + "overrideDelay": false, + "units": "hr", + "reset": "off", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 640, + "y": 520, + "wires": [ + [ + "4b98e17771cc3851" + ] + ] + }, + { + "id": "4b98e17771cc3851", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off bath mode", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "input_boolean.turn_off", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "input_boolean.bath_mode" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "input_boolean", + "service": "turn_off", + "output_location": "", + "output_location_type": "none", + "x": 890, + "y": 520, + "wires": [ + [] + ] + }, + { + "id": "bb74897476a1a5e6", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Automatic turn off bath mode after X hours", + "info": "", + "x": 720, + "y": 480, + "wires": [] + }, + { + "id": "f1a2b3c4d5e60001", + "type": "function", + "z": "c7f876875da48b87", + "name": "Rise >= 3% in 2 min?", + "func": "const readings = context.get('readings') || [];\nconst lastTriggered = context.get('lastTriggered') || 0;\nconst now = Date.now();\nconst current = parseFloat(msg.payload);\n\nif (isNaN(current)) {\n node.error('Humidity sensor non-numeric value: ' + msg.payload, msg);\n return null;\n}\n\n// 15-minute cooldown after triggering\nif (now - lastTriggered < 15 * 60 * 1000) return null;\n\nreadings.push({ time: now, value: current });\nconst windowMs = 2 * 60 * 1000;\nconst filtered = readings.filter(r => r.time >= now - windowMs);\ncontext.set('readings', filtered);\n\nif (filtered.length < 2) return null;\n\nconst minInWindow = Math.min(...filtered.map(r => r.value));\nconst rise = current - minInWindow;\n\nif (rise >= 3) {\n context.set('lastTriggered', now);\n context.set('readings', []);\n flow.set('humidityBaseline', minInWindow);\n return msg;\n}\nreturn null;", + "outputs": 1, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 500, + "y": 1140, + "wires": [ + [ + "b2a9a137a909e257" + ] + ] + }, + { + "id": "d6e7f8a9b0c10002", + "type": "function", + "z": "c7f876875da48b87", + "name": "Below baseline + 5%?", + "func": "const current = parseFloat(msg.payload);\nconst baseline = flow.get(\"humidityBaseline\") || 60;\nconst threshold = baseline + 5;\n\nif (current <= threshold) {\n return [msg, null];\n}\nreturn [null, msg];", + "outputs": 2, + "timeout": 0, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1280, + "y": 980, + "wires": [ + [ + "27d9e5846a679b8b" + ], + [ + "7e4f4bb9c0c9ef2b" + ] + ] + }, + { + "id": "bthrm_timebased_01", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom time-based turn on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_button.bathroom_time_based_turn_on" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": "", + "forType": "num", + "forUnits": "milliseconds", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 180, + "y": 140, + "wires": [ + [ + "13c933aa7d791e63" + ] + ] + }, + { + "id": "bath_br_state_01", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Bedroom ceiling brightness", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "light.bedroom_main", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "entity" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "x": 940, + "y": 220, + "wires": [ + [ + "bath_br_switch_01" + ] + ] + }, + { + "id": "bath_br_switch_01", + "type": "switch", + "z": "c7f876875da48b87", + "name": "Bedroom brightness > 50%?", + "property": "data.attributes.brightness", + "propertyType": "msg", + "rules": [ + { + "t": "gt", + "v": "128", + "vt": "num" + }, + { + "t": "else" + } + ], + "checkall": "false", + "repair": false, + "outputs": 2, + "x": 940, + "y": 280, + "wires": [ + [ + "1ae97faec6bec4ae" + ], + [ + "ddf62bacca5574f6" + ] + ] + }, + { + "id": "errc7f87687_c", + "type": "catch", + "z": "c7f876875da48b87", + "name": "Tab errors", + "scope": null, + "uncaught": false, + "x": 120, + "y": 940, + "wires": [ + [ + "errc7f87687_f" + ] + ] + }, + { + "id": "errc7f87687_f", + "type": "function", + "z": "c7f876875da48b87", + "name": "Format error", + "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || \"Unknown error\");\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Bathroom\", data: { priority: 1 } });\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 360, + "y": 940, + "wires": [ + [ + "errc7f87687_s" + ] + ] + }, + { + "id": "errc7f87687_s", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "gotify_nodered", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "areaId": [], + "deviceId": [], + "entityId": [], + "data": "{{{payload}}}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "domain": "notify", + "service": "gotify_nodered", + "x": 600, + "y": 940, + "wires": [ + [] + ] + }, + { + "id": "bthrm_audio_cmt_01", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Shower → Audio Volume Sync", + "info": "", + "x": 190, + "y": 1220, + "wires": [] + }, + { + "id": "bthrm_audio_ssc_01", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom fan turned off", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "switch.bathroom_switch_right" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "off", + "ifStateType": "str", + "ifStateOperator": "is", + "outputOnlyOnStateChange": true, + "for": 0, + "forType": "num", + "forUnits": "minutes", + "ignorePrevStateNull": false, + "ignorePrevStateUnknown": false, + "ignorePrevStateUnavailable": false, + "ignoreCurrentStateUnknown": true, + "ignoreCurrentStateUnavailable": true, + "outputProperties": [ + { + "property": "fan_state", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + } + ], + "x": 160, + "y": 1260, + "wires": [ + [ + "bthrm_audio_acs_01", + "bthrm_fan_hard_rst_01" + ], + [] + ] + }, + { + "id": "bthrm_audio_acs_01", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Get bathroom speaker state", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "playing", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "media_player.bathroom", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "entity" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "override_topic": false, + "state_location": "payload", + "override_payload": "msg", + "entity_location": "data", + "override_data": "msg", + "x": 620, + "y": 1280, + "wires": [ + [ + "bthrm_audio_swt_vol_01" + ], + [] + ] + }, + { + "id": "bthrm_audio_swt_vol_01", + "type": "switch", + "z": "c7f876875da48b87", + "name": "Volume > 0?", + "property": "data.attributes.volume_level", + "propertyType": "msg", + "rules": [ + { + "t": "gt", + "v": "0", + "vt": "num" + }, + { + "t": "else" + } + ], + "checkall": "false", + "repair": false, + "outputs": 2, + "x": 930, + "y": 1320, + "wires": [ + [ + "bthrm_audio_swt_fan_01" + ], + [] + ] + }, + { + "id": "bthrm_audio_swt_fan_01", + "type": "switch", + "z": "c7f876875da48b87", + "name": "Fan on or off?", + "property": "fan_state", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "on", + "vt": "str" + }, + { + "t": "else" + } + ], + "checkall": "false", + "repair": false, + "outputs": 2, + "x": 1140, + "y": 1320, + "wires": [ + [ + "bthrm_audio_chg_up_01" + ], + [ + "bthrm_audio_chg_dn_01" + ] + ] + }, + { + "id": "bthrm_audio_chg_up_01", + "type": "change", + "z": "c7f876875da48b87", + "name": "Volume +0.05", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "$min(0.28, $round((data.attributes.volume_level + 0.05) * 100) / 100)", + "tot": "jsonata" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1380, + "y": 1280, + "wires": [ + [ + "bthrm_audio_svc_01" + ] + ] + }, + { + "id": "bthrm_audio_chg_dn_01", + "type": "change", + "z": "c7f876875da48b87", + "name": "Volume -0.05", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "$max(0, $round((data.attributes.volume_level - 0.05) * 100) / 100)", + "tot": "jsonata" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1370, + "y": 1360, + "wires": [ + [ + "bthrm_audio_svc_01" + ] + ] + }, + { + "id": "bthrm_audio_svc_01", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Set bathroom speaker volume", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "media_player.volume_set", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "media_player.bathroom" + ], + "labelId": [], + "data": "{\"volume_level\": {{{payload}}}}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "media_player", + "service": "volume_set", + "output_location": "", + "output_location_type": "none", + "x": 1670, + "y": 1320, + "wires": [ + [] + ] + }, + { + "id": "bthrm_audio_ssc_02", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom music playing", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "media_player.bathroom" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "playing", + "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": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 160, + "y": 1340, + "wires": [ + [ + "bthrm_audio_acs_fan_01" + ], + [] + ] + }, + { + "id": "bthrm_audio_acs_fan_01", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Get fan state", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "switch.bathroom_switch_right", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "fan_state", + "propertyType": "msg", + "value": "string", + "valueType": "entityState" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "x": 570, + "y": 1340, + "wires": [ + [ + "bthrm_audio_swt_vol_01" + ] + ] + }, + { + "id": "bthrm_presence_acs_01", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Still in bathroom?", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "Bathroom", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_select.room_presence", + "state_type": "str", + "blockInputOverrides": false, + "outputProperties": [], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "x": 1370, + "y": 640, + "wires": [ + [], + [ + "bbd7dc3adff7b866" + ] + ] + }, + { + "id": "bthrm_fan_hard_cmt", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Hard cutoff: max 45 min fan runtime", + "info": "", + "x": 200, + "y": 1100, + "wires": [] + }, + { + "id": "bthrm_fan_hard_01", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Hard cutoff 45 min", + "op1": "", + "op2": "cutoff", + "op1type": "nul", + "op2type": "str", + "duration": "2700", + "extend": false, + "overrideDelay": false, + "units": "s", + "reset": "", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 990, + "y": 1120, + "wires": [ + [ + "27d9e5846a679b8b" + ] + ] + }, + { + "id": "bthrm_fan_hard_rst_01", + "type": "change", + "z": "c7f876875da48b87", + "name": "Set msg.reset=true", + "rules": [ + { + "t": "set", + "p": "reset", + "pt": "msg", + "to": "true", + "tot": "bool" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 490, + "y": 1200, + "wires": [ + [ + "bthrm_fan_hard_01", + "7e4f4bb9c0c9ef2b" + ] + ] + }, { "id": "d46b0ef0ec904159", "type": "server-state-changed", @@ -14543,6 +16216,554 @@ [] ] }, + { + "id": "b1b0a80b.d1f6cf", + "type": "api-current-state", + "z": "b73eb220c60f9f8b", + "name": "Get auto standby time", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_number.coffee_max_standby", + "state_type": "", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "number", + "valueType": "entityState" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "x": 440, + "y": 120, + "wires": [ + [ + "espresso_fn_001" + ] + ] + }, + { + "id": "espresso_fn_001", + "type": "change", + "z": "b73eb220c60f9f8b", + "name": "Store standby time", + "rules": [ + { + "t": "set", + "p": "espresso_standby", + "pt": "flow", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 730, + "y": 120, + "wires": [ + [ + "c0926692.581f73" + ] + ] + }, + { + "id": "304a933a.0c94bb", + "type": "server-state-changed", + "z": "b73eb220c60f9f8b", + "name": "Espresso machine is on", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "switch.espresso_kitchen" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "on", + "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": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 160, + "y": 120, + "wires": [ + [ + "b1b0a80b.d1f6cf" + ], + [] + ] + }, + { + "id": "8b67baba.6bec7f", + "type": "api-call-service", + "z": "b73eb220c60f9f8b", + "name": "Turn off espresso", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [ + "switch.espresso_kitchen" + ], + "labelId": [], + "data": "", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "switch", + "service": "turn_off", + "x": 1090, + "y": 200, + "wires": [ + [] + ] + }, + { + "id": "c0926692.581f73", + "type": "stoptimer-varidelay", + "z": "b73eb220c60f9f8b", + "duration": "espresso_standby", + "durationType": "flow", + "units": "Minute", + "payloadtype": "num", + "payloadval": "", + "name": "Off timer ", + "reporting": "none", + "reportingformat": "human", + "persist": true, + "ignoretimerpass": false, + "x": 800, + "y": 200, + "wires": [ + [ + "8b67baba.6bec7f" + ], + [], + [] + ] + }, + { + "id": "fa64478a.97f1a8", + "type": "server-state-changed", + "z": "b73eb220c60f9f8b", + "name": "Espresso machine is off", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "switch.espresso_kitchen" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "str", + "ifState": "off", + "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": "string", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 160, + "y": 200, + "wires": [ + [ + "f4b1069c.ad2569" + ], + [] + ] + }, + { + "id": "f4b1069c.ad2569", + "type": "change", + "z": "b73eb220c60f9f8b", + "name": "Send STOP", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "stop", + "tot": "str" + } + ], + "x": 410, + "y": 200, + "wires": [ + [ + "c0926692.581f73" + ] + ] + }, + { + "id": "errb73eb220_c", + "type": "catch", + "z": "b73eb220c60f9f8b", + "name": "Tab errors", + "scope": null, + "uncaught": false, + "x": 120, + "y": 2000, + "wires": [ + [ + "errb73eb220_f" + ] + ] + }, + { + "id": "errb73eb220_f", + "type": "function", + "z": "b73eb220c60f9f8b", + "name": "Format error", + "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || 'Unknown error');\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Espresso Machine\", data: { priority: 1 } });\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 360, + "y": 2000, + "wires": [ + [ + "errb73eb220_s" + ] + ] + }, + { + "id": "errb73eb220_s", + "type": "api-call-service", + "z": "b73eb220c60f9f8b", + "name": "gotify_nodered", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "areaId": [], + "deviceId": [], + "entityId": [], + "data": "{{{payload}}}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "domain": "notify", + "service": "gotify_nodered", + "x": 600, + "y": 2000, + "wires": [ + [] + ] + }, + { + "id": "3dbc0aef753068b6", + "type": "catch", + "z": "b73eb220c60f9f8b", + "name": "Tab errors", + "scope": null, + "uncaught": false, + "x": 120, + "y": 320, + "wires": [ + [ + "f12242c7d3a27af5" + ] + ] + }, + { + "id": "f12242c7d3a27af5", + "type": "function", + "z": "b73eb220c60f9f8b", + "name": "Format error", + "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || 'Unknown error');\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Living room\", data: { priority: 1 } });\nreturn msg;", + "outputs": 1, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 390, + "y": 320, + "wires": [ + [ + "4abcaba467c1d59d" + ] + ] + }, + { + "id": "4abcaba467c1d59d", + "type": "api-call-service", + "z": "b73eb220c60f9f8b", + "name": "gotify_nodered", + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "notify.gotify_nodered", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [], + "labelId": [], + "data": "{{{payload}}}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "notify", + "service": "gotify_nodered", + "x": 640, + "y": 320, + "wires": [ + [] + ] + }, + { + "id": "bcbc032dc0da76b5", + "type": "inject", + "z": "b73eb220c60f9f8b", + "name": "", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "5", + "payloadType": "num", + "x": 410, + "y": 260, + "wires": [ + [ + "espresso_fn_001" + ] + ] + }, + { + "id": "espresso_cmt_sync", + "type": "comment", + "z": "b73eb220c60f9f8b", + "name": "Keep flow.espresso_standby in sync (fixes race condition)", + "info": "", + "x": 250, + "y": 320, + "wires": [] + }, + { + "id": "espresso_inj_init", + "type": "inject", + "z": "b73eb220c60f9f8b", + "name": "Init: read standby time", + "props": [ + { + "p": "payload" + } + ], + "repeat": "", + "crontab": "", + "once": true, + "onceDelay": 0.5, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 140, + "y": 360, + "wires": [ + [ + "espresso_acs_init" + ] + ] + }, + { + "id": "espresso_acs_init", + "type": "api-current-state", + "z": "b73eb220c60f9f8b", + "name": "Get standby time", + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 1, + "halt_if": "", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "input_number.coffee_max_standby", + "state_type": "", + "blockInputOverrides": false, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "number", + "valueType": "entityState" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "override_topic": false, + "state_location": "payload", + "override_payload": "msg", + "entity_location": "data", + "override_data": "msg", + "x": 470, + "y": 360, + "wires": [ + [ + "espresso_chg_store" + ] + ] + }, + { + "id": "espresso_ssc_standby", + "type": "server-state-changed", + "z": "b73eb220c60f9f8b", + "name": "Standby time changed", + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 1, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "input_number.coffee_max_standby" + ], + "substring": [], + "regex": [] + }, + "outputInitially": false, + "stateType": "", + "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": "number", + "valueType": "entityState" + } + ], + "x": 140, + "y": 420, + "wires": [ + [ + "espresso_chg_store" + ] + ] + }, + { + "id": "espresso_chg_store", + "type": "change", + "z": "b73eb220c60f9f8b", + "name": "Update flow.espresso_standby", + "rules": [ + { + "t": "set", + "p": "espresso_standby", + "pt": "flow", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 870, + "y": 400, + "wires": [ + [] + ] + }, { "id": "tst0000000000003", "type": "switch", @@ -19731,2226 +21952,5 @@ "wires": [ [] ] - }, - { - "id": "b1b0a80b.d1f6cf", - "type": "api-current-state", - "z": "b73eb220c60f9f8b", - "name": "Get auto standby time", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 1, - "halt_if": "", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_number.coffee_max_standby", - "state_type": "", - "blockInputOverrides": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "number", - "valueType": "entityState" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "x": 440, - "y": 120, - "wires": [ - [ - "espresso_fn_001" - ] - ] - }, - { - "id": "espresso_fn_001", - "type": "change", - "z": "b73eb220c60f9f8b", - "name": "Store standby time", - "rules": [ - { - "t": "set", - "p": "espresso_standby", - "pt": "flow", - "to": "payload", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 750, - "y": 120, - "wires": [ - [ - "c0926692.581f73" - ] - ] - }, - { - "id": "304a933a.0c94bb", - "type": "server-state-changed", - "z": "b73eb220c60f9f8b", - "name": "Espresso machine is on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "switch.espresso_kitchen" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "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": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 160, - "y": 120, - "wires": [ - [ - "c0926692.581f73" - ], - [] - ] - }, - { - "id": "8b67baba.6bec7f", - "type": "api-call-service", - "z": "b73eb220c60f9f8b", - "name": "Turn off espresso", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "switch.espresso_kitchen" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "switch", - "service": "turn_off", - "x": 1090, - "y": 200, - "wires": [ - [] - ] - }, - { - "id": "c0926692.581f73", - "type": "stoptimer-varidelay", - "z": "b73eb220c60f9f8b", - "duration": "espresso_standby", - "durationType": "flow", - "units": "Minute", - "payloadtype": "num", - "payloadval": "", - "name": "Off timer ", - "reporting": "none", - "reportingformat": "human", - "persist": true, - "ignoretimerpass": false, - "x": 800, - "y": 200, - "wires": [ - [ - "8b67baba.6bec7f" - ], - [], - [] - ] - }, - { - "id": "fa64478a.97f1a8", - "type": "server-state-changed", - "z": "b73eb220c60f9f8b", - "name": "Espresso machine is off", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "switch.espresso_kitchen" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "off", - "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": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 160, - "y": 200, - "wires": [ - [ - "f4b1069c.ad2569" - ], - [] - ] - }, - { - "id": "f4b1069c.ad2569", - "type": "change", - "z": "b73eb220c60f9f8b", - "name": "Send STOP", - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "stop", - "tot": "str" - } - ], - "x": 410, - "y": 200, - "wires": [ - [ - "c0926692.581f73" - ] - ] - }, - { - "id": "errb73eb220_c", - "type": "catch", - "z": "b73eb220c60f9f8b", - "name": "Tab errors", - "scope": null, - "uncaught": false, - "x": 120, - "y": 2000, - "wires": [ - [ - "errb73eb220_f" - ] - ] - }, - { - "id": "errb73eb220_f", - "type": "function", - "z": "b73eb220c60f9f8b", - "name": "Format error", - "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || 'Unknown error');\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Espresso Machine\", data: { priority: 1 } });\nreturn msg;", - "outputs": 1, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 360, - "y": 2000, - "wires": [ - [ - "errb73eb220_s" - ] - ] - }, - { - "id": "errb73eb220_s", - "type": "api-call-service", - "z": "b73eb220c60f9f8b", - "name": "gotify_nodered", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "areaId": [], - "deviceId": [], - "entityId": [], - "data": "{{{payload}}}", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "domain": "notify", - "service": "gotify_nodered", - "x": 600, - "y": 2000, - "wires": [ - [] - ] - }, - { - "id": "3dbc0aef753068b6", - "type": "catch", - "z": "b73eb220c60f9f8b", - "name": "Tab errors", - "scope": null, - "uncaught": false, - "x": 120, - "y": 320, - "wires": [ - [ - "f12242c7d3a27af5" - ] - ] - }, - { - "id": "f12242c7d3a27af5", - "type": "function", - "z": "b73eb220c60f9f8b", - "name": "Format error", - "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || 'Unknown error');\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Living room\", data: { priority: 1 } });\nreturn msg;", - "outputs": 1, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 390, - "y": 320, - "wires": [ - [ - "4abcaba467c1d59d" - ] - ] - }, - { - "id": "4abcaba467c1d59d", - "type": "api-call-service", - "z": "b73eb220c60f9f8b", - "name": "gotify_nodered", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "notify.gotify_nodered", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [], - "labelId": [], - "data": "{{{payload}}}", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "notify", - "service": "gotify_nodered", - "x": 640, - "y": 320, - "wires": [ - [] - ] - }, - { - "id": "bcbc032dc0da76b5", - "type": "inject", - "z": "b73eb220c60f9f8b", - "name": "", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "topic": "", - "payload": "5", - "payloadType": "num", - "x": 410, - "y": 260, - "wires": [ - [ - "espresso_fn_001" - ] - ] - }, - { - "id": "espresso_cmt_sync", - "type": "comment", - "z": "b73eb220c60f9f8b", - "name": "Keep flow.espresso_standby in sync (fixes race condition)", - "info": "", - "x": 250, - "y": 320, - "wires": [] - }, - { - "id": "espresso_inj_init", - "type": "inject", - "z": "b73eb220c60f9f8b", - "name": "Init: read standby time", - "props": [ - { - "p": "payload" - } - ], - "repeat": "", - "crontab": "", - "once": true, - "onceDelay": 0.5, - "topic": "", - "payload": "", - "payloadType": "date", - "x": 200, - "y": 360, - "wires": [ - [ - "espresso_acs_init" - ] - ] - }, - { - "id": "espresso_acs_init", - "type": "api-current-state", - "z": "b73eb220c60f9f8b", - "name": "Get standby time", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 1, - "halt_if": "", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_number.coffee_max_standby", - "state_type": "", - "blockInputOverrides": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "number", - "valueType": "entityState" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 460, - "y": 360, - "wires": [ - [ - "espresso_chg_store" - ] - ] - }, - { - "id": "espresso_ssc_standby", - "type": "server-state-changed", - "z": "b73eb220c60f9f8b", - "name": "Standby time changed", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 1, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "input_number.coffee_max_standby" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "", - "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": "number", - "valueType": "entityState" - } - ], - "x": 200, - "y": 420, - "wires": [ - [ - "espresso_chg_store" - ] - ] - }, - { - "id": "espresso_chg_store", - "type": "change", - "z": "b73eb220c60f9f8b", - "name": "Update flow.espresso_standby", - "rules": [ - { - "t": "set", - "p": "espresso_standby", - "pt": "flow", - "to": "payload", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 760, - "y": 390, - "wires": [ - [] - ] - }, - { - "id": "13c933aa7d791e63", - "type": "subflow:52430f5e9f9ee267", - "z": "c7f876875da48b87", - "name": "", - "x": 670, - "y": 160, - "wires": [ - [ - "cc46642a3ea04954" - ], - [ - "cc46642a3ea04954" - ], - [ - "cc46642a3ea04954" - ], - [ - "1ae97faec6bec4ae" - ], - [ - "1ae97faec6bec4ae" - ], - [ - "bath_br_state_01" - ] - ] - }, - { - "id": "812f8294add5575c", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom lights on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "light.bathroom_switch_left" - ], - "substring": [], - "regex": [] - }, - "outputInitially": true, - "stateType": "str", - "ifState": "on", - "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": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 150, - "y": 240, - "wires": [ - [ - "eab005bf8b682c46" - ], - [] - ] - }, - { - "id": "23f3fd10ac242022", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom Humidity Changed", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "sensor.bathroom_temperature_humidity" - ], - "substring": [], - "regex": [] - }, - "outputInitially": true, - "stateType": "", - "ifState": "0", - "ifStateType": "num", - "ifStateOperator": "gte", - "outputOnlyOnStateChange": true, - "for": 0, - "forType": "num", - "forUnits": "minutes", - "ignorePrevStateNull": false, - "ignorePrevStateUnknown": false, - "ignorePrevStateUnavailable": false, - "ignoreCurrentStateUnknown": true, - "ignoreCurrentStateUnavailable": true, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 180, - "y": 1140, - "wires": [ - [ - "f1a2b3c4d5e60001" - ], - [] - ] - }, - { - "id": "b2a9a137a909e257", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn on fan", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "switch.turn_on", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "switch.bathroom_switch_right" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [ - { - "property": "fan_state", - "propertyType": "msg", - "value": "on", - "valueType": "str" - } - ], - "queue": "all", - "blockInputOverrides": false, - "domain": "switch", - "service": "turn_on", - "output_location": "", - "output_location_type": "none", - "x": 970, - "y": 1200, - "wires": [ - [ - "bthrm_audio_acs_01" - ] - ] - }, - { - "id": "7e4f4bb9c0c9ef2b", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 5:00", - "op1": "", - "op2": "5 minutes past", - "op1type": "nul", - "op2type": "str", - "duration": "300", - "extend": false, - "overrideDelay": false, - "units": "s", - "reset": "off", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 810, - "y": 980, - "wires": [ - [ - "82599133dd2b9883" - ] - ] - }, - { - "id": "82599133dd2b9883", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Get Bathroom Humidity", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "0", - "halt_if_type": "num", - "halt_if_compare": "gte", - "entity_id": "sensor.bathroom_temperature_humidity", - "state_type": "", - "blockInputOverrides": true, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "entity" - } - ], - "for": "0", - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 1030, - "y": 980, - "wires": [ - [ - "d6e7f8a9b0c10002" - ], - [] - ] - }, - { - "id": "27d9e5846a679b8b", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off fan", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "switch.turn_off", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "switch.bathroom_switch_right" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "switch", - "service": "turn_off", - "output_location": "", - "output_location_type": "none", - "x": 1570, - "y": 1120, - "wires": [ - [] - ] - }, - { - "id": "4548a32796918fd8", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathroom ventilator automation shower", - "info": "", - "x": 210, - "y": 1000, - "wires": [] - }, - { - "id": "3d44cb85e182a197", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom fan turned on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "switch.bathroom_switch_right" - ], - "substring": [], - "regex": [] - }, - "outputInitially": true, - "stateType": "str", - "ifState": "on", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": "", - "forType": "num", - "forUnits": "minutes", - "ignorePrevStateNull": false, - "ignorePrevStateUnknown": false, - "ignorePrevStateUnavailable": false, - "ignoreCurrentStateUnknown": false, - "ignoreCurrentStateUnavailable": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 160, - "y": 1040, - "wires": [ - [ - "7e4f4bb9c0c9ef2b", - "bthrm_fan_hard_01" - ], - [] - ] - }, - { - "id": "ebb5b8c2c3eb6ff5", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom motion sensor on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "binary_sensor.bathroom_motion_occupancy" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": 0, - "forType": "num", - "forUnits": "minutes", - "ignorePrevStateNull": false, - "ignorePrevStateUnknown": false, - "ignorePrevStateUnavailable": false, - "ignoreCurrentStateUnknown": false, - "ignoreCurrentStateUnavailable": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 180, - "y": 320, - "wires": [ - [ - "eab005bf8b682c46", - "580c3afd65deefed", - "cbba47369f1e6479" - ], - [ - "52af4ffdf85f60e4" - ] - ] - }, - { - "id": "cc46642a3ea04954", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Bright", - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_bright", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1290, - "y": 120, - "wires": [ - [ - "ed2d549e91e1399d" - ] - ] - }, - { - "id": "ed2d549e91e1399d", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn on Scene", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "scene.turn_on", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "{{ entity_id }}" - ], - "labelId": [], - "data": "{\"transition\":0}", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "all", - "blockInputOverrides": false, - "domain": "scene", - "service": "turn_on", - "output_location": "", - "output_location_type": "none", - "x": 1600, - "y": 140, - "wires": [ - [] - ] - }, - { - "id": "1ae97faec6bec4ae", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Evening", - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_evening", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1290, - "y": 160, - "wires": [ - [ - "ed2d549e91e1399d" - ] - ] - }, - { - "id": "ddf62bacca5574f6", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Night", - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_night", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1280, - "y": 200, - "wires": [ - [ - "ed2d549e91e1399d" - ] - ] - }, - { - "id": "bdccd31c131b65fb", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathroom automated lights", - "info": "", - "x": 170, - "y": 200, - "wires": [] - }, - { - "id": "38ff5b8ecfcbfdd0", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathmode turned on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "input_boolean.bath_mode" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "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": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 150, - "y": 100, - "wires": [ - [ - "20da8eedd69886b0", - "f4a8732084a282d7" - ], - [ - "13c933aa7d791e63" - ] - ] - }, - { - "id": "20da8eedd69886b0", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Bath", - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_bath", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1280, - "y": 80, - "wires": [ - [ - "ed2d549e91e1399d" - ] - ] - }, - { - "id": "b8f30c8224cf9d74", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathmode ", - "info": "", - "x": 120, - "y": 60, - "wires": [] - }, - { - "id": "eab005bf8b682c46", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Noone bathing?", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "off", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_boolean.bath_mode", - "state_type": "str", - "blockInputOverrides": true, - "outputProperties": [], - "for": "0", - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 440, - "y": 220, - "wires": [ - [ - "13c933aa7d791e63" - ], - [] - ] - }, - { - "id": "cbba47369f1e6479", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait 1:30 min", - "op1": "", - "op2": "90", - "op1type": "nul", - "op2type": "num", - "duration": "90", - "extend": false, - "overrideDelay": false, - "units": "s", - "reset": "on", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 640, - "y": 660, - "wires": [ - [ - "e12d8801b6c6f320" - ] - ] - }, - { - "id": "580c3afd65deefed", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 2:00 min", - "op1": "", - "op2": "120", - "op1type": "nul", - "op2type": "num", - "duration": "120", - "extend": false, - "overrideDelay": false, - "units": "s", - "reset": "on", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 650, - "y": 620, - "wires": [ - [ - "e12d8801b6c6f320" - ] - ] - }, - { - "id": "26f9395831aa077c", - "type": "change", - "z": "c7f876875da48b87", - "name": "Flash at brightness 100%", - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1250, - "y": 800, - "wires": [ - [ - "b1e7dd85582b7d3e" - ] - ] - }, - { - "id": "b1e7dd85582b7d3e", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Execute effect on lights bathroom", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "light.turn_on", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "light.bathroom_lights" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "light", - "service": "turn_on", - "output_location": "", - "output_location_type": "none", - "x": 1580, - "y": 800, - "wires": [ - [] - ] - }, - { - "id": "07d4571f236fd04b", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Noone bathing?", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "off", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_boolean.bath_mode", - "state_type": "str", - "blockInputOverrides": true, - "outputProperties": [], - "for": "0", - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 1100, - "y": 640, - "wires": [ - [ - "bthrm_presence_acs_01" - ], - [] - ] - }, - { - "id": "a8ad8572dc926e44", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off lights bathroom", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "light.turn_off", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "light.bathroom_lights" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "light", - "service": "turn_off", - "output_location": "", - "output_location_type": "none", - "x": 1550, - "y": 740, - "wires": [ - [] - ] - }, - { - "id": "52af4ffdf85f60e4", - "type": "change", - "z": "c7f876875da48b87", - "name": "Store motion off time", - "rules": [ - { - "t": "set", - "p": "motion_off_at", - "pt": "msg", - "to": "data.last_changed", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 340, - "y": 600, - "wires": [ - [ - "580c3afd65deefed", - "cbba47369f1e6479" - ] - ] - }, - { - "id": "e12d8801b6c6f320", - "type": "change", - "z": "c7f876875da48b87", - "name": "Store which delay", - "rules": [ - { - "t": "set", - "p": "delay", - "pt": "msg", - "to": "payload", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 890, - "y": 640, - "wires": [ - [ - "07d4571f236fd04b" - ] - ] - }, - { - "id": "bbd7dc3adff7b866", - "type": "switch", - "z": "c7f876875da48b87", - "name": "2:00 or 1:30 min delay", - "property": "delay", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "120", - "vt": "num" - }, - { - "t": "eq", - "v": "90", - "vt": "num" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 900, - "y": 740, - "wires": [ - [ - "a8ad8572dc926e44" - ], - [ - "26f9395831aa077c" - ] - ] - }, - { - "id": "f4a8732084a282d7", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 5 hours", - "op1": "", - "op2": "", - "op1type": "nul", - "op2type": "num", - "duration": "5", - "extend": false, - "overrideDelay": false, - "units": "hr", - "reset": "off", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 640, - "y": 520, - "wires": [ - [ - "4b98e17771cc3851" - ] - ] - }, - { - "id": "4b98e17771cc3851", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off bath mode", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "input_boolean.turn_off", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "input_boolean.bath_mode" - ], - "labelId": [], - "data": "", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "input_boolean", - "service": "turn_off", - "output_location": "", - "output_location_type": "none", - "x": 890, - "y": 520, - "wires": [ - [] - ] - }, - { - "id": "bb74897476a1a5e6", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Automatic turn off bath mode after X hours", - "info": "", - "x": 720, - "y": 480, - "wires": [] - }, - { - "id": "f1a2b3c4d5e60001", - "type": "function", - "z": "c7f876875da48b87", - "name": "Rise >= 3% in 2 min?", - "func": "const readings = context.get('readings') || [];\nconst lastTriggered = context.get('lastTriggered') || 0;\nconst now = Date.now();\nconst current = parseFloat(msg.payload);\n\nif (isNaN(current)) {\n node.error('Humidity sensor non-numeric value: ' + msg.payload, msg);\n return null;\n}\n\n// 15-minute cooldown after triggering\nif (now - lastTriggered < 15 * 60 * 1000) return null;\n\nreadings.push({ time: now, value: current });\nconst windowMs = 2 * 60 * 1000;\nconst filtered = readings.filter(r => r.time >= now - windowMs);\ncontext.set('readings', filtered);\n\nif (filtered.length < 2) return null;\n\nconst minInWindow = Math.min(...filtered.map(r => r.value));\nconst rise = current - minInWindow;\n\nif (rise >= 3) {\n context.set('lastTriggered', now);\n context.set('readings', []);\n flow.set('humidityBaseline', minInWindow);\n return msg;\n}\nreturn null;", - "outputs": 1, - "timeout": 0, - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 500, - "y": 1140, - "wires": [ - [ - "b2a9a137a909e257" - ] - ] - }, - { - "id": "d6e7f8a9b0c10002", - "type": "function", - "z": "c7f876875da48b87", - "name": "Below baseline + 5%?", - "func": "const current = parseFloat(msg.payload);\nconst baseline = flow.get(\"humidityBaseline\") || 60;\nconst threshold = baseline + 5;\n\nif (current <= threshold) {\n return [msg, null];\n}\nreturn [null, msg];", - "outputs": 2, - "timeout": 0, - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 1280, - "y": 980, - "wires": [ - [ - "27d9e5846a679b8b" - ], - [ - "7e4f4bb9c0c9ef2b" - ] - ] - }, - { - "id": "bthrm_timebased_01", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom time-based turn on", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 1, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "input_button.bathroom_time_based_turn_on" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": "", - "forType": "num", - "forUnits": "milliseconds", - "ignorePrevStateNull": false, - "ignorePrevStateUnknown": false, - "ignorePrevStateUnavailable": false, - "ignoreCurrentStateUnknown": true, - "ignoreCurrentStateUnavailable": true, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 180, - "y": 140, - "wires": [ - [ - "13c933aa7d791e63" - ] - ] - }, - { - "id": "bath_br_state_01", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Bedroom ceiling brightness", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 1, - "halt_if": "", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "light.bedroom_main", - "state_type": "str", - "blockInputOverrides": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "entity" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "x": 940, - "y": 220, - "wires": [ - [ - "bath_br_switch_01" - ] - ] - }, - { - "id": "bath_br_switch_01", - "type": "switch", - "z": "c7f876875da48b87", - "name": "Bedroom brightness > 50%?", - "property": "data.attributes.brightness", - "propertyType": "msg", - "rules": [ - { - "t": "gt", - "v": "128", - "vt": "num" - }, - { - "t": "else" - } - ], - "checkall": "false", - "repair": false, - "outputs": 2, - "x": 940, - "y": 280, - "wires": [ - [ - "1ae97faec6bec4ae" - ], - [ - "ddf62bacca5574f6" - ] - ] - }, - { - "id": "errc7f87687_c", - "type": "catch", - "z": "c7f876875da48b87", - "name": "Tab errors", - "scope": null, - "uncaught": false, - "x": 120, - "y": 940, - "wires": [ - [ - "errc7f87687_f" - ] - ] - }, - { - "id": "errc7f87687_f", - "type": "function", - "z": "c7f876875da48b87", - "name": "Format error", - "func": "const e = msg.error && msg.error.message ? msg.error.message : String(msg.error || \"Unknown error\");\nmsg.payload = JSON.stringify({ message: e, title: \"NR Error: Bathroom\", data: { priority: 1 } });\nreturn msg;", - "outputs": 1, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 360, - "y": 940, - "wires": [ - [ - "errc7f87687_s" - ] - ] - }, - { - "id": "errc7f87687_s", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "gotify_nodered", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "areaId": [], - "deviceId": [], - "entityId": [], - "data": "{{{payload}}}", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "domain": "notify", - "service": "gotify_nodered", - "x": 600, - "y": 940, - "wires": [ - [] - ] - }, - { - "id": "bthrm_audio_cmt_01", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Shower → Audio Volume Sync", - "info": "", - "x": 190, - "y": 1220, - "wires": [] - }, - { - "id": "bthrm_audio_ssc_01", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom fan turned off", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "switch.bathroom_switch_right" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "off", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": 0, - "forType": "num", - "forUnits": "minutes", - "ignorePrevStateNull": false, - "ignorePrevStateUnknown": false, - "ignorePrevStateUnavailable": false, - "ignoreCurrentStateUnknown": true, - "ignoreCurrentStateUnavailable": true, - "outputProperties": [ - { - "property": "fan_state", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - } - ], - "x": 160, - "y": 1260, - "wires": [ - [ - "bthrm_audio_acs_01", - "bthrm_fan_hard_rst_01" - ], - [] - ] - }, - { - "id": "bthrm_audio_acs_01", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Get bathroom speaker state", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "playing", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "media_player.bathroom", - "state_type": "str", - "blockInputOverrides": false, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "entity" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "override_topic": false, - "state_location": "payload", - "override_payload": "msg", - "entity_location": "data", - "override_data": "msg", - "x": 620, - "y": 1280, - "wires": [ - [ - "bthrm_audio_swt_vol_01" - ], - [] - ] - }, - { - "id": "bthrm_audio_swt_vol_01", - "type": "switch", - "z": "c7f876875da48b87", - "name": "Volume > 0?", - "property": "data.attributes.volume_level", - "propertyType": "msg", - "rules": [ - { - "t": "gt", - "v": "0", - "vt": "num" - }, - { - "t": "else" - } - ], - "checkall": "false", - "repair": false, - "outputs": 2, - "x": 930, - "y": 1320, - "wires": [ - [ - "bthrm_audio_swt_fan_01" - ], - [] - ] - }, - { - "id": "bthrm_audio_swt_fan_01", - "type": "switch", - "z": "c7f876875da48b87", - "name": "Fan on or off?", - "property": "fan_state", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "on", - "vt": "str" - }, - { - "t": "else" - } - ], - "checkall": "false", - "repair": false, - "outputs": 2, - "x": 1140, - "y": 1320, - "wires": [ - [ - "bthrm_audio_chg_up_01" - ], - [ - "bthrm_audio_chg_dn_01" - ] - ] - }, - { - "id": "bthrm_audio_chg_up_01", - "type": "change", - "z": "c7f876875da48b87", - "name": "Volume +0.05", - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "$min(0.28, $round((data.attributes.volume_level + 0.05) * 100) / 100)", - "tot": "jsonata" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1380, - "y": 1280, - "wires": [ - [ - "bthrm_audio_svc_01" - ] - ] - }, - { - "id": "bthrm_audio_chg_dn_01", - "type": "change", - "z": "c7f876875da48b87", - "name": "Volume -0.05", - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "$max(0, $round((data.attributes.volume_level - 0.05) * 100) / 100)", - "tot": "jsonata" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1370, - "y": 1360, - "wires": [ - [ - "bthrm_audio_svc_01" - ] - ] - }, - { - "id": "bthrm_audio_svc_01", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Set bathroom speaker volume", - "server": "657c7463.48e1e4", - "version": 7, - "debugenabled": false, - "action": "media_player.volume_set", - "floorId": [], - "areaId": [], - "deviceId": [], - "entityId": [ - "media_player.bathroom" - ], - "labelId": [], - "data": "{\"volume_level\": {{{payload}}}}", - "dataType": "json", - "mergeContext": "", - "mustacheAltTags": false, - "outputProperties": [], - "queue": "none", - "blockInputOverrides": false, - "domain": "media_player", - "service": "volume_set", - "output_location": "", - "output_location_type": "none", - "x": 1670, - "y": 1320, - "wires": [ - [] - ] - }, - { - "id": "bthrm_audio_ssc_02", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom music playing", - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "media_player.bathroom" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "playing", - "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": "string", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 160, - "y": 1340, - "wires": [ - [ - "bthrm_audio_acs_fan_01" - ], - [] - ] - }, - { - "id": "bthrm_audio_acs_fan_01", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Get fan state", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 1, - "halt_if": "", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "switch.bathroom_switch_right", - "state_type": "str", - "blockInputOverrides": false, - "outputProperties": [ - { - "property": "fan_state", - "propertyType": "msg", - "value": "string", - "valueType": "entityState" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "x": 570, - "y": 1340, - "wires": [ - [ - "bthrm_audio_swt_vol_01" - ] - ] - }, - { - "id": "bthrm_presence_acs_01", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Still in bathroom?", - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "Bathroom", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "input_select.room_presence", - "state_type": "str", - "blockInputOverrides": false, - "outputProperties": [], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "x": 1370, - "y": 640, - "wires": [ - [], - [ - "bbd7dc3adff7b866" - ] - ] - }, - { - "id": "bthrm_fan_hard_cmt", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Hard cutoff: max 45 min fan runtime", - "info": "", - "x": 200, - "y": 1100, - "wires": [] - }, - { - "id": "bthrm_fan_hard_01", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Hard cutoff 45 min", - "op1": "", - "op2": "cutoff", - "op1type": "nul", - "op2type": "str", - "duration": "2700", - "extend": false, - "overrideDelay": false, - "units": "s", - "reset": "", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 990, - "y": 1120, - "wires": [ - [ - "27d9e5846a679b8b" - ] - ] - }, - { - "id": "bthrm_fan_hard_rst_01", - "type": "change", - "z": "c7f876875da48b87", - "name": "Set msg.reset=true", - "rules": [ - { - "t": "set", - "p": "reset", - "pt": "msg", - "to": "true", - "tot": "bool" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 490, - "y": 1200, - "wires": [ - [ - "bthrm_fan_hard_01", - "7e4f4bb9c0c9ef2b" - ] - ] } ] \ No newline at end of file