diff --git a/flows.json b/flows.json index 8fcb2ef..6d540ff 100644 --- a/flows.json +++ b/flows.json @@ -3179,1481 +3179,6 @@ "x": 2340, "y": 720 }, - { - "id": "c7f876875da48b87", - "type": "tab", - "label": "Bathroom" - }, - { - "id": "13c933aa7d791e63", - "type": "subflow:52430f5e9f9ee267", - "z": "c7f876875da48b87", - "name": "", - "wires": [ - [ - "cc46642a3ea04954" - ], - [ - "cc46642a3ea04954" - ], - [ - "cc46642a3ea04954" - ], - [ - "1ae97faec6bec4ae" - ], - [ - "1ae97faec6bec4ae" - ], - [ - "bath_br_state_01" - ] - ], - "x": 670, - "y": 160 - }, - { - "id": "8ff99e0276ad242f", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait 4:30 min", - "wires": [ - [ - "ce6d7cb10437a4ac" - ] - ], - "op1": "", - "op2": "270", - "op1type": "nul", - "op2type": "num", - "duration": "270", - "extend": true, - "overrideDelay": false, - "units": "s", - "reset": "on", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 600, - "y": 360 - }, - { - "id": "a2887d07baac63d5", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 5:00 min", - "wires": [ - [ - "ce6d7cb10437a4ac" - ] - ], - "op1": "", - "op2": "300", - "op1type": "nul", - "op2type": "num", - "duration": "300", - "extend": true, - "overrideDelay": false, - "units": "s", - "reset": "on", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 610, - "y": 320 - }, - { - "id": "173369324c7a842c", - "type": "change", - "z": "c7f876875da48b87", - "name": "Flash at brightness 100%", - "wires": [ - [ - "3013e31f0b3d9303" - ] - ], - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1150, - "y": 440 - }, - { - "id": "812f8294add5575c", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom lights on", - "wires": [ - [ - "eab005bf8b682c46" - ], - [] - ], - "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 - }, - { - "id": "23f3fd10ac242022", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom Humidity Changed", - "wires": [ - [ - "f1a2b3c4d5e60001" - ], - [] - ], - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "", - "entities": { - "entity": [ - "sensor.bathroom_temperature_humidity" - ], - "substring": [], - "regex": [] - }, - "outputInitially": true, - "stateType": "num", - "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": 1040 - }, - { - "id": "b2a9a137a909e257", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn on fan", - "wires": [ - [] - ], - "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": [], - "queue": "all", - "blockInputOverrides": false, - "domain": "switch", - "service": "turn_on", - "x": 670, - "y": 1040 - }, - { - "id": "7e4f4bb9c0c9ef2b", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 5:00", - "wires": [ - [ - "82599133dd2b9883" - ] - ], - "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": 670, - "y": 1120 - }, - { - "id": "82599133dd2b9883", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Get Bathroom Humidity", - "wires": [ - [ - "d6e7f8a9b0c10002" - ], - [] - ], - "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": "num", - "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": 950, - "y": 1120 - }, - { - "id": "27d9e5846a679b8b", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off fan", - "wires": [ - [] - ], - "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", - "x": 1510, - "y": 1120 - }, - { - "id": "4548a32796918fd8", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathroom ventilator automation shower", - "wires": [], - "info": "", - "x": 210, - "y": 1000 - }, - { - "id": "3d44cb85e182a197", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom fan turned on", - "wires": [ - [ - "7e4f4bb9c0c9ef2b" - ], - [] - ], - "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": 1120 - }, - { - "id": "ebb5b8c2c3eb6ff5", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom motion sensor on", - "wires": [ - [ - "eab005bf8b682c46", - "a2887d07baac63d5", - "8ff99e0276ad242f", - "580c3afd65deefed", - "cbba47369f1e6479" - ], - [ - "a2887d07baac63d5", - "8ff99e0276ad242f", - "52af4ffdf85f60e4" - ] - ], - "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 - }, - { - "id": "cc46642a3ea04954", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Bright", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_bright", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1010, - "y": 120 - }, - { - "id": "ed2d549e91e1399d", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn on Scene", - "wires": [ - [] - ], - "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", - "x": 1560, - "y": 100 - }, - { - "id": "1ae97faec6bec4ae", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Evening", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_evening", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1010, - "y": 160 - }, - { - "id": "ddf62bacca5574f6", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Night", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_night", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1000, - "y": 200 - }, - { - "id": "3013e31f0b3d9303", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Execute effect on lights bathroom", - "wires": [ - [] - ], - "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", - "x": 1540, - "y": 440 - }, - { - "id": "bdccd31c131b65fb", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathroom automated lights", - "wires": [], - "info": "", - "x": 170, - "y": 200 - }, - { - "id": "a9f5122a5704e0e2", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Noone bathing?", - "wires": [ - [ - "ff97c96955f8d423" - ], - [] - ], - "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": 1040, - "y": 340 - }, - { - "id": "38ff5b8ecfcbfdd0", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathmode turned on", - "wires": [ - [ - "20da8eedd69886b0", - "f4a8732084a282d7" - ], - [ - "13c933aa7d791e63" - ] - ], - "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": false, - "ignoreCurrentStateUnavailable": false, - "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 - }, - { - "id": "20da8eedd69886b0", - "type": "change", - "z": "c7f876875da48b87", - "name": "Scene Bathroom Bath", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], - "rules": [ - { - "t": "set", - "p": "entity_id", - "pt": "msg", - "to": "scene.bathroom_bath", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1000, - "y": 80 - }, - { - "id": "b8f30c8224cf9d74", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Bathmode ", - "wires": [], - "info": "", - "x": 120, - "y": 60 - }, - { - "id": "eab005bf8b682c46", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Noone bathing?", - "wires": [ - [ - "13c933aa7d791e63" - ], - [] - ], - "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 - }, - { - "id": "97b500f5140c1dc1", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off lights bathroom", - "wires": [ - [] - ], - "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", - "x": 1510, - "y": 380 - }, - { - "id": "ce6d7cb10437a4ac", - "type": "change", - "z": "c7f876875da48b87", - "name": "Store which delay", - "wires": [ - [ - "a9f5122a5704e0e2" - ] - ], - "rules": [ - { - "t": "set", - "p": "delay", - "pt": "msg", - "to": "payload", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 830, - "y": 340 - }, - { - "id": "ff97c96955f8d423", - "type": "switch", - "z": "c7f876875da48b87", - "name": "5:00 or 4:30 min delay", - "wires": [ - [ - "97b500f5140c1dc1" - ], - [ - "173369324c7a842c" - ] - ], - "property": "delay", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "300", - "vt": "num" - }, - { - "t": "eq", - "v": "270", - "vt": "num" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 840, - "y": 420 - }, - { - "id": "cbba47369f1e6479", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait 1:30 min", - "wires": [ - [ - "e12d8801b6c6f320" - ] - ], - "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 - }, - { - "id": "580c3afd65deefed", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 2:00 min", - "wires": [ - [ - "e12d8801b6c6f320" - ] - ], - "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 - }, - { - "id": "26f9395831aa077c", - "type": "change", - "z": "c7f876875da48b87", - "name": "Flash at brightness 100%", - "wires": [ - [ - "b1e7dd85582b7d3e" - ] - ], - "rules": [ - { - "t": "set", - "p": "payload", - "pt": "msg", - "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", - "tot": "str" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 1270, - "y": 820 - }, - { - "id": "b1e7dd85582b7d3e", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Execute effect on lights bathroom", - "wires": [ - [] - ], - "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", - "x": 1580, - "y": 820 - }, - { - "id": "07d4571f236fd04b", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Noone bathing?", - "wires": [ - [ - "32e3e60ad0e0d9a1" - ], - [] - ], - "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 - }, - { - "id": "a8ad8572dc926e44", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off lights bathroom", - "wires": [ - [] - ], - "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", - "x": 1550, - "y": 760 - }, - { - "id": "ade1222fab2ea469", - "type": "inject", - "z": "c7f876875da48b87", - "name": "", - "wires": [ - [ - "32e3e60ad0e0d9a1" - ] - ], - "props": [ - { - "p": "payload" - }, - { - "p": "topic", - "vt": "str" - } - ], - "repeat": "", - "crontab": "", - "once": false, - "onceDelay": 0.1, - "topic": "", - "payload": "", - "payloadType": "date", - "x": 140, - "y": 740 - }, - { - "id": "32e3e60ad0e0d9a1", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Bathroom door closed?", - "wires": [ - [], - [ - "bbd7dc3adff7b866" - ] - ], - "server": "657c7463.48e1e4", - "version": 3, - "outputs": 2, - "halt_if": "off", - "halt_if_type": "str", - "halt_if_compare": "is", - "entity_id": "binary_sensor.bathroom_door_contact", - "state_type": "str", - "blockInputOverrides": true, - "outputProperties": [ - { - "property": "payload", - "propertyType": "msg", - "value": "", - "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": 1350, - "y": 640 - }, - { - "id": "52af4ffdf85f60e4", - "type": "change", - "z": "c7f876875da48b87", - "name": "Store motion off time", - "wires": [ - [ - "580c3afd65deefed", - "cbba47369f1e6479" - ] - ], - "rules": [ - { - "t": "set", - "p": "motion_off_at", - "pt": "msg", - "to": "data.last_changed", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 400, - "y": 680 - }, - { - "id": "e12d8801b6c6f320", - "type": "change", - "z": "c7f876875da48b87", - "name": "Store which delay", - "wires": [ - [ - "07d4571f236fd04b" - ] - ], - "rules": [ - { - "t": "set", - "p": "delay", - "pt": "msg", - "to": "payload", - "tot": "msg" - } - ], - "action": "", - "property": "", - "from": "", - "to": "", - "reg": false, - "x": 890, - "y": 640 - }, - { - "id": "bbd7dc3adff7b866", - "type": "switch", - "z": "c7f876875da48b87", - "name": "2:00 or 1:30 min delay", - "wires": [ - [ - "a8ad8572dc926e44" - ], - [ - "26f9395831aa077c" - ] - ], - "property": "delay", - "propertyType": "msg", - "rules": [ - { - "t": "eq", - "v": "120", - "vt": "num" - }, - { - "t": "eq", - "v": "90", - "vt": "num" - } - ], - "checkall": "true", - "repair": false, - "outputs": 2, - "x": 940, - "y": 780 - }, - { - "id": "f4a8732084a282d7", - "type": "trigger", - "z": "c7f876875da48b87", - "name": "Wait for 5 hours", - "wires": [ - [ - "4b98e17771cc3851" - ] - ], - "op1": "", - "op2": "", - "op1type": "nul", - "op2type": "num", - "duration": "5", - "extend": false, - "overrideDelay": false, - "units": "hr", - "reset": "off", - "bytopic": "all", - "topic": "topic", - "outputs": 1, - "x": 600, - "y": 520 - }, - { - "id": "4b98e17771cc3851", - "type": "api-call-service", - "z": "c7f876875da48b87", - "name": "Turn off bath mode", - "wires": [ - [] - ], - "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", - "x": 850, - "y": 520 - }, - { - "id": "bb74897476a1a5e6", - "type": "comment", - "z": "c7f876875da48b87", - "name": "Automatic turn off bath mode after X hours", - "wires": [], - "info": "", - "x": 220, - "y": 480 - }, - { - "id": "f1a2b3c4d5e60001", - "type": "function", - "z": "c7f876875da48b87", - "name": "Rise >= 3% in 2 min?", - "wires": [ - [ - "b2a9a137a909e257" - ] - ], - "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)) return null;\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": 460, - "y": 1040 - }, - { - "id": "d6e7f8a9b0c10002", - "type": "function", - "z": "c7f876875da48b87", - "name": "Below baseline + 5%?", - "wires": [ - [ - "27d9e5846a679b8b" - ], - [ - "7e4f4bb9c0c9ef2b" - ] - ], - "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": 1240, - "y": 1120 - }, - { - "id": "bthrm_timebased_01", - "type": "server-state-changed", - "z": "c7f876875da48b87", - "name": "Bathroom time-based turn on", - "wires": [ - [ - "13c933aa7d791e63", - "a2887d07baac63d5", - "8ff99e0276ad242f" - ] - ], - "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": "", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "eventData" - }, - { - "property": "topic", - "propertyType": "msg", - "value": "", - "valueType": "triggerId" - } - ], - "x": 180, - "y": 140 - }, - { - "id": "bath_br_state_01", - "type": "api-current-state", - "z": "c7f876875da48b87", - "name": "Bedroom ceiling brightness", - "wires": [ - [ - "bath_br_switch_01" - ] - ], - "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": "", - "valueType": "entityState" - }, - { - "property": "data", - "propertyType": "msg", - "value": "", - "valueType": "entity" - } - ], - "for": 0, - "forType": "num", - "forUnits": "minutes", - "x": 830, - "y": 240 - }, - { - "id": "bath_br_switch_01", - "type": "switch", - "z": "c7f876875da48b87", - "name": "Bedroom brightness > 50%?", - "wires": [ - [ - "1ae97faec6bec4ae" - ], - [ - "ddf62bacca5574f6" - ] - ], - "property": "data.attributes.brightness", - "propertyType": "msg", - "rules": [ - { - "t": "gt", - "v": "128", - "vt": "num" - }, - { - "t": "else" - } - ], - "checkall": "false", - "repair": false, - "outputs": 2, - "x": 1080, - "y": 240 - }, { "id": "6dfa989bb120e6c6", "type": "tab", @@ -23245,5 +21770,1546 @@ "output_location_type": "none", "x": 660, "y": 3860 + }, + { + "type": "tab", + "label": "Bathroom", + "id": "c7f876875da48b87" + }, + { + "id": "13c933aa7d791e63", + "type": "subflow:52430f5e9f9ee267", + "z": "c7f876875da48b87", + "name": "", + "wires": [ + [ + "cc46642a3ea04954" + ], + [ + "cc46642a3ea04954" + ], + [ + "cc46642a3ea04954" + ], + [ + "1ae97faec6bec4ae" + ], + [ + "1ae97faec6bec4ae" + ], + [ + "bath_br_state_01" + ] + ], + "x": 670, + "y": 160 + }, + { + "id": "8ff99e0276ad242f", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait 4:30 min", + "wires": [ + [ + "ce6d7cb10437a4ac" + ] + ], + "op1": "", + "op2": "270", + "op1type": "nul", + "op2type": "num", + "duration": "270", + "extend": true, + "overrideDelay": false, + "units": "s", + "reset": "on", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 600, + "y": 360 + }, + { + "id": "a2887d07baac63d5", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 5:00 min", + "wires": [ + [ + "ce6d7cb10437a4ac" + ] + ], + "op1": "", + "op2": "300", + "op1type": "nul", + "op2type": "num", + "duration": "300", + "extend": true, + "overrideDelay": false, + "units": "s", + "reset": "on", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 610, + "y": 320 + }, + { + "id": "173369324c7a842c", + "type": "change", + "z": "c7f876875da48b87", + "name": "Flash at brightness 100%", + "wires": [ + [ + "3013e31f0b3d9303" + ] + ], + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1150, + "y": 440 + }, + { + "id": "812f8294add5575c", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom lights on", + "wires": [ + [ + "eab005bf8b682c46" + ], + [] + ], + "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 + }, + { + "id": "23f3fd10ac242022", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom Humidity Changed", + "wires": [ + [ + "f1a2b3c4d5e60001" + ], + [] + ], + "server": "657c7463.48e1e4", + "version": 6, + "outputs": 2, + "exposeAsEntityConfig": "", + "entities": { + "entity": [ + "sensor.bathroom_temperature_humidity" + ], + "substring": [], + "regex": [] + }, + "outputInitially": true, + "stateType": "num", + "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": 1040 + }, + { + "id": "b2a9a137a909e257", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn on fan", + "wires": [ + [] + ], + "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": [], + "queue": "all", + "blockInputOverrides": false, + "domain": "switch", + "service": "turn_on", + "x": 670, + "y": 1040 + }, + { + "id": "7e4f4bb9c0c9ef2b", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 5:00", + "wires": [ + [ + "82599133dd2b9883" + ] + ], + "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": 670, + "y": 1120 + }, + { + "id": "82599133dd2b9883", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Get Bathroom Humidity", + "wires": [ + [ + "d6e7f8a9b0c10002" + ], + [] + ], + "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": "num", + "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": 950, + "y": 1120 + }, + { + "id": "27d9e5846a679b8b", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off fan", + "wires": [ + [] + ], + "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", + "x": 1510, + "y": 1120 + }, + { + "id": "4548a32796918fd8", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathroom ventilator automation shower", + "wires": [], + "info": "", + "x": 210, + "y": 1000 + }, + { + "id": "3d44cb85e182a197", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom fan turned on", + "wires": [ + [ + "7e4f4bb9c0c9ef2b" + ], + [] + ], + "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": 1120 + }, + { + "id": "ebb5b8c2c3eb6ff5", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom motion sensor on", + "wires": [ + [ + "eab005bf8b682c46", + "a2887d07baac63d5", + "8ff99e0276ad242f", + "580c3afd65deefed", + "cbba47369f1e6479" + ], + [ + "a2887d07baac63d5", + "8ff99e0276ad242f", + "52af4ffdf85f60e4" + ] + ], + "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 + }, + { + "id": "cc46642a3ea04954", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Bright", + "wires": [ + [ + "ed2d549e91e1399d" + ] + ], + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_bright", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1010, + "y": 120 + }, + { + "id": "ed2d549e91e1399d", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn on Scene", + "wires": [ + [] + ], + "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", + "x": 1560, + "y": 100 + }, + { + "id": "1ae97faec6bec4ae", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Evening", + "wires": [ + [ + "ed2d549e91e1399d" + ] + ], + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_evening", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1010, + "y": 160 + }, + { + "id": "ddf62bacca5574f6", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Night", + "wires": [ + [ + "ed2d549e91e1399d" + ] + ], + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_night", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1000, + "y": 200 + }, + { + "id": "3013e31f0b3d9303", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Execute effect on lights bathroom", + "wires": [ + [] + ], + "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", + "x": 1540, + "y": 440 + }, + { + "id": "bdccd31c131b65fb", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathroom automated lights", + "wires": [], + "info": "", + "x": 170, + "y": 200 + }, + { + "id": "a9f5122a5704e0e2", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Noone bathing?", + "wires": [ + [ + "ff97c96955f8d423" + ], + [] + ], + "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": 1040, + "y": 340 + }, + { + "id": "38ff5b8ecfcbfdd0", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathmode turned on", + "wires": [ + [ + "20da8eedd69886b0", + "f4a8732084a282d7" + ], + [ + "13c933aa7d791e63" + ] + ], + "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": false, + "ignoreCurrentStateUnavailable": false, + "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 + }, + { + "id": "20da8eedd69886b0", + "type": "change", + "z": "c7f876875da48b87", + "name": "Scene Bathroom Bath", + "wires": [ + [ + "ed2d549e91e1399d" + ] + ], + "rules": [ + { + "t": "set", + "p": "entity_id", + "pt": "msg", + "to": "scene.bathroom_bath", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1000, + "y": 80 + }, + { + "id": "b8f30c8224cf9d74", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Bathmode ", + "wires": [], + "info": "", + "x": 120, + "y": 60 + }, + { + "id": "eab005bf8b682c46", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Noone bathing?", + "wires": [ + [ + "13c933aa7d791e63" + ], + [] + ], + "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 + }, + { + "id": "97b500f5140c1dc1", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off lights bathroom", + "wires": [ + [] + ], + "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", + "x": 1510, + "y": 380 + }, + { + "id": "ce6d7cb10437a4ac", + "type": "change", + "z": "c7f876875da48b87", + "name": "Store which delay", + "wires": [ + [ + "a9f5122a5704e0e2" + ] + ], + "rules": [ + { + "t": "set", + "p": "delay", + "pt": "msg", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 830, + "y": 340 + }, + { + "id": "ff97c96955f8d423", + "type": "switch", + "z": "c7f876875da48b87", + "name": "5:00 or 4:30 min delay", + "wires": [ + [ + "97b500f5140c1dc1" + ], + [ + "173369324c7a842c" + ] + ], + "property": "delay", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "300", + "vt": "num" + }, + { + "t": "eq", + "v": "270", + "vt": "num" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 840, + "y": 420 + }, + { + "id": "cbba47369f1e6479", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait 1:30 min", + "wires": [ + [ + "e12d8801b6c6f320" + ] + ], + "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 + }, + { + "id": "580c3afd65deefed", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 2:00 min", + "wires": [ + [ + "e12d8801b6c6f320" + ] + ], + "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 + }, + { + "id": "26f9395831aa077c", + "type": "change", + "z": "c7f876875da48b87", + "name": "Flash at brightness 100%", + "wires": [ + [ + "b1e7dd85582b7d3e" + ] + ], + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "{\"brightness_pct\":100,\"flash\":\"short\"}", + "tot": "str" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 1270, + "y": 820 + }, + { + "id": "b1e7dd85582b7d3e", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Execute effect on lights bathroom", + "wires": [ + [] + ], + "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", + "x": 1580, + "y": 820 + }, + { + "id": "07d4571f236fd04b", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Noone bathing?", + "wires": [ + [ + "32e3e60ad0e0d9a1" + ], + [] + ], + "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 + }, + { + "id": "a8ad8572dc926e44", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off lights bathroom", + "wires": [ + [] + ], + "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", + "x": 1550, + "y": 760 + }, + { + "id": "ade1222fab2ea469", + "type": "inject", + "z": "c7f876875da48b87", + "name": "", + "wires": [ + [ + "32e3e60ad0e0d9a1" + ] + ], + "props": [ + { + "p": "payload" + }, + { + "p": "topic", + "vt": "str" + } + ], + "repeat": "", + "crontab": "", + "once": false, + "onceDelay": 0.1, + "topic": "", + "payload": "", + "payloadType": "date", + "x": 140, + "y": 740 + }, + { + "id": "32e3e60ad0e0d9a1", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Bathroom door closed?", + "wires": [ + [], + [ + "bbd7dc3adff7b866" + ] + ], + "server": "657c7463.48e1e4", + "version": 3, + "outputs": 2, + "halt_if": "off", + "halt_if_type": "str", + "halt_if_compare": "is", + "entity_id": "binary_sensor.bathroom_door_contact", + "state_type": "str", + "blockInputOverrides": true, + "outputProperties": [ + { + "property": "payload", + "propertyType": "msg", + "value": "", + "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": 1350, + "y": 640 + }, + { + "id": "52af4ffdf85f60e4", + "type": "change", + "z": "c7f876875da48b87", + "name": "Store motion off time", + "wires": [ + [ + "580c3afd65deefed", + "cbba47369f1e6479" + ] + ], + "rules": [ + { + "t": "set", + "p": "motion_off_at", + "pt": "msg", + "to": "data.last_changed", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 400, + "y": 680 + }, + { + "id": "e12d8801b6c6f320", + "type": "change", + "z": "c7f876875da48b87", + "name": "Store which delay", + "wires": [ + [ + "07d4571f236fd04b" + ] + ], + "rules": [ + { + "t": "set", + "p": "delay", + "pt": "msg", + "to": "payload", + "tot": "msg" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 890, + "y": 640 + }, + { + "id": "bbd7dc3adff7b866", + "type": "switch", + "z": "c7f876875da48b87", + "name": "2:00 or 1:30 min delay", + "wires": [ + [ + "a8ad8572dc926e44" + ], + [ + "26f9395831aa077c" + ] + ], + "property": "delay", + "propertyType": "msg", + "rules": [ + { + "t": "eq", + "v": "120", + "vt": "num" + }, + { + "t": "eq", + "v": "90", + "vt": "num" + } + ], + "checkall": "true", + "repair": false, + "outputs": 2, + "x": 940, + "y": 780 + }, + { + "id": "f4a8732084a282d7", + "type": "trigger", + "z": "c7f876875da48b87", + "name": "Wait for 5 hours", + "wires": [ + [ + "4b98e17771cc3851" + ] + ], + "op1": "", + "op2": "", + "op1type": "nul", + "op2type": "num", + "duration": "5", + "extend": false, + "overrideDelay": false, + "units": "hr", + "reset": "off", + "bytopic": "all", + "topic": "topic", + "outputs": 1, + "x": 600, + "y": 520 + }, + { + "id": "4b98e17771cc3851", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Turn off bath mode", + "wires": [ + [] + ], + "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", + "x": 850, + "y": 520 + }, + { + "id": "bb74897476a1a5e6", + "type": "comment", + "z": "c7f876875da48b87", + "name": "Automatic turn off bath mode after X hours", + "wires": [], + "info": "", + "x": 220, + "y": 480 + }, + { + "id": "f1a2b3c4d5e60001", + "type": "function", + "z": "c7f876875da48b87", + "name": "Rise >= 3% in 2 min?", + "wires": [ + [ + "b2a9a137a909e257" + ] + ], + "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)) return null;\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": 460, + "y": 1040 + }, + { + "id": "d6e7f8a9b0c10002", + "type": "function", + "z": "c7f876875da48b87", + "name": "Below baseline + 5%?", + "wires": [ + [ + "27d9e5846a679b8b" + ], + [ + "7e4f4bb9c0c9ef2b" + ] + ], + "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": 1240, + "y": 1120 + }, + { + "id": "bthrm_timebased_01", + "type": "server-state-changed", + "z": "c7f876875da48b87", + "name": "Bathroom time-based turn on", + "wires": [ + [ + "13c933aa7d791e63", + "a2887d07baac63d5", + "8ff99e0276ad242f" + ] + ], + "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": "", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "eventData" + }, + { + "property": "topic", + "propertyType": "msg", + "value": "", + "valueType": "triggerId" + } + ], + "x": 180, + "y": 140 + }, + { + "id": "bath_br_state_01", + "type": "api-current-state", + "z": "c7f876875da48b87", + "name": "Bedroom ceiling brightness", + "wires": [ + [ + "bath_br_switch_01" + ] + ], + "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": "", + "valueType": "entityState" + }, + { + "property": "data", + "propertyType": "msg", + "value": "", + "valueType": "entity" + } + ], + "for": 0, + "forType": "num", + "forUnits": "minutes", + "x": 830, + "y": 240 + }, + { + "id": "bath_br_switch_01", + "type": "switch", + "z": "c7f876875da48b87", + "name": "Bedroom brightness > 50%?", + "wires": [ + [ + "1ae97faec6bec4ae" + ], + [ + "ddf62bacca5574f6" + ] + ], + "property": "data.attributes.brightness", + "propertyType": "msg", + "rules": [ + { + "t": "gt", + "v": "128", + "vt": "num" + }, + { + "t": "else" + } + ], + "checkall": "false", + "repair": false, + "outputs": 2, + "x": 1080, + "y": 240 + }, + { + "id": "p2catch_bth", + "type": "catch", + "z": "c7f876875da48b87", + "name": "Catch all errors", + "wires": [ + [ + "p2fmt_bth" + ] + ], + "scope": null, + "uncaught": false, + "x": 160, + "y": 1320 + }, + { + "id": "p2fmt_bth", + "type": "function", + "z": "c7f876875da48b87", + "name": "Format error", + "wires": [ + [ + "p2ntfy_bth" + ] + ], + "func": "const err = (msg.error && msg.error.message) ? msg.error.message : String(msg.payload || 'Unknown error');\nconst src = (msg.error && msg.error.source) ? (msg.error.source.name || msg.error.source.id || '') : '';\nmsg.payload = JSON.stringify({\n title: 'Node-RED Error: Bathroom',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "timeout": "", + "x": 400, + "y": 1320 + }, + { + "id": "p2ntfy_bth", + "type": "api-call-service", + "z": "c7f876875da48b87", + "name": "Notify error", + "wires": [ + [] + ], + "server": "657c7463.48e1e4", + "version": 7, + "debugenabled": false, + "action": "notify.gotify_ha", + "floorId": [], + "areaId": [], + "deviceId": [], + "entityId": [], + "labelId": [], + "data": "{{{payload}}}", + "dataType": "json", + "mergeContext": "", + "mustacheAltTags": false, + "outputProperties": [], + "queue": "none", + "blockInputOverrides": false, + "domain": "notify", + "service": "gotify_ha", + "output_location": "", + "output_location_type": "none", + "x": 660, + "y": 1320 } ] \ No newline at end of file