From d5274d40bec24e1ba182406e39dbce04e5bbf036 Mon Sep 17 00:00:00 2001 From: m038 Date: Thu, 28 May 2026 20:38:37 +0200 Subject: [PATCH] Update flow files --- flows.json | 8591 +++++++++++++++++++++++++--------------------------- 1 file changed, 4205 insertions(+), 4386 deletions(-) diff --git a/flows.json b/flows.json index ff8b3c6..bd64f60 100644 --- a/flows.json +++ b/flows.json @@ -13,6 +13,76 @@ } ] }, + { + "id": "600f7a12.5ee66c", + "type": "tab", + "label": "Security" + }, + { + "id": "75c53969.aa5438", + "type": "tab", + "label": "Wake up & mosquito" + }, + { + "id": "f02b32ef07b4b378", + "type": "tab", + "label": "Home Audio" + }, + { + "id": "da896085.24c698", + "type": "tab", + "label": "Home Media" + }, + { + "id": "a9edb9da.ccb6d", + "type": "tab", + "label": "Motion detection" + }, + { + "id": "a320f821a7cb3f55", + "type": "tab", + "label": "Maintenance" + }, + { + "id": "97e0f1338e182d76", + "type": "tab", + "label": "Bedroom" + }, + { + "id": "5af82cd4c44df066", + "type": "tab", + "label": "Kitchen" + }, + { + "id": "10cbea6aaac127cd", + "type": "tab", + "label": "Balcony" + }, + { + "id": "c19dee9f.e72838", + "type": "tab", + "label": "Hallway" + }, + { + "id": "1f4d4622.7490ca", + "type": "tab", + "label": "Temperature & climate" + }, + { + "id": "b70ee13eafa73823", + "type": "tab", + "label": "Living room" + }, + { + "id": "c7f876875da48b87", + "type": "tab", + "label": "Bathroom" + }, + { + "id": "6dfa989bb120e6c6", + "type": "tab", + "label": "Home Presence" + }, { "id": "e52c44dc.71cb5", "type": "subflow", @@ -295,9 +365,9 @@ { "id": "62ed34c9191cebca", "type": "ha-entity-config", - "name": "Kitchen Motion Sensor Flow", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "Kitchen Motion Sensor Flow", "version": "6", "entityType": "switch", "haConfig": [ @@ -328,8 +398,8 @@ { "id": "d51b5899.a2d5d8", "type": "mqtt-broker", - "name": "Mosquto Broker", "d": true, + "name": "Mosquto Broker", "broker": "192.168.1.6", "port": "1883", "clientid": "", @@ -359,9 +429,9 @@ "id": "cc000023", "type": "ha-entity-config", "z": "bbf25964.5edb38", - "name": "CC Delivery Date", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "CC Delivery Date", "version": "6", "entityType": "sensor", "haConfig": [ @@ -393,9 +463,9 @@ "id": "cc000025", "type": "ha-entity-config", "z": "bbf25964.5edb38", - "name": "CC Delivery Total", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "CC Delivery Total", "version": "6", "entityType": "sensor", "haConfig": [ @@ -427,9 +497,9 @@ "id": "cc000026", "type": "ha-entity-config", "z": "bbf25964.5edb38", - "name": "CC Send Now Button", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "CC Send Now Button", "version": "6", "entityType": "button", "haConfig": [ @@ -461,9 +531,9 @@ "id": "cc000027", "type": "ha-entity-config", "z": "bbf25964.5edb38", - "name": "CC Postpone 1 Week", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "CC Postpone 1 Week", "version": "6", "entityType": "button", "haConfig": [ @@ -495,9 +565,9 @@ "id": "cc000024", "type": "ha-entity-config", "z": "bbf25964.5edb38", - "name": "CC Delivery Product", "server": "657c7463.48e1e4", "deviceConfig": "", + "name": "CC Delivery Product", "version": "6", "entityType": "sensor", "haConfig": [ @@ -530,6 +600,8 @@ "type": "subflow:52430f5e9f9ee267", "z": "e52c44dc.71cb5", "name": "", + "x": 390, + "y": 140, "wires": [ [], [], @@ -537,18 +609,13 @@ [], [], [] - ], - "x": 390, - "y": 140 + ] }, { "id": "9e4fac23fd2c73ed", "type": "function", "z": "091c97d9c8d81499", "name": "Escape JSON string", - "wires": [ - [] - ], "func": "msg.payload = JSON.stringify(msg.payload).replace(/\"/g, '\\\"');\n\nreturn msg;", "outputs": 1, "noerr": 0, @@ -556,18 +623,16 @@ "finalize": "", "libs": [], "x": 320, - "y": 140 + "y": 140, + "wires": [ + [] + ] }, { "id": "910e431ab636c701", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Night Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -595,18 +660,18 @@ "forType": "num", "forUnits": "minutes", "x": 330, - "y": 260 + "y": 260, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "f4da808dc4c218b6", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Morning Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -634,18 +699,18 @@ "forType": "num", "forUnits": "minutes", "x": 340, - "y": 60 + "y": 60, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "25fe3f965108a4f8", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Evening Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -673,19 +738,18 @@ "forType": "num", "forUnits": "minutes", "x": 340, - "y": 180 + "y": 180, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "b1106a1c85cc30f3", "type": "join", "z": "52430f5e9f9ee267", "name": "Collect all times", - "wires": [ - [ - "4e491e57f35c4458", - "ca40f18fea0361e5" - ] - ], "mode": "custom", "build": "object", "property": "payload", @@ -702,18 +766,19 @@ "reduceInitType": "", "reduceFixup": "", "x": 750, - "y": 160 + "y": 160, + "wires": [ + [ + "4e491e57f35c4458", + "ca40f18fea0361e5" + ] + ] }, { "id": "1029462b97e1cc7c", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Midday Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -741,18 +806,18 @@ "forType": "num", "forUnits": "minutes", "x": 330, - "y": 100 + "y": 100, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "6a5d6248d66d5303", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Late Evening Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -780,18 +845,18 @@ "forType": "num", "forUnits": "minutes", "x": 350, - "y": 220 + "y": 220, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "c263329e3207423d", "type": "api-current-state", "z": "52430f5e9f9ee267", "name": "Late Afternoon Time", - "wires": [ - [ - "b1106a1c85cc30f3" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -819,18 +884,18 @@ "forType": "num", "forUnits": "minutes", "x": 360, - "y": 140 + "y": 140, + "wires": [ + [ + "b1106a1c85cc30f3" + ] + ] }, { "id": "4e491e57f35c4458", "type": "split", "z": "52430f5e9f9ee267", "name": "For each configured time", - "wires": [ - [ - "3cc1cd83a914fbed" - ] - ], "splt": "\\n", "spltType": "str", "arraySplt": 1, @@ -838,18 +903,18 @@ "stream": false, "addname": "topic", "x": 1070, - "y": 160 + "y": 160, + "wires": [ + [ + "3cc1cd83a914fbed" + ] + ] }, { "id": "d88527a4c0207c0c", "type": "join", "z": "52430f5e9f9ee267", "name": "Merge elements into single array", - "wires": [ - [ - "00fdb1bc99d82683" - ] - ], "mode": "custom", "build": "object", "property": "payload", @@ -866,18 +931,18 @@ "reduceInitType": "", "reduceFixup": "", "x": 1100, - "y": 360 + "y": 360, + "wires": [ + [ + "00fdb1bc99d82683" + ] + ] }, { "id": "3cc1cd83a914fbed", "type": "moment", "z": "52430f5e9f9ee267", "name": "Convert time to date time", - "wires": [ - [ - "558cbc9bafd7fda2" - ] - ], "topic": "", "input": "payload", "inputType": "msg", @@ -891,22 +956,18 @@ "outputType": "msg", "outTz": "Europe/Berlin", "x": 1070, - "y": 220 + "y": 220, + "wires": [ + [ + "558cbc9bafd7fda2" + ] + ] }, { "id": "558cbc9bafd7fda2", "type": "switch", "z": "52430f5e9f9ee267", "name": "Check additional date for night ", - "wires": [ - [ - "72abde726eb791b7", - "d88527a4c0207c0c" - ], - [ - "d88527a4c0207c0c" - ] - ], "property": "topic", "propertyType": "msg", "rules": [ @@ -923,18 +984,22 @@ "repair": false, "outputs": 2, "x": 1090, - "y": 280 + "y": 280, + "wires": [ + [ + "72abde726eb791b7", + "d88527a4c0207c0c" + ], + [ + "d88527a4c0207c0c" + ] + ] }, { "id": "72abde726eb791b7", "type": "moment", "z": "52430f5e9f9ee267", "name": "Create date time for night tomorrow", - "wires": [ - [ - "d88527a4c0207c0c" - ] - ], "topic": "night_tomorrow", "input": "payload", "inputType": "msg", @@ -948,39 +1013,18 @@ "outputType": "msg", "outTz": "Europe/Berlin", "x": 1460, - "y": 280 + "y": 280, + "wires": [ + [ + "d88527a4c0207c0c" + ] + ] }, { "id": "035b7bb98d69b0a0", "type": "switch", "z": "52430f5e9f9ee267", "name": "Compare times", - "wires": [ - [ - "25b5aff2dea58057" - ], - [ - "5f0e5f63552a97f2" - ], - [ - "b884e557f9524784" - ], - [ - "06f7380c6f28bdd1" - ], - [ - "41de38d16e68d1d9" - ], - [ - "4d992d3713228542" - ], - [ - "25b5aff2dea58057" - ], - [ - "5f0e5f63552a97f2" - ] - ], "property": "payload.now", "propertyType": "msg", "rules": [ @@ -1039,16 +1083,39 @@ "repair": false, "outputs": 8, "x": 1080, - "y": 520 + "y": 520, + "wires": [ + [ + "25b5aff2dea58057" + ], + [ + "5f0e5f63552a97f2" + ], + [ + "b884e557f9524784" + ], + [ + "06f7380c6f28bdd1" + ], + [ + "41de38d16e68d1d9" + ], + [ + "4d992d3713228542" + ], + [ + "25b5aff2dea58057" + ], + [ + "5f0e5f63552a97f2" + ] + ] }, { "id": "b884e557f9524784", "type": "change", "z": "52430f5e9f9ee267", "name": "It's morning", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1064,16 +1131,16 @@ "to": "", "reg": false, "x": 1490, - "y": 440 + "y": 440, + "wires": [ + [] + ] }, { "id": "06f7380c6f28bdd1", "type": "change", "z": "52430f5e9f9ee267", "name": "It's midday", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1089,16 +1156,16 @@ "to": "", "reg": false, "x": 1490, - "y": 480 + "y": 480, + "wires": [ + [] + ] }, { "id": "41de38d16e68d1d9", "type": "change", "z": "52430f5e9f9ee267", "name": "It's late afternoon", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1114,16 +1181,16 @@ "to": "", "reg": false, "x": 1510, - "y": 520 + "y": 520, + "wires": [ + [] + ] }, { "id": "4d992d3713228542", "type": "change", "z": "52430f5e9f9ee267", "name": "It's evening", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1139,16 +1206,16 @@ "to": "", "reg": false, "x": 1490, - "y": 560 + "y": 560, + "wires": [ + [] + ] }, { "id": "25b5aff2dea58057", "type": "change", "z": "52430f5e9f9ee267", "name": "It's late evening", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1164,16 +1231,16 @@ "to": "", "reg": false, "x": 1500, - "y": 600 + "y": 600, + "wires": [ + [] + ] }, { "id": "5f0e5f63552a97f2", "type": "change", "z": "52430f5e9f9ee267", "name": "It's night", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -1189,18 +1256,16 @@ "to": "", "reg": false, "x": 1480, - "y": 640 + "y": 640, + "wires": [ + [] + ] }, { "id": "ca40f18fea0361e5", "type": "moment", "z": "52430f5e9f9ee267", "name": "Add current date time", - "wires": [ - [ - "d88527a4c0207c0c" - ] - ], "topic": "now", "input": "", "inputType": "date", @@ -1214,18 +1279,18 @@ "outputType": "msg", "outTz": "Europe/Berlin", "x": 760, - "y": 220 + "y": 220, + "wires": [ + [ + "d88527a4c0207c0c" + ] + ] }, { "id": "00fdb1bc99d82683", "type": "change", "z": "52430f5e9f9ee267", "name": "Clean up msg object", - "wires": [ - [ - "035b7bb98d69b0a0" - ] - ], "rules": [ { "t": "delete", @@ -1244,21 +1309,18 @@ "to": "", "reg": false, "x": 1060, - "y": 420 + "y": 420, + "wires": [ + [ + "035b7bb98d69b0a0" + ] + ] }, { "id": "94df66c8.23c748", "type": "switch", "z": "c0a0e0.ae6cbf2", "name": "Direction", - "wires": [ - [ - "488569b9.ed45a8" - ], - [ - "be09eac4.e90d18" - ] - ], "property": "direction", "propertyType": "flow", "rules": [ @@ -1275,18 +1337,21 @@ "repair": false, "outputs": 2, "x": 820, - "y": 220 + "y": 220, + "wires": [ + [ + "488569b9.ed45a8" + ], + [ + "be09eac4.e90d18" + ] + ] }, { "id": "488569b9.ed45a8", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "Set direction down", - "wires": [ - [ - "de7aef74.e638b" - ] - ], "rules": [ { "t": "set", @@ -1302,18 +1367,18 @@ "to": "", "reg": false, "x": 1040, - "y": 180 + "y": 180, + "wires": [ + [ + "de7aef74.e638b" + ] + ] }, { "id": "be09eac4.e90d18", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "Set direction up", - "wires": [ - [ - "32ce8567.49120a" - ] - ], "rules": [ { "t": "set", @@ -1329,14 +1394,18 @@ "to": "", "reg": false, "x": 1030, - "y": 260 + "y": 260, + "wires": [ + [ + "32ce8567.49120a" + ] + ] }, { "id": "da116e59.611b2", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", - "wires": [], "topic": "", "qos": "", "retain": "", @@ -1347,18 +1416,14 @@ "expiry": "", "broker": "d51b5899.a2d5d8", "x": 1520, - "y": 180 + "y": 180, + "wires": [] }, { "id": "de7aef74.e638b", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message UP", - "wires": [ - [ - "da116e59.611b2" - ] - ], "rules": [ { "t": "set", @@ -1381,31 +1446,31 @@ "to": "", "reg": false, "x": 1280, - "y": 180 + "y": 180, + "wires": [ + [ + "da116e59.611b2" + ] + ] }, { "id": "5f89dab8.652954", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", - "wires": [], "topic": "", "qos": "", "retain": "", "broker": "d51b5899.a2d5d8", "x": 1520, - "y": 260 + "y": 260, + "wires": [] }, { "id": "32ce8567.49120a", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message DOWN", - "wires": [ - [ - "5f89dab8.652954" - ] - ], "rules": [ { "t": "set", @@ -1428,14 +1493,18 @@ "to": "", "reg": false, "x": 1300, - "y": 260 + "y": 260, + "wires": [ + [ + "5f89dab8.652954" + ] + ] }, { "id": "bad6cfaf.6876d", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", - "wires": [], "topic": "", "qos": "", "retain": "", @@ -1446,18 +1515,14 @@ "expiry": "", "broker": "d51b5899.a2d5d8", "x": 1090, - "y": 340 + "y": 340, + "wires": [] }, { "id": "370e7b7e.f5dca4", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message STOP", - "wires": [ - [ - "bad6cfaf.6876d" - ] - ], "rules": [ { "t": "set", @@ -1480,31 +1545,31 @@ "to": "", "reg": false, "x": 860, - "y": 340 + "y": 340, + "wires": [ + [ + "bad6cfaf.6876d" + ] + ] }, { "id": "96ea6236.ce35a", "type": "mqtt out", "z": "c0a0e0.ae6cbf2", "name": "", - "wires": [], "topic": "", "qos": "", "retain": "", "broker": "d51b5899.a2d5d8", "x": 1090, - "y": 460 + "y": 460, + "wires": [] }, { "id": "7e1107c0.6c8b38", "type": "change", "z": "c0a0e0.ae6cbf2", "name": "MQTT message TOGGLE", - "wires": [ - [ - "96ea6236.ce35a" - ] - ], "rules": [ { "t": "set", @@ -1527,24 +1592,18 @@ "to": "", "reg": false, "x": 870, - "y": 460 + "y": 460, + "wires": [ + [ + "96ea6236.ce35a" + ] + ] }, { "id": "821795d7.433b58", "type": "switch", "z": "c0a0e0.ae6cbf2", "name": "Action", - "wires": [ - [ - "94df66c8.23c748" - ], - [ - "370e7b7e.f5dca4" - ], - [ - "7e1107c0.6c8b38" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -1566,18 +1625,24 @@ "repair": false, "outputs": 3, "x": 630, - "y": 340 + "y": 340, + "wires": [ + [ + "94df66c8.23c748" + ], + [ + "370e7b7e.f5dca4" + ], + [ + "7e1107c0.6c8b38" + ] + ] }, { "id": "a93b68e3e83b1d25", "type": "moment", "z": "be8264a322721305", "name": "Format to HH:mm", - "wires": [ - [ - "0dc0142b97a1bdc7" - ] - ], "topic": "", "input": "payload", "inputType": "msg", @@ -1591,16 +1656,18 @@ "outputType": "msg", "outTz": "Europe/Berlin", "x": 290, - "y": 100 + "y": 100, + "wires": [ + [ + "0dc0142b97a1bdc7" + ] + ] }, { "id": "7a1e6b58aaf9559f", "type": "schedex", "z": "be8264a322721305", "name": "Timer", - "wires": [ - [] - ], "passthroughunhandled": true, "suspended": false, "lat": "", @@ -1623,18 +1690,16 @@ "sat": true, "sun": true, "x": 710, - "y": 100 + "y": 100, + "wires": [ + [] + ] }, { "id": "0dc0142b97a1bdc7", "type": "string", "z": "be8264a322721305", "name": "Prepend ontime", - "wires": [ - [ - "7a1e6b58aaf9559f" - ] - ], "methods": [ { "name": "prepend", @@ -1651,18 +1716,18 @@ "object": "msg", "objectout": "msg", "x": 520, - "y": 100 + "y": 100, + "wires": [ + [ + "7a1e6b58aaf9559f" + ] + ] }, { "id": "6240870c.31fd5", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Coffee warump time", - "wires": [ - [ - "2192f59f.22ce22" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -1709,48 +1774,46 @@ } ], "x": 150, - "y": 200 + "y": 200, + "wires": [ + [ + "2192f59f.22ce22" + ] + ] }, { "id": "2192f59f.22ce22", "type": "function", "z": "bbf25964.5edb38", "name": "actual start time", + "outputs": 1, + "x": 400, + "y": 200, "wires": [ [ "beb09931.b70f28", "a8e14f78.138b18" ] - ], - "outputs": 1, - "x": 400, - "y": 200 + ] }, { "id": "beb09931.b70f28", "type": "schedex", "z": "bbf25964.5edb38", "name": "Wake up timer", + "x": 660, + "y": 200, "wires": [ [ "1c291b99.49c854" ] - ], - "x": 660, - "y": 200 + ] }, { "id": "1c291b99.49c854", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Warmup enabled?", - "wires": [ - [ - "d05c6bb6.89189", - "96ec81ec.b8b198" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -1772,16 +1835,20 @@ "forType": "num", "forUnits": "minutes", "x": 230, - "y": 280 + "y": 280, + "wires": [ + [ + "d05c6bb6.89189", + "96ec81ec.b8b198" + ], + [] + ] }, { "id": "6cb3a102.ddf1", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn on espresso", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -1799,16 +1866,16 @@ "domain": "switch", "service": "turn_on", "x": 890, - "y": 280 + "y": 280, + "wires": [ + [] + ] }, { "id": "d05c6bb6.89189", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn off warmup", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -1826,16 +1893,16 @@ "domain": "input_boolean", "service": "turn_off", "x": 560, - "y": 360 + "y": 360, + "wires": [ + [] + ] }, { "id": "81386d51.ea72e8", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -1851,19 +1918,16 @@ "domain": "notify", "service": "gotify_ha", "x": 1190, - "y": 160 + "y": 160, + "wires": [ + [] + ] }, { "id": "96ec81ec.b8b198", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Espresso machine already on?", - "wires": [ - [ - "6cb3a102.ddf1" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -1885,33 +1949,33 @@ "forType": "num", "forUnits": "minutes", "x": 610, - "y": 280 + "y": 280, + "wires": [ + [ + "6cb3a102.ddf1" + ], + [] + ] }, { "id": "2d4463ba.d359dc", "type": "function", "z": "bbf25964.5edb38", "name": "Espresso ready at...", + "outputs": 1, + "x": 1180, + "y": 80, "wires": [ [ "81386d51.ea72e8" ] - ], - "outputs": 1, - "x": 1180, - "y": 80 + ] }, { "id": "a8e14f78.138b18", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Warmup enabled?", - "wires": [ - [ - "b837b0d4.49bfe" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -1933,19 +1997,19 @@ "forType": "num", "forUnits": "minutes", "x": 390, - "y": 120 + "y": 120, + "wires": [ + [ + "b837b0d4.49bfe" + ], + [] + ] }, { "id": "b837b0d4.49bfe", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Espresso machine already on?", - "wires": [ - [ - "2d4463ba.d359dc" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -1967,19 +2031,19 @@ "forType": "num", "forUnits": "minutes", "x": 870, - "y": 120 + "y": 120, + "wires": [ + [ + "2d4463ba.d359dc" + ], + [] + ] }, { "id": "9baaac50.5dc4d8", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Coffee one time switch is on", - "wires": [ - [ - "cc2ab74b.72878" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -2026,18 +2090,19 @@ } ], "x": 180, - "y": 40 + "y": 40, + "wires": [ + [ + "cc2ab74b.72878" + ], + [] + ] }, { "id": "cc2ab74b.72878", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Get warm up time", - "wires": [ - [ - "4cf72b61.3d5e4c" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -2059,32 +2124,32 @@ "forType": "num", "forUnits": "minutes", "x": 410, - "y": 40 + "y": 40, + "wires": [ + [ + "4cf72b61.3d5e4c" + ] + ] }, { "id": "4cf72b61.3d5e4c", "type": "function", "z": "bbf25964.5edb38", "name": "actual start time", + "outputs": 1, + "x": 600, + "y": 40, "wires": [ [ "b837b0d4.49bfe" ] - ], - "outputs": 1, - "x": 600, - "y": 40 + ] }, { "id": "5009c878.847b08", "type": "api-current-state", "z": "bbf25964.5edb38", "name": "Get auto standby time", - "wires": [ - [ - "d76881ab.11ea4" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -2106,19 +2171,18 @@ "forType": "num", "forUnits": "minutes", "x": 480, - "y": 500 + "y": 500, + "wires": [ + [ + "d76881ab.11ea4" + ] + ] }, { "id": "c1260337.f1478", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Espresso machine is on", - "wires": [ - [ - "5009c878.847b08" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -2165,16 +2229,19 @@ } ], "x": 180, - "y": 500 + "y": 500, + "wires": [ + [ + "5009c878.847b08" + ], + [] + ] }, { "id": "e3a24a7e.c7952", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Turn off espresso", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -2192,34 +2259,31 @@ "domain": "switch", "service": "turn_off", "x": 1070, - "y": 560 + "y": 560, + "wires": [ + [] + ] }, { "id": "d76881ab.11ea4", "type": "stoptimer-varidelay", "z": "bbf25964.5edb38", "name": "Off timer (default 60 mins)", + "x": 790, + "y": 560, "wires": [ [ "e3a24a7e.c7952" ], [], [] - ], - "x": 790, - "y": 560 + ] }, { "id": "3bdeab05.91997c", "type": "server-state-changed", "z": "bbf25964.5edb38", "name": "Espresso machine is off", - "wires": [ - [ - "d96cad4e.4fd068" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -2266,41 +2330,42 @@ } ], "x": 180, - "y": 580 + "y": 580, + "wires": [ + [ + "d96cad4e.4fd068" + ], + [] + ] }, { "id": "d96cad4e.4fd068", "type": "change", "z": "bbf25964.5edb38", "name": "Send STOP", + "x": 450, + "y": 580, "wires": [ [ "d76881ab.11ea4" ] - ], - "x": 450, - "y": 580 + ] }, { "id": "cc000001", "type": "comment", "z": "bbf25964.5edb38", "name": "Coffee Circle Subscription — fetches next delivery data every 6h", - "wires": [], "info": "", "x": 310, - "y": 660 + "y": 660, + "wires": [] }, { "id": "cc000002", "type": "inject", "z": "bbf25964.5edb38", "name": "Every 6h + on deploy", - "wires": [ - [ - "cc000004" - ] - ], "props": [ { "p": "payload" @@ -2318,32 +2383,32 @@ "payload": "", "payloadType": "date", "x": 200, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000004" + ] + ] }, { "id": "cc000003", "type": "link in", "z": "bbf25964.5edb38", "name": "CC Fetch Trigger", + "links": [], + "x": 195, + "y": 780, "wires": [ [ "cc000004" ] - ], - "links": [], - "x": 195, - "y": 780 + ] }, { "id": "cc000004", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", - "wires": [ - [ - "cc000005" - ] - ], "func": "msg.payload = env.get(\"CC_SESSION\");\nreturn msg;", "outputs": 1, "timeout": "", @@ -2352,18 +2417,18 @@ "finalize": "", "libs": [], "x": 420, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000005" + ] + ] }, { "id": "cc000005", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", - "wires": [ - [ - "cc000006" - ] - ], "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2372,19 +2437,18 @@ "finalize": "", "libs": [], "x": 640, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000006" + ] + ] }, { "id": "cc000006", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", - "wires": [ - [ - "cc000007", - "cc00000f" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2397,18 +2461,19 @@ "senderr": false, "headers": [], "x": 880, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000007", + "cc00000f" + ] + ] }, { "id": "cc000007", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", - "wires": [ - [ - "cc000008" - ] - ], "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2417,19 +2482,18 @@ "finalize": "", "libs": [], "x": 1140, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000008" + ] + ] }, { "id": "cc000008", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", - "wires": [ - [ - "cc000009", - "cc000010" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2442,18 +2506,19 @@ "senderr": false, "headers": [], "x": 1360, - "y": 720 + "y": 720, + "wires": [ + [ + "cc000009", + "cc000010" + ] + ] }, { "id": "cc000009", "type": "function", "z": "bbf25964.5edb38", "name": "Parse charges → charge_id", - "wires": [ - [ - "cc00000a" - ] - ], "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges. Response: ' + JSON.stringify(resp).substring(0, 300));\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nconst deliveryDate = charge?.scheduledAt || charge?.scheduled_at || charge?.next_billing_date || charge?.billing_date || charge?.ship_date;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nflow.set('cc_charge_id', String(chargeId));\nflow.set('cc_delivery_date', deliveryDate || 'unknown');\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2462,19 +2527,18 @@ "finalize": "", "libs": [], "x": 1600, - "y": 720 + "y": 720, + "wires": [ + [ + "cc00000a" + ] + ] }, { "id": "cc00000a", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges/", - "wires": [ - [ - "cc00000b", - "cc000011" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2487,13 +2551,28 @@ "senderr": false, "headers": [], "x": 1840, - "y": 720 + "y": 720, + "wires": [ + [ + "cc00000b", + "cc000011" + ] + ] }, { "id": "cc00000b", "type": "function", "z": "bbf25964.5edb38", "name": "Parse detail → 3 sensors", + "func": "const resp = msg.payload;\nconst charge = resp?.charge || resp?.data || resp;\nconst lineItems = charge?.lineItems || charge?.line_items || charge?.items || [];\nconst firstItem = lineItems[0] || {};\nconst product = firstItem.title || firstItem.product_title || firstItem.name || charge?.product_title || 'Coffee subscription';\nconst totalObj = charge?.totalAmount || {};\nconst totalVal = totalObj?.amount || charge?.total_price || charge?.total || '?';\nconst currency = totalObj?.currencyCode || 'EUR';\nconst currencySymbol = { EUR: '€', USD: '$', GBP: '£' }[currency] || currency + ' ';\nconst total = currencySymbol + totalVal;\nconst deliveryDate = flow.get('cc_delivery_date') || charge?.scheduledAt || charge?.scheduled_at || 'unknown';\nconst mkMsg = p => ({ _msgid: msg._msgid, payload: p });\nreturn [mkMsg(deliveryDate), mkMsg(product), mkMsg(total)];", + "outputs": 3, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2080, + "y": 720, "wires": [ [ "cc00000c" @@ -2504,25 +2583,13 @@ [ "cc00000e" ] - ], - "func": "const resp = msg.payload;\nconst charge = resp?.charge || resp?.data || resp;\nconst lineItems = charge?.lineItems || charge?.line_items || charge?.items || [];\nconst firstItem = lineItems[0] || {};\nconst product = firstItem.title || firstItem.product_title || firstItem.name || charge?.product_title || 'Coffee subscription';\nconst totalObj = charge?.totalAmount || {};\nconst totalVal = totalObj?.amount || charge?.total_price || charge?.total || '?';\nconst currency = totalObj?.currencyCode || 'EUR';\nconst currencySymbol = { EUR: '€', USD: '$', GBP: '£' }[currency] || currency + ' ';\nconst total = currencySymbol + totalVal;\nconst deliveryDate = flow.get('cc_delivery_date') || charge?.scheduledAt || charge?.scheduled_at || 'unknown';\nconst mkMsg = p => ({ _msgid: msg._msgid, payload: p });\nreturn [mkMsg(deliveryDate), mkMsg(product), mkMsg(total)];", - "outputs": 3, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 2080, - "y": 720 + ] }, { "id": "cc00000c", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_date", - "wires": [ - [] - ], "entityConfig": "cc000023", "version": 1, "state": "payload", @@ -2531,16 +2598,16 @@ "inputOverride": "allow", "outputProperties": [], "x": 2340, - "y": 680 + "y": 680, + "wires": [ + [] + ] }, { "id": "cc00000e", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_total", - "wires": [ - [] - ], "entityConfig": "cc000025", "version": 1, "state": "payload", @@ -2549,14 +2616,16 @@ "inputOverride": "allow", "outputProperties": [], "x": 2340, - "y": 760 + "y": 760, + "wires": [ + [] + ] }, { "id": "cc00000f", "type": "debug", "z": "bbf25964.5edb38", "name": "Token response", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -2566,14 +2635,14 @@ "statusVal": "", "statusType": "auto", "x": 880, - "y": 800 + "y": 800, + "wires": [] }, { "id": "cc000010", "type": "debug", "z": "bbf25964.5edb38", "name": "Charges response", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -2583,14 +2652,14 @@ "statusVal": "", "statusType": "auto", "x": 1360, - "y": 800 + "y": 800, + "wires": [] }, { "id": "cc000011", "type": "debug", "z": "bbf25964.5edb38", "name": "Detail response", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -2600,18 +2669,14 @@ "statusVal": "", "statusType": "auto", "x": 1840, - "y": 800 + "y": 800, + "wires": [] }, { "id": "cc000012", "type": "catch", "z": "bbf25964.5edb38", "name": "CC Errors", - "wires": [ - [ - "cc000013" - ] - ], "scope": [ "cc000004", "cc000005", @@ -2631,18 +2696,18 @@ ], "uncaught": false, "x": 160, - "y": 880 + "y": 880, + "wires": [ + [ + "cc000013" + ] + ] }, { "id": "cc000013", "type": "function", "z": "bbf25964.5edb38", "name": "Format error", - "wires": [ - [ - "cc000014" - ] - ], "func": "const errMsg = (msg.error && msg.error.message) ? msg.error.message : String(msg.payload || 'Unknown error');\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Error',\n message: errMsg + '\\n\\nIf auth error: update CC_SESSION env var in Node-RED tab settings.',\n notification_id: 'cc_integration_error'\n});\nreturn msg;", "outputs": 1, "timeout": "", @@ -2651,16 +2716,18 @@ "finalize": "", "libs": [], "x": 380, - "y": 880 + "y": 880, + "wires": [ + [ + "cc000014" + ] + ] }, { "id": "cc000014", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -2676,45 +2743,43 @@ "domain": "persistent_notification", "service": "create", "x": 600, - "y": 880 + "y": 880, + "wires": [ + [] + ] }, { "id": "cc000015", "type": "comment", "z": "bbf25964.5edb38", "name": "CC Send Now — triggers immediate delivery on button press", - "wires": [], "info": "", "x": 290, - "y": 960 + "y": 960, + "wires": [] }, { "id": "cc000016", "type": "ha-button", "z": "bbf25964.5edb38", "name": "CC Send Now button", - "wires": [ - [ - "cc000017" - ] - ], "version": 1, "outputs": 1, "entityConfig": "cc000026", "outputProperties": [], "x": 180, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc000017" + ] + ] }, { "id": "cc000017", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", - "wires": [ - [ - "cc000018" - ] - ], "func": "msg.payload = env.get(\"CC_SESSION\");\nreturn msg;", "outputs": 1, "timeout": "", @@ -2723,18 +2788,18 @@ "finalize": "", "libs": [], "x": 400, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc000018" + ] + ] }, { "id": "cc000018", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", - "wires": [ - [ - "cc000019" - ] - ], "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2743,18 +2808,18 @@ "finalize": "", "libs": [], "x": 640, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc000019" + ] + ] }, { "id": "cc000019", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", - "wires": [ - [ - "cc00001a" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2767,18 +2832,18 @@ "senderr": false, "headers": [], "x": 880, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001a" + ] + ] }, { "id": "cc00001a", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", - "wires": [ - [ - "cc00001b" - ] - ], "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2787,18 +2852,18 @@ "finalize": "", "libs": [], "x": 1140, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001b" + ] + ] }, { "id": "cc00001b", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", - "wires": [ - [ - "cc00001c" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2811,18 +2876,18 @@ "senderr": false, "headers": [], "x": 1360, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001c" + ] + ] }, { "id": "cc00001c", "type": "function", "z": "bbf25964.5edb38", "name": "Extract charge_id + build process URL", - "wires": [ - [ - "cc00001d" - ] - ], "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges for Send Now');\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId + '/process';\nmsg.method = 'POST';\nmsg.headers = { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' };\nmsg.payload = {};\nreturn msg;", "outputs": 1, "timeout": "", @@ -2831,18 +2896,18 @@ "finalize": "", "libs": [], "x": 1620, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001d" + ] + ] }, { "id": "cc00001d", "type": "http request", "z": "bbf25964.5edb38", "name": "POST /charges//process", - "wires": [ - [ - "cc00001e" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -2855,21 +2920,18 @@ "senderr": false, "headers": [], "x": 1880, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001e" + ] + ] }, { "id": "cc00001e", "type": "function", "z": "bbf25964.5edb38", "name": "Check result", - "wires": [ - [ - "cc00001f" - ], - [ - "cc000020" - ] - ], "func": "const statusCode = msg.statusCode;\nif (statusCode >= 200 && statusCode < 300) {\n return [msg, null];\n}\nconst detail = JSON.stringify(msg.payload).substring(0, 200);\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Send Now Failed',\n message: 'HTTP ' + statusCode + ': ' + detail,\n notification_id: 'cc_send_now_error'\n});\nreturn [null, msg];", "outputs": 2, "timeout": "", @@ -2878,29 +2940,34 @@ "finalize": "", "libs": [], "x": 2100, - "y": 1020 + "y": 1020, + "wires": [ + [ + "cc00001f" + ], + [ + "cc000020" + ] + ] }, { "id": "cc00001f", "type": "link out", "z": "bbf25964.5edb38", "name": "Trigger CC Fetch", - "wires": [], "mode": "link", "links": [ "cc000003" ], "x": 2320, - "y": 1000 + "y": 1000, + "wires": [] }, { "id": "cc000020", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify Send Now error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -2916,45 +2983,43 @@ "domain": "persistent_notification", "service": "create", "x": 2340, - "y": 1060 + "y": 1060, + "wires": [ + [] + ] }, { "id": "cc000028", "type": "comment", "z": "bbf25964.5edb38", "name": "CC Postpone by 1 Week — postpones delivery by 7 days on button press", - "wires": [], "info": "", "x": 280, - "y": 1260 + "y": 1260, + "wires": [] }, { "id": "cc000029", "type": "ha-button", "z": "bbf25964.5edb38", "name": "CC Postpone 1 week", - "wires": [ - [ - "cc00002a" - ] - ], "version": 1, "outputs": 1, "entityConfig": "cc000027", "outputProperties": [], "x": 180, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002a" + ] + ] }, { "id": "cc00002a", "type": "function", "z": "bbf25964.5edb38", "name": "Read session cookie", - "wires": [ - [ - "cc00002b" - ] - ], "func": "msg.payload = env.get('CC_SESSION');\nflow.set('cc_session_cookie', msg.payload);\nreturn msg;", "outputs": 1, "timeout": "", @@ -2963,18 +3028,18 @@ "finalize": "", "libs": [], "x": 400, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002b" + ] + ] }, { "id": "cc00002b", "type": "function", "z": "bbf25964.5edb38", "name": "Build auth request", - "wires": [ - [ - "cc00002c" - ] - ], "func": "const sessionCookie = msg.payload;\nif (!sessionCookie || sessionCookie === '') {\n node.error('CC_SESSION env var is empty — set it in Node-RED Coffee-mations tab settings');\n return null;\n}\nmsg.url = 'https://account.coffeecircle.com/oauth/token';\nmsg.method = 'GET';\nmsg.headers = { 'Cookie': '_shopify_essential=' + sessionCookie };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -2983,18 +3048,18 @@ "finalize": "", "libs": [], "x": 640, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002c" + ] + ] }, { "id": "cc00002c", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /oauth/token", - "wires": [ - [ - "cc00002d" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -3007,18 +3072,18 @@ "senderr": false, "headers": [], "x": 880, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002d" + ] + ] }, { "id": "cc00002d", "type": "function", "z": "bbf25964.5edb38", "name": "Extract token + charges URL", - "wires": [ - [ - "cc00002e" - ] - ], "func": "const resp = msg.payload;\nconst token = resp?.access_token || resp?.token || resp?.bearer_token || resp?.accessToken || resp?.id_token;\nif (!token) {\n node.error('/oauth/token response: ' + JSON.stringify(resp));\n return null;\n}\nflow.set('cc_token', token);\nconst today = new Date().toISOString().split('T')[0];\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges?status=queued,error,skipped&scheduledAtMin=' + today;\nmsg.method = 'GET';\nmsg.headers = { 'Authorization': 'Bearer ' + token };\nmsg.payload = '';\nreturn msg;", "outputs": 1, "timeout": "", @@ -3027,18 +3092,18 @@ "finalize": "", "libs": [], "x": 1140, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002e" + ] + ] }, { "id": "cc00002e", "type": "http request", "z": "bbf25964.5edb38", "name": "GET /charges", - "wires": [ - [ - "cc00002f" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -3051,18 +3116,18 @@ "senderr": false, "headers": [], "x": 1360, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc00002f" + ] + ] }, { "id": "cc00002f", "type": "function", "z": "bbf25964.5edb38", "name": "Extract charge_id + build reschedule", - "wires": [ - [ - "cc000030" - ] - ], "func": "const resp = msg.payload;\nconst charges = resp?.charges || resp?.data || resp?.items || resp?.results || (Array.isArray(resp) ? resp : null);\nif (!charges || charges.length === 0) {\n node.error('No queued charges for Postpone');\n return null;\n}\nconst charge = charges[0];\nconst chargeId = charge?.id || charge?.charge_id;\nif (!chargeId) {\n node.error('Cannot extract charge ID. Keys: ' + Object.keys(charge || {}).join(', '));\n return null;\n}\nflow.set('cc_charge_id', String(chargeId));\n// Read delivery date from HA state cache\nconst states = global.get('homeassistant')?.homeAssistantLatest?.states;\nconst dateStr = states?.['sensor.cc_next_delivery_date']?.state || flow.get('cc_delivery_date');\nif (!dateStr || dateStr === 'unknown' || dateStr === 'unavailable') {\n node.error('Cannot read current delivery date from HA state: ' + dateStr);\n return null;\n}\nconst d = new Date(dateStr);\nd.setDate(d.getDate() + 7);\nconst newDate = d.toISOString().split('T')[0];\nconst token = flow.get('cc_token');\nmsg.url = 'https://api.coffeecircle.com/api/subscription/charges/' + chargeId + '/reschedule';\nmsg.method = 'PUT';\nmsg.headers = { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' };\nmsg.payload = { scheduledAt: newDate };\nreturn msg;", "outputs": 1, "timeout": "", @@ -3071,18 +3136,18 @@ "finalize": "", "libs": [], "x": 1620, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc000030" + ] + ] }, { "id": "cc000030", "type": "http request", "z": "bbf25964.5edb38", "name": "PUT /reschedule", - "wires": [ - [ - "cc000031" - ] - ], "method": "use", "ret": "obj", "paytoqs": "ignore", @@ -3095,13 +3160,27 @@ "senderr": false, "headers": [], "x": 1880, - "y": 1320 + "y": 1320, + "wires": [ + [ + "cc000031" + ] + ] }, { "id": "cc000031", "type": "function", "z": "bbf25964.5edb38", "name": "Check reschedule result", + "func": "const statusCode = msg.statusCode;\nif (statusCode >= 200 && statusCode < 300) {\n return [msg, null, null];\n}\nif (statusCode === 401 && !msg._retried) {\n msg._retried = true;\n msg.payload = flow.get('cc_session_cookie');\n return [null, msg, null];\n}\nconst detail = JSON.stringify(msg.payload).substring(0, 200);\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Postpone Failed',\n message: 'HTTP ' + statusCode + ': ' + detail,\n notification_id: 'cc_postpone_error'\n});\nreturn [null, null, msg];", + "outputs": 3, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 2100, + "y": 1320, "wires": [ [ "cc000032" @@ -3112,38 +3191,26 @@ [ "cc000033" ] - ], - "func": "const statusCode = msg.statusCode;\nif (statusCode >= 200 && statusCode < 300) {\n return [msg, null, null];\n}\nif (statusCode === 401 && !msg._retried) {\n msg._retried = true;\n msg.payload = flow.get('cc_session_cookie');\n return [null, msg, null];\n}\nconst detail = JSON.stringify(msg.payload).substring(0, 200);\nmsg.payload = JSON.stringify({\n title: 'Coffee Circle Postpone Failed',\n message: 'HTTP ' + statusCode + ': ' + detail,\n notification_id: 'cc_postpone_error'\n});\nreturn [null, null, msg];", - "outputs": 3, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 2100, - "y": 1320 + ] }, { "id": "cc000032", "type": "link out", "z": "bbf25964.5edb38", "name": "Trigger CC Fetch", - "wires": [], "mode": "link", "links": [ "cc000003" ], "x": 2320, - "y": 1300 + "y": 1300, + "wires": [] }, { "id": "cc000033", "type": "api-call-service", "z": "bbf25964.5edb38", "name": "Notify postpone error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -3159,16 +3226,16 @@ "domain": "persistent_notification", "service": "create", "x": 2340, - "y": 1360 + "y": 1360, + "wires": [ + [] + ] }, { "id": "cc00000d", "type": "ha-sensor", "z": "bbf25964.5edb38", "name": "cc_next_delivery_product", - "wires": [ - [] - ], "entityConfig": "cc000024", "version": 1, "state": "payload", @@ -3177,21 +3244,16 @@ "inputOverride": "allow", "outputProperties": [], "x": 2340, - "y": 720 - }, - { - "type": "tab", - "label": "Security", - "id": "600f7a12.5ee66c" + "y": 720, + "wires": [ + [] + ] }, { "id": "1319ea0f.4d86d6", "type": "api-call-service", "z": "600f7a12.5ee66c", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -3213,18 +3275,16 @@ "output_location": "", "output_location_type": "none", "x": 1370, - "y": 80 + "y": 80, + "wires": [ + [] + ] }, { "id": "96b02618.e84278", "type": "server-state-changed", "z": "600f7a12.5ee66c", "name": "Front door", - "wires": [ - [ - "63ef802b.259ca" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -3271,19 +3331,18 @@ } ], "x": 120, - "y": 60 + "y": 60, + "wires": [ + [ + "63ef802b.259ca" + ] + ] }, { "id": "50b85b7a.092964", "type": "template", "z": "600f7a12.5ee66c", "name": "Door template", - "wires": [ - [ - "1319ea0f.4d86d6", - "8ccf280b.4ba23" - ] - ], "field": "payload", "fieldType": "msg", "format": "json", @@ -3291,18 +3350,19 @@ "template": "{\n \"title\":\"Info\",\n \"message\":\"{{door_type}} door is {{payload}}.\"\n}\n\n", "output": "str", "x": 1160, - "y": 100 + "y": 100, + "wires": [ + [ + "1319ea0f.4d86d6", + "8ccf280b.4ba23" + ] + ] }, { "id": "6d21e8a.b9e5b18", "type": "server-state-changed", "z": "600f7a12.5ee66c", "name": "Storage door", - "wires": [ - [ - "63ef802b.259ca" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -3349,21 +3409,18 @@ } ], "x": 110, - "y": 140 + "y": 140, + "wires": [ + [ + "63ef802b.259ca" + ] + ] }, { "id": "63ef802b.259ca", "type": "switch", "z": "600f7a12.5ee66c", "name": "Which door?", - "wires": [ - [ - "80b797a8.a574a8" - ], - [ - "a3bd4d81.d47768" - ] - ], "property": "topic", "propertyType": "msg", "rules": [ @@ -3382,18 +3439,21 @@ "repair": false, "outputs": 2, "x": 350, - "y": 100 + "y": 100, + "wires": [ + [ + "80b797a8.a574a8" + ], + [ + "a3bd4d81.d47768" + ] + ] }, { "id": "80b797a8.a574a8", "type": "change", "z": "600f7a12.5ee66c", "name": "Set Front door", - "wires": [ - [ - "8d30f50.0a8dd88" - ] - ], "rules": [ { "t": "set", @@ -3409,18 +3469,18 @@ "to": "", "reg": false, "x": 580, - "y": 60 + "y": 60, + "wires": [ + [ + "8d30f50.0a8dd88" + ] + ] }, { "id": "a3bd4d81.d47768", "type": "change", "z": "600f7a12.5ee66c", "name": "Set Storage door", - "wires": [ - [ - "8d30f50.0a8dd88" - ] - ], "rules": [ { "t": "set", @@ -3436,21 +3496,18 @@ "to": "", "reg": false, "x": 590, - "y": 140 + "y": 140, + "wires": [ + [ + "8d30f50.0a8dd88" + ] + ] }, { "id": "8d30f50.0a8dd88", "type": "switch", "z": "600f7a12.5ee66c", "name": "open or closed?", - "wires": [ - [ - "d5d051a2.1ad7a" - ], - [ - "141cc3d2.c3ddf4" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -3469,18 +3526,21 @@ "repair": false, "outputs": 2, "x": 800, - "y": 100 + "y": 100, + "wires": [ + [ + "d5d051a2.1ad7a" + ], + [ + "141cc3d2.c3ddf4" + ] + ] }, { "id": "d5d051a2.1ad7a", "type": "change", "z": "600f7a12.5ee66c", "name": "open", - "wires": [ - [ - "50b85b7a.092964" - ] - ], "rules": [ { "t": "set", @@ -3496,18 +3556,18 @@ "to": "", "reg": false, "x": 970, - "y": 60 + "y": 60, + "wires": [ + [ + "50b85b7a.092964" + ] + ] }, { "id": "141cc3d2.c3ddf4", "type": "change", "z": "600f7a12.5ee66c", "name": "closed", - "wires": [ - [ - "50b85b7a.092964" - ] - ], "rules": [ { "t": "set", @@ -3523,18 +3583,18 @@ "to": "", "reg": false, "x": 970, - "y": 140 + "y": 140, + "wires": [ + [ + "50b85b7a.092964" + ] + ] }, { "id": "d75236f8.133cd8", "type": "inject", "z": "600f7a12.5ee66c", "name": "", - "wires": [ - [ - "63ef802b.259ca" - ] - ], "props": [ { "p": "payload" @@ -3552,14 +3612,18 @@ "payload": "on", "payloadType": "str", "x": 190, - "y": 260 + "y": 260, + "wires": [ + [ + "63ef802b.259ca" + ] + ] }, { "id": "8ccf280b.4ba23", "type": "debug", "z": "600f7a12.5ee66c", "name": "", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -3568,51 +3632,49 @@ "statusVal": "", "statusType": "auto", "x": 1360, - "y": 180 + "y": 180, + "wires": [] }, { "id": "p2catch_sec", "type": "catch", "z": "600f7a12.5ee66c", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 460, "wires": [ [ "p2fmt_sec" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 460 + ] }, { "id": "p2fmt_sec", "type": "function", "z": "600f7a12.5ee66c", "name": "Format error", - "wires": [ - [ - "p2ntfy_sec" - ] - ], "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: Security',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 460 + "y": 460, + "wires": [ + [ + "p2ntfy_sec" + ] + ] }, { "id": "p2ntfy_sec", "type": "api-call-service", "z": "600f7a12.5ee66c", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -3634,23 +3696,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 460 - }, - { - "type": "tab", - "label": "Wake up & mosquito", - "id": "75c53969.aa5438" + "y": 460, + "wires": [ + [] + ] }, { "id": "ae332807.ef2fd8", "type": "schedex", "z": "75c53969.aa5438", "name": "Wake up timer", - "wires": [ - [ - "6c060df4.52243c" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -3673,18 +3728,18 @@ "sat": false, "sun": false, "x": 1100, - "y": 200 + "y": 200, + "wires": [ + [ + "6c060df4.52243c" + ] + ] }, { "id": "93a80007.e0738", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekday wake up time", - "wires": [ - [ - "9bda506c.e72ec8" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -3731,18 +3786,18 @@ } ], "x": 180, - "y": 100 + "y": 100, + "wires": [ + [ + "9bda506c.e72ec8" + ] + ] }, { "id": "694fe4c5.685bac", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekday fade in", - "wires": [ - [ - "22ae3c69.00a1cc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -3789,19 +3844,18 @@ } ], "x": 180, - "y": 300 + "y": 300, + "wires": [ + [ + "22ae3c69.00a1cc" + ] + ] }, { "id": "6c060df4.52243c", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", - "wires": [ - [ - "dbc82e9b.f57dc8" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -3829,18 +3883,19 @@ "forType": "num", "forUnits": "minutes", "x": 1360, - "y": 200 + "y": 200, + "wires": [ + [ + "dbc82e9b.f57dc8" + ], + [] + ] }, { "id": "e369f3d1.5a92e", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekday wake up time", - "wires": [ - [ - "2ec2fea2.c760e2" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -3868,18 +3923,18 @@ "forType": "num", "forUnits": "minutes", "x": 540, - "y": 360 + "y": 360, + "wires": [ + [ + "2ec2fea2.c760e2" + ] + ] }, { "id": "e67fe3b4.3a7a28", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekday fade in", - "wires": [ - [ - "b000fa34.217b6" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -3907,19 +3962,18 @@ "forType": "num", "forUnits": "minutes", "x": 540, - "y": 160 + "y": 160, + "wires": [ + [ + "b000fa34.217b6" + ] + ] }, { "id": "9bda506c.e72ec8", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "e67fe3b4.3a7a28", - "d8decadb.021668" - ] - ], "rules": [ { "t": "set", @@ -3935,18 +3989,19 @@ "to": "", "reg": false, "x": 570, - "y": 100 + "y": 100, + "wires": [ + [ + "e67fe3b4.3a7a28", + "d8decadb.021668" + ] + ] }, { "id": "22ae3c69.00a1cc", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "e369f3d1.5a92e" - ] - ], "rules": [ { "t": "set", @@ -3962,20 +4017,18 @@ "to": "", "reg": false, "x": 570, - "y": 300 + "y": 300, + "wires": [ + [ + "e369f3d1.5a92e" + ] + ] }, { "id": "b000fa34.217b6", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "9cb89f73.575448", - "f94ec42c.03a648", - "18eb0644ca136b1c" - ] - ], "rules": [ { "t": "set", @@ -3991,20 +4044,20 @@ "to": "", "reg": false, "x": 570, - "y": 220 - }, - { - "id": "2ec2fea2.c760e2", - "type": "change", - "z": "75c53969.aa5438", - "name": "", + "y": 220, "wires": [ [ "9cb89f73.575448", "f94ec42c.03a648", "18eb0644ca136b1c" ] - ], + ] + }, + { + "id": "2ec2fea2.c760e2", + "type": "change", + "z": "75c53969.aa5438", + "name": "", "rules": [ { "t": "set", @@ -4020,18 +4073,20 @@ "to": "", "reg": false, "x": 570, - "y": 420 + "y": 420, + "wires": [ + [ + "9cb89f73.575448", + "f94ec42c.03a648", + "18eb0644ca136b1c" + ] + ] }, { "id": "9cb89f73.575448", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", - "wires": [ - [ - "ae332807.ef2fd8" - ] - ], "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = (wakeUpFade == 0) ? 0 : -Math.abs(wakeUpFade); \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4040,16 +4095,18 @@ "finalize": "", "libs": [], "x": 880, - "y": 200 + "y": 200, + "wires": [ + [ + "ae332807.ef2fd8" + ] + ] }, { "id": "5bfae0ef.66185", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Wake up lights", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -4073,18 +4130,16 @@ "output_location": "", "output_location_type": "none", "x": 1660, - "y": 220 + "y": 220, + "wires": [ + [] + ] }, { "id": "dbc82e9b.f57dc8", "type": "function", "z": "75c53969.aa5438", "name": "Prepare transition body", - "wires": [ - [ - "5bfae0ef.66185" - ] - ], "func": "var tmpPayload = {};\ntmpPayload.brightness_pct = 100;\ntmpPayload.transition = parseInt(flow.get('weekday_wakeup_fade'))*60;\ntmpPayload.rgb_color = [255, 212, 178];\n\nvar newMsg = {};\n// newMsg.payload = tmpPayload;\nnewMsg.payload = {};\nnewMsg.payload.data = tmpPayload;\n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4093,16 +4148,18 @@ "finalize": "", "libs": [], "x": 1390, - "y": 260 + "y": 260, + "wires": [ + [ + "5bfae0ef.66185" + ] + ] }, { "id": "f21c4ec.c39bfb", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on espresso", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -4126,18 +4183,16 @@ "output_location": "", "output_location_type": "none", "x": 1670, - "y": 320 + "y": 320, + "wires": [ + [] + ] }, { "id": "f94ec42c.03a648", "type": "function", "z": "75c53969.aa5438", "name": "espresso start time", - "wires": [ - [ - "fc05fffe.2de45" - ] - ], "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -25; \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4146,18 +4201,18 @@ "finalize": "", "libs": [], "x": 890, - "y": 320 + "y": 320, + "wires": [ + [ + "fc05fffe.2de45" + ] + ] }, { "id": "fc05fffe.2de45", "type": "schedex", "z": "75c53969.aa5438", "name": "Espresso timer", - "wires": [ - [ - "77923b2d.4a22fc" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -4180,19 +4235,18 @@ "sat": false, "sun": false, "x": 1140, - "y": 320 + "y": 320, + "wires": [ + [ + "77923b2d.4a22fc" + ] + ] }, { "id": "77923b2d.4a22fc", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", - "wires": [ - [ - "f21c4ec.c39bfb" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4220,19 +4274,19 @@ "forType": "num", "forUnits": "minutes", "x": 1400, - "y": 320 + "y": 320, + "wires": [ + [ + "f21c4ec.c39bfb" + ], + [] + ] }, { "id": "d8decadb.021668", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", - "wires": [ - [ - "ef8a3c3f.d62bc8" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4260,21 +4314,19 @@ "forType": "num", "forUnits": "minutes", "x": 880, - "y": 100 + "y": 100, + "wires": [ + [ + "ef8a3c3f.d62bc8" + ], + [] + ] }, { "id": "ef8a3c3f.d62bc8", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", - "wires": [ - [ - "9a69ecfb.d23d78" - ], - [ - "9a69ecfb.d23d78" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4302,18 +4354,21 @@ "forType": "num", "forUnits": "minutes", "x": 1140, - "y": 100 + "y": 100, + "wires": [ + [ + "9a69ecfb.d23d78" + ], + [ + "9a69ecfb.d23d78" + ] + ] }, { "id": "9a69ecfb.d23d78", "type": "function", "z": "75c53969.aa5438", "name": "Wake up notification", - "wires": [ - [ - "2cc3b77b.1bea68" - ] - ], "func": "var espressoMsg = '.';\n\nif (msg.payload == 'on') { \n espressoMsg = ' and warm up espresso machine.'\n}\n\nvar newMsg = {};\nnewMsg.payload = \n \"Weekday wake up at \"+\n flow.get('weekday_wakeup_time').substr(0,5)+\n espressoMsg\n ;\n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4322,16 +4377,18 @@ "finalize": "", "libs": [], "x": 1420, - "y": 100 + "y": 100, + "wires": [ + [ + "2cc3b77b.1bea68" + ] + ] }, { "id": "2cc3b77b.1bea68", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -4353,18 +4410,16 @@ "output_location": "", "output_location_type": "none", "x": 1650, - "y": 100 + "y": 100, + "wires": [ + [] + ] }, { "id": "4dc6da74.8356dc", "type": "schedex", "z": "75c53969.aa5438", "name": "Wake up timer", - "wires": [ - [ - "85381275.49e7d" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -4387,18 +4442,18 @@ "sat": true, "sun": true, "x": 1140, - "y": 840 + "y": 840, + "wires": [ + [ + "85381275.49e7d" + ] + ] }, { "id": "fc43b82c.213cb8", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekend wake up time", - "wires": [ - [ - "c521c0a0.379578" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -4440,18 +4495,18 @@ } ], "x": 180, - "y": 740 + "y": 740, + "wires": [ + [ + "c521c0a0.379578" + ] + ] }, { "id": "76b3e57e.0f74f4", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Weekend fade in", - "wires": [ - [ - "683d8f2e.895c48" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -4493,19 +4548,18 @@ } ], "x": 160, - "y": 940 + "y": 940, + "wires": [ + [ + "683d8f2e.895c48" + ] + ] }, { "id": "85381275.49e7d", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", - "wires": [ - [ - "9d13f9f6.43bf48" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4533,18 +4587,19 @@ "forType": "num", "forUnits": "minutes", "x": 1360, - "y": 840 + "y": 840, + "wires": [ + [ + "9d13f9f6.43bf48" + ], + [] + ] }, { "id": "4dddf54a.ae2404", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekend wake up time", - "wires": [ - [ - "10ec127f.448cbe" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -4572,18 +4627,18 @@ "forType": "num", "forUnits": "minutes", "x": 540, - "y": 1000 + "y": 1000, + "wires": [ + [ + "10ec127f.448cbe" + ] + ] }, { "id": "8ce67518.da9078", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Get weekend fade in", - "wires": [ - [ - "12733a41.25d2a6" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -4611,19 +4666,18 @@ "forType": "num", "forUnits": "minutes", "x": 540, - "y": 800 + "y": 800, + "wires": [ + [ + "12733a41.25d2a6" + ] + ] }, { "id": "c521c0a0.379578", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "8ce67518.da9078", - "258551dc.78ecd6" - ] - ], "rules": [ { "t": "set", @@ -4639,18 +4693,19 @@ "to": "", "reg": false, "x": 570, - "y": 740 + "y": 740, + "wires": [ + [ + "8ce67518.da9078", + "258551dc.78ecd6" + ] + ] }, { "id": "683d8f2e.895c48", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "4dddf54a.ae2404" - ] - ], "rules": [ { "t": "set", @@ -4666,20 +4721,18 @@ "to": "", "reg": false, "x": 570, - "y": 940 + "y": 940, + "wires": [ + [ + "4dddf54a.ae2404" + ] + ] }, { "id": "12733a41.25d2a6", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "df53b1da.f9fb38", - "f0aedf49.47b5c", - "11ee3e0ecc62415e" - ] - ], "rules": [ { "t": "set", @@ -4695,20 +4748,20 @@ "to": "", "reg": false, "x": 570, - "y": 860 - }, - { - "id": "10ec127f.448cbe", - "type": "change", - "z": "75c53969.aa5438", - "name": "", + "y": 860, "wires": [ [ "df53b1da.f9fb38", "f0aedf49.47b5c", "11ee3e0ecc62415e" ] - ], + ] + }, + { + "id": "10ec127f.448cbe", + "type": "change", + "z": "75c53969.aa5438", + "name": "", "rules": [ { "t": "set", @@ -4724,18 +4777,20 @@ "to": "", "reg": false, "x": 570, - "y": 1060 + "y": 1060, + "wires": [ + [ + "df53b1da.f9fb38", + "f0aedf49.47b5c", + "11ee3e0ecc62415e" + ] + ] }, { "id": "df53b1da.f9fb38", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", - "wires": [ - [ - "4dc6da74.8356dc" - ] - ], "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = (wakeUpFade == 0) ? 0 : -Math.abs(wakeUpFade); \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4744,16 +4799,18 @@ "finalize": "", "libs": [], "x": 880, - "y": 840 + "y": 840, + "wires": [ + [ + "4dc6da74.8356dc" + ] + ] }, { "id": "d415030.858b68", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Wake up lights", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -4777,18 +4834,16 @@ "output_location": "", "output_location_type": "none", "x": 1640, - "y": 840 + "y": 840, + "wires": [ + [] + ] }, { "id": "9d13f9f6.43bf48", "type": "function", "z": "75c53969.aa5438", "name": "Prepare transition body", - "wires": [ - [ - "d415030.858b68" - ] - ], "func": "var tmpPayload = {};\ntmpPayload.brightness = 255;\ntmpPayload.transition = parseInt(flow.get('weekend_wakeup_fade'))*60;\ntmpPayload.rgb_color = [255, 207, 120];\n\nvar newMsg = {};\nnewMsg.payload = {};\nnewMsg.payload.data = tmpPayload;\n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4797,16 +4852,18 @@ "finalize": "", "libs": [], "x": 1390, - "y": 900 + "y": 900, + "wires": [ + [ + "d415030.858b68" + ] + ] }, { "id": "7722c177.c69d58", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on espresso", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -4830,18 +4887,16 @@ "output_location": "", "output_location_type": "none", "x": 1650, - "y": 960 + "y": 960, + "wires": [ + [] + ] }, { "id": "f0aedf49.47b5c", "type": "function", "z": "75c53969.aa5438", "name": "espresso start time", - "wires": [ - [ - "e1e0b6cb.85b9b" - ] - ], "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -25; \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -4850,18 +4905,18 @@ "finalize": "", "libs": [], "x": 890, - "y": 960 + "y": 960, + "wires": [ + [ + "e1e0b6cb.85b9b" + ] + ] }, { "id": "e1e0b6cb.85b9b", "type": "schedex", "z": "75c53969.aa5438", "name": "Espresso timer", - "wires": [ - [ - "8d66adb4.9f362" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -4884,19 +4939,18 @@ "sat": true, "sun": true, "x": 1140, - "y": 960 + "y": 960, + "wires": [ + [ + "8d66adb4.9f362" + ] + ] }, { "id": "8d66adb4.9f362", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", - "wires": [ - [ - "7722c177.c69d58" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4924,19 +4978,19 @@ "forType": "num", "forUnits": "minutes", "x": 1400, - "y": 960 + "y": 960, + "wires": [ + [ + "7722c177.c69d58" + ], + [] + ] }, { "id": "258551dc.78ecd6", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Do Wake Up?", - "wires": [ - [ - "762c79e3.920548" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -4964,21 +5018,19 @@ "forType": "num", "forUnits": "minutes", "x": 880, - "y": 740 + "y": 740, + "wires": [ + [ + "762c79e3.920548" + ], + [] + ] }, { "id": "762c79e3.920548", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Heat up espresso machine?", - "wires": [ - [ - "81837c2f.7493" - ], - [ - "81837c2f.7493" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5006,18 +5058,21 @@ "forType": "num", "forUnits": "minutes", "x": 1120, - "y": 740 + "y": 740, + "wires": [ + [ + "81837c2f.7493" + ], + [ + "81837c2f.7493" + ] + ] }, { "id": "81837c2f.7493", "type": "function", "z": "75c53969.aa5438", "name": "Wake up notification", - "wires": [ - [ - "19f56085.336bff" - ] - ], "func": "var espressoMsg = '.';\n\nif (msg.payload == 'on') { \n espressoMsg = ' and warm up espresso machine.'\n}\n\nvar newMsg = {};\nnewMsg.payload = \n \"Weekend wake up at \"+\n flow.get('weekend_wakeup_time').substr(0,5)+\n espressoMsg\n ;\n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -5026,16 +5081,18 @@ "finalize": "", "libs": [], "x": 1380, - "y": 740 + "y": 740, + "wires": [ + [ + "19f56085.336bff" + ] + ] }, { "id": "19f56085.336bff", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5057,48 +5114,46 @@ "output_location": "", "output_location_type": "none", "x": 1650, - "y": 740 + "y": 740, + "wires": [ + [] + ] }, { "id": "547e480223620899", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up weekday", - "wires": [], "info": "", "x": 170, - "y": 60 + "y": 60, + "wires": [] }, { "id": "ed1e94f805a7cefc", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up weekend", - "wires": [], "info": "", "x": 170, - "y": 700 + "y": 700, + "wires": [] }, { "id": "64e25c08b51a1c62", "type": "comment", "z": "75c53969.aa5438", "name": "Mosquito repellent", - "wires": [], "info": "", "x": 170, - "y": 1360 + "y": 1360, + "wires": [] }, { "id": "22546de14d49ffe0", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent start", - "wires": [ - [ - "5ba4538297e14338" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -5145,19 +5200,18 @@ } ], "x": 180, - "y": 1480 + "y": 1480, + "wires": [ + [ + "5ba4538297e14338" + ] + ] }, { "id": "9046160e1b2dcae8", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", - "wires": [ - [ - "fbabed1ad7a24ba0" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5185,18 +5239,19 @@ "forType": "num", "forUnits": "minutes", "x": 680, - "y": 1480 + "y": 1480, + "wires": [ + [ + "fbabed1ad7a24ba0" + ], + [] + ] }, { "id": "fbabed1ad7a24ba0", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", - "wires": [ - [ - "e9a1ce2e4ff7ec96" - ] - ], "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent will turn on at \"+\n flow.get('mosquito_start_time').substr(0,5)\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, @@ -5204,16 +5259,18 @@ "finalize": "", "libs": [], "x": 990, - "y": 1480 + "y": 1480, + "wires": [ + [ + "e9a1ce2e4ff7ec96" + ] + ] }, { "id": "e9a1ce2e4ff7ec96", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5235,19 +5292,16 @@ "output_location": "", "output_location_type": "none", "x": 1410, - "y": 1440 + "y": 1440, + "wires": [ + [] + ] }, { "id": "5ba4538297e14338", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "9046160e1b2dcae8", - "a2a01fc407a0436d" - ] - ], "rules": [ { "t": "set", @@ -5263,18 +5317,19 @@ "to": "", "reg": false, "x": 200, - "y": 1540 + "y": 1540, + "wires": [ + [ + "9046160e1b2dcae8", + "a2a01fc407a0436d" + ] + ] }, { "id": "59b8f49a70e4cd99", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent start", - "wires": [ - [ - "597bdcb50e6cb418" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -5321,18 +5376,18 @@ } ], "x": 180, - "y": 1400 + "y": 1400, + "wires": [ + [ + "597bdcb50e6cb418" + ] + ] }, { "id": "597bdcb50e6cb418", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", - "wires": [ - [ - "e9a1ce2e4ff7ec96" - ] - ], "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent turned \" + \n msg.payload + \n \".\"\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, @@ -5340,19 +5395,18 @@ "finalize": "", "libs": [], "x": 690, - "y": 1400 + "y": 1400, + "wires": [ + [ + "e9a1ce2e4ff7ec96" + ] + ] }, { "id": "a2a01fc407a0436d", "type": "function", "z": "75c53969.aa5438", "name": "actual start time", - "wires": [ - [ - "ced1a60d7a156f31", - "03a4a0b9263bb6a5" - ] - ], "func": "var newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = flow.get('mosquito_start_time').substr(0, 5);\n\nreturn newMsg;", "outputs": 1, "noerr": 0, @@ -5360,19 +5414,19 @@ "finalize": "", "libs": [], "x": 640, - "y": 1540 + "y": 1540, + "wires": [ + [ + "ced1a60d7a156f31", + "03a4a0b9263bb6a5" + ] + ] }, { "id": "ced1a60d7a156f31", "type": "schedex", "z": "75c53969.aa5438", "name": "Mosquito repellent start timer", - "wires": [ - [ - "681c8277c5546141", - "03a4a0b9263bb6a5" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -5395,16 +5449,19 @@ "sat": true, "sun": true, "x": 680, - "y": 1600 + "y": 1600, + "wires": [ + [ + "681c8277c5546141", + "03a4a0b9263bb6a5" + ] + ] }, { "id": "6f4031ab571aeae0", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn on mosquito repellent", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5428,20 +5485,16 @@ "output_location": "", "output_location_type": "none", "x": 1460, - "y": 1560 + "y": 1560, + "wires": [ + [] + ] }, { "id": "681c8277c5546141", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", - "wires": [ - [ - "6f4031ab571aeae0", - "03a4a0b9263bb6a5" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5469,18 +5522,20 @@ "forType": "num", "forUnits": "minutes", "x": 980, - "y": 1540 + "y": 1540, + "wires": [ + [ + "6f4031ab571aeae0", + "03a4a0b9263bb6a5" + ], + [] + ] }, { "id": "8c2dd2f5682080ac", "type": "server-state-changed", "z": "75c53969.aa5438", "name": "Mosquito repellent stop", - "wires": [ - [ - "392706767c38e18e" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -5527,19 +5582,18 @@ } ], "x": 180, - "y": 1620 + "y": 1620, + "wires": [ + [ + "392706767c38e18e" + ] + ] }, { "id": "392706767c38e18e", "type": "change", "z": "75c53969.aa5438", "name": "", - "wires": [ - [ - "b79251d5e98f3863", - "280a9497b4700592" - ] - ], "rules": [ { "t": "set", @@ -5555,19 +5609,19 @@ "to": "", "reg": false, "x": 200, - "y": 1680 + "y": 1680, + "wires": [ + [ + "b79251d5e98f3863", + "280a9497b4700592" + ] + ] }, { "id": "b79251d5e98f3863", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Enable Mosquito repellent?", - "wires": [ - [ - "4b8aaa94a2eb49c4" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5595,18 +5649,19 @@ "forType": "num", "forUnits": "minutes", "x": 680, - "y": 1680 + "y": 1680, + "wires": [ + [ + "4b8aaa94a2eb49c4" + ], + [] + ] }, { "id": "4b8aaa94a2eb49c4", "type": "function", "z": "75c53969.aa5438", "name": "Mosquito repellent notification", - "wires": [ - [ - "e9a1ce2e4ff7ec96" - ] - ], "func": "var newMsg = {};\nnewMsg.payload = \n \"Mosquito repellent will turn off at \"+\n flow.get('mosquito_stop_time').substr(0,5)\n ;\n\nreturn newMsg;", "outputs": 1, "noerr": 0, @@ -5614,19 +5669,18 @@ "finalize": "", "libs": [], "x": 990, - "y": 1680 + "y": 1680, + "wires": [ + [ + "e9a1ce2e4ff7ec96" + ] + ] }, { "id": "280a9497b4700592", "type": "function", "z": "75c53969.aa5438", "name": "actual stop time", - "wires": [ - [ - "8d3c194ede95021a", - "03a4a0b9263bb6a5" - ] - ], "func": "var newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = flow.get('mosquito_stop_time').substr(0, 5);\n\nreturn newMsg;", "outputs": 1, "noerr": 0, @@ -5634,19 +5688,19 @@ "finalize": "", "libs": [], "x": 640, - "y": 1740 + "y": 1740, + "wires": [ + [ + "8d3c194ede95021a", + "03a4a0b9263bb6a5" + ] + ] }, { "id": "8d3c194ede95021a", "type": "schedex", "z": "75c53969.aa5438", "name": "Mosquito repellent stop timer", - "wires": [ - [ - "9ba1f8f1e3d43149", - "03a4a0b9263bb6a5" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -5669,16 +5723,19 @@ "sat": true, "sun": true, "x": 680, - "y": 1800 + "y": 1800, + "wires": [ + [ + "9ba1f8f1e3d43149", + "03a4a0b9263bb6a5" + ] + ] }, { "id": "9ba1f8f1e3d43149", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Turn off mosquito repellent", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5702,14 +5759,16 @@ "output_location": "", "output_location_type": "none", "x": 1460, - "y": 1700 + "y": 1700, + "wires": [ + [] + ] }, { "id": "03a4a0b9263bb6a5", "type": "debug", "z": "75c53969.aa5438", "name": "debug mosquito", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -5719,18 +5778,14 @@ "statusVal": "", "statusType": "auto", "x": 1320, - "y": 1800 + "y": 1800, + "wires": [] }, { "id": "18eb0644ca136b1c", "type": "function", "z": "75c53969.aa5438", "name": "music start time", - "wires": [ - [ - "5fc7f988eeaa078a" - ] - ], "func": "var wakeUpTime = flow.get('weekday_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekday_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -15; \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -5739,18 +5794,18 @@ "finalize": "", "libs": [], "x": 880, - "y": 420 + "y": 420, + "wires": [ + [ + "5fc7f988eeaa078a" + ] + ] }, { "id": "5fc7f988eeaa078a", "type": "schedex", "z": "75c53969.aa5438", "name": "Music timer", - "wires": [ - [ - "f217821d98198307" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -5773,19 +5828,18 @@ "sat": false, "sun": false, "x": 1130, - "y": 420 + "y": 420, + "wires": [ + [ + "f217821d98198307" + ] + ] }, { "id": "f217821d98198307", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Wake up with music?", - "wires": [ - [ - "0f08977fb2d830db" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5813,18 +5867,19 @@ "forType": "num", "forUnits": "minutes", "x": 1680, - "y": 420 + "y": 420, + "wires": [ + [ + "0f08977fb2d830db" + ], + [] + ] }, { "id": "a5df6ad625909fe6", "type": "schedex", "z": "75c53969.aa5438", "name": "Music timer", - "wires": [ - [ - "4b05a68f256549b9" - ] - ], "passthroughunhandled": false, "suspended": false, "lat": "", @@ -5847,19 +5902,18 @@ "sat": true, "sun": true, "x": 1130, - "y": 1060 + "y": 1060, + "wires": [ + [ + "4b05a68f256549b9" + ] + ] }, { "id": "4b05a68f256549b9", "type": "api-current-state", "z": "75c53969.aa5438", "name": "Wake up with music?", - "wires": [ - [ - "0f08977fb2d830db" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -5887,18 +5941,19 @@ "forType": "num", "forUnits": "minutes", "x": 1660, - "y": 1060 + "y": 1060, + "wires": [ + [ + "0f08977fb2d830db" + ], + [] + ] }, { "id": "0f08977fb2d830db", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Select Bedroom Only Audio", - "wires": [ - [ - "5502ac50650b12cb" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5920,18 +5975,18 @@ "domain": "input_button", "service": "press", "x": 2040, - "y": 640 + "y": 640, + "wires": [ + [ + "5502ac50650b12cb" + ] + ] }, { "id": "5502ac50650b12cb", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Mute bedroom speaker", - "wires": [ - [ - "f463cbf3032fb2f2" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5953,18 +6008,18 @@ "domain": "media_player", "service": "volume_set", "x": 2030, - "y": 720 + "y": 720, + "wires": [ + [ + "f463cbf3032fb2f2" + ] + ] }, { "id": "f463cbf3032fb2f2", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Connect Spotify to Speaker", - "wires": [ - [ - "28e6f5f6f6e710a8" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -5986,18 +6041,18 @@ "domain": "media_player", "service": "select_source", "x": 2040, - "y": 800 + "y": 800, + "wires": [ + [ + "28e6f5f6f6e710a8" + ] + ] }, { "id": "28e6f5f6f6e710a8", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Start Wakeup Playlist on speaker", - "wires": [ - [ - "231c5343ad084e80" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6019,18 +6074,18 @@ "domain": "media_player", "service": "play_media", "x": 2060, - "y": 880 + "y": 880, + "wires": [ + [ + "231c5343ad084e80" + ] + ] }, { "id": "231c5343ad084e80", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Enable shuffle", - "wires": [ - [ - "efc99a6dfef495c0" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6052,18 +6107,18 @@ "domain": "media_player", "service": "shuffle_set", "x": 2380, - "y": 640 + "y": 640, + "wires": [ + [ + "efc99a6dfef495c0" + ] + ] }, { "id": "efc99a6dfef495c0", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Jump to next song (trigger shuffle)", - "wires": [ - [ - "868fbd6ef36820ae" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6085,16 +6140,18 @@ "domain": "media_player", "service": "media_next_track", "x": 2440, - "y": 720 + "y": 720, + "wires": [ + [ + "868fbd6ef36820ae" + ] + ] }, { "id": "fb76d5441934b190", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Set volume", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6118,36 +6175,34 @@ "domain": "media_player", "service": "volume_set", "x": 2370, - "y": 1000 + "y": 1000, + "wires": [ + [] + ] }, { "id": "63957f6f9c0a3608", "type": "easing", "z": "75c53969.aa5438", "name": "Calculate fade in volume", - "wires": [ - [ - "adaa9a5b2cc96879" - ] - ], "easingType": "linear", "outputType": "overTime", "duration": "60000", "interval": "15000", "numberOfValues": 10, "x": 2410, - "y": 860 + "y": 860, + "wires": [ + [ + "adaa9a5b2cc96879" + ] + ] }, { "id": "868fbd6ef36820ae", "type": "change", "z": "75c53969.aa5438", "name": "Set volume parameters", - "wires": [ - [ - "63957f6f9c0a3608" - ] - ], "rules": [ { "t": "set", @@ -6163,18 +6218,18 @@ "to": "", "reg": false, "x": 2410, - "y": 800 + "y": 800, + "wires": [ + [ + "63957f6f9c0a3608" + ] + ] }, { "id": "adaa9a5b2cc96879", "type": "calculator", "z": "75c53969.aa5438", "name": "Round to max 2 decimals", - "wires": [ - [ - "fb76d5441934b190" - ] - ], "inputMsgField": "payload", "outputMsgField": "payload", "operation": "rdec", @@ -6184,18 +6239,18 @@ "decimals": "0", "decimals2": 0, "x": 2410, - "y": 920 + "y": 920, + "wires": [ + [ + "fb76d5441934b190" + ] + ] }, { "id": "11ee3e0ecc62415e", "type": "function", "z": "75c53969.aa5438", "name": "music start time", - "wires": [ - [ - "a5df6ad625909fe6" - ] - ], "func": "var wakeUpTime = flow.get('weekend_wakeup_time').substr(0,5);\nvar wakeUpFade = parseInt(flow.get('weekend_wakeup_fade'));\n\nvar newMsg = {};\nnewMsg.payload = {}\nnewMsg.payload.ontime = wakeUpTime;\nnewMsg.payload.onoffset = -15; \n\nreturn newMsg;", "outputs": 1, "timeout": "", @@ -6204,61 +6259,63 @@ "finalize": "", "libs": [], "x": 880, - "y": 1060 + "y": 1060, + "wires": [ + [ + "a5df6ad625909fe6" + ] + ] }, { "id": "0d71ce9b2c0312fb", "type": "comment", "z": "75c53969.aa5438", "name": "Wake up music sequence", - "wires": [], "info": " - Start muted to jump awake\n - Skip to next to song to trigger shuffle mechanism, Spotify by default starts with the first song\n - Incrementally increase volume to have a nice experience", "x": 2030, - "y": 580 + "y": 580, + "wires": [] }, { "id": "p2catch_wku", "type": "catch", "z": "75c53969.aa5438", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 2000, "wires": [ [ "p2fmt_wku" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 2000 + ] }, { "id": "p2fmt_wku", "type": "function", "z": "75c53969.aa5438", "name": "Format error", - "wires": [ - [ - "p2ntfy_wku" - ] - ], "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: Wake up & mosquito',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 2000 + "y": 2000, + "wires": [ + [ + "p2ntfy_wku" + ] + ] }, { "id": "p2ntfy_wku", "type": "api-call-service", "z": "75c53969.aa5438", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6280,23 +6337,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 2000 - }, - { - "type": "tab", - "label": "Home Audio", - "id": "f02b32ef07b4b378" + "y": 2000, + "wires": [ + [] + ] }, { "id": "bc24bd25f183a7ac", "type": "inject", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "3b572aa5a025838b" - ] - ], "props": [ { "p": "payload" @@ -6314,18 +6364,18 @@ "payload": "", "payloadType": "date", "x": 140, - "y": 1760 + "y": 1760, + "wires": [ + [ + "3b572aa5a025838b" + ] + ] }, { "id": "3b572aa5a025838b", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Join media players", - "wires": [ - [ - "ed251e315e4c2c9f" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6347,14 +6397,18 @@ "domain": "media_player", "service": "join", "x": 370, - "y": 1760 + "y": 1760, + "wires": [ + [ + "ed251e315e4c2c9f" + ] + ] }, { "id": "ed251e315e4c2c9f", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 8", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -6363,18 +6417,14 @@ "statusVal": "", "statusType": "auto", "x": 660, - "y": 1760 + "y": 1760, + "wires": [] }, { "id": "7ad8e1f3e2e0968a", "type": "inject", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "b298882274d1cdf3" - ] - ], "props": [ { "p": "payload" @@ -6392,18 +6442,18 @@ "payload": "", "payloadType": "date", "x": 140, - "y": 1840 + "y": 1840, + "wires": [ + [ + "b298882274d1cdf3" + ] + ] }, { "id": "b298882274d1cdf3", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Unjoin media players", - "wires": [ - [ - "bdd2b9572315b352" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6427,14 +6477,18 @@ "domain": "media_player", "service": "unjoin", "x": 380, - "y": 1840 + "y": 1840, + "wires": [ + [ + "bdd2b9572315b352" + ] + ] }, { "id": "bdd2b9572315b352", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 9", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -6443,18 +6497,14 @@ "statusVal": "", "statusType": "auto", "x": 660, - "y": 1840 + "y": 1840, + "wires": [] }, { "id": "a17410f072874366", "type": "inject", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "d94c32c408534cea" - ] - ], "props": [ { "p": "payload" @@ -6472,18 +6522,18 @@ "payload": "true", "payloadType": "bool", "x": 130, - "y": 1960 + "y": 1960, + "wires": [ + [ + "d94c32c408534cea" + ] + ] }, { "id": "d94c32c408534cea", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Unmute/Mute media players", - "wires": [ - [ - "c262b732d4b31093" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6507,14 +6557,18 @@ "domain": "media_player", "service": "volume_mute", "x": 400, - "y": 1960 + "y": 1960, + "wires": [ + [ + "c262b732d4b31093" + ] + ] }, { "id": "c262b732d4b31093", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 10", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -6523,18 +6577,14 @@ "statusVal": "", "statusType": "auto", "x": 660, - "y": 1960 + "y": 1960, + "wires": [] }, { "id": "023b11d63a8f319c", "type": "inject", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "d94c32c408534cea" - ] - ], "props": [ { "p": "payload" @@ -6552,18 +6602,18 @@ "payload": "false", "payloadType": "bool", "x": 130, - "y": 2020 + "y": 2020, + "wires": [ + [ + "d94c32c408534cea" + ] + ] }, { "id": "947aef7d0b37c64e", "type": "inject", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "b14ca76bd3f6d739" - ] - ], "props": [ { "p": "payload" @@ -6581,18 +6631,18 @@ "payload": "true", "payloadType": "bool", "x": 130, - "y": 2100 + "y": 2100, + "wires": [ + [ + "b14ca76bd3f6d739" + ] + ] }, { "id": "b14ca76bd3f6d739", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set volume to 20", - "wires": [ - [ - "7ff52464dc77aa88" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6616,14 +6666,18 @@ "domain": "media_player", "service": "volume_set", "x": 370, - "y": 2100 + "y": 2100, + "wires": [ + [ + "7ff52464dc77aa88" + ] + ] }, { "id": "7ff52464dc77aa88", "type": "debug", "z": "f02b32ef07b4b378", "name": "debug 12", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -6632,197 +6686,24 @@ "statusVal": "", "statusType": "auto", "x": 660, - "y": 2100 - }, - { - "id": "b35f9365319a9bd4", - "type": "server-state-changed", - "z": "f02b32ef07b4b378", - "name": "Kitchen motion sensor", - "wires": [ - [], - [] - ], - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "62ed34c9191cebca", - "entities": { - "entity": [ - "binary_sensor.kitchen_motion_sensor_occupancy" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": "", - "forType": "num", - "forUnits": "minutes", - "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": 140, - "y": 560 - }, - { - "id": "643f64eeb88d0dc2", - "type": "server-state-changed", - "z": "f02b32ef07b4b378", - "name": "Bedroom motion sensor", - "wires": [ - [], - [] - ], - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "62ed34c9191cebca", - "entities": { - "entity": [ - "binary_sensor.bedroom_motion_sensor_occupancy" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": "", - "forType": "num", - "forUnits": "minutes", - "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": 140, - "y": 620 - }, - { - "id": "b613959939f3fdb7", - "type": "server-state-changed", - "z": "f02b32ef07b4b378", - "name": "Kitchen motion sensor", - "wires": [ - [], - [] - ], - "server": "657c7463.48e1e4", - "version": 6, - "outputs": 2, - "exposeAsEntityConfig": "62ed34c9191cebca", - "entities": { - "entity": [ - "binary_sensor.kitchen_motion_sensor_occupancy" - ], - "substring": [], - "regex": [] - }, - "outputInitially": false, - "stateType": "str", - "ifState": "on", - "ifStateType": "str", - "ifStateOperator": "is", - "outputOnlyOnStateChange": true, - "for": "", - "forType": "num", - "forUnits": "minutes", - "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": 140, - "y": 680 + "y": 2100, + "wires": [] }, { "id": "b57cf93b3481bb17", "type": "comment", "z": "f02b32ef07b4b378", "name": "Speaker config buttons", - "wires": [], "info": "", "x": 140, - "y": 80 + "y": 80, + "wires": [] }, { "id": "73bf252f2983ae0c", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Mute Speakers", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -6844,16 +6725,16 @@ "domain": "media_player", "service": "volume_mute", "x": 800, - "y": 200 + "y": 200, + "wires": [ + [] + ] }, { "id": "e8d4582f1a35b5fe", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Umute Speakers", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -6875,19 +6756,16 @@ "domain": "media_player", "service": "volume_mute", "x": 810, - "y": 240 + "y": 240, + "wires": [ + [] + ] }, { "id": "9c40d4014ed62a08", "type": "change", "z": "f02b32ef07b4b378", "name": "Kitchen audio config", - "wires": [ - [ - "73bf252f2983ae0c", - "e8d4582f1a35b5fe" - ] - ], "rules": [ { "t": "set", @@ -6910,19 +6788,19 @@ "to": "", "reg": false, "x": 420, - "y": 120 + "y": 120, + "wires": [ + [ + "73bf252f2983ae0c", + "e8d4582f1a35b5fe" + ] + ] }, { "id": "4a3201a1c23eb1bd", "type": "change", "z": "f02b32ef07b4b378", "name": "Bedroom audio config", - "wires": [ - [ - "73bf252f2983ae0c", - "e8d4582f1a35b5fe" - ] - ], "rules": [ { "t": "set", @@ -6945,19 +6823,19 @@ "to": "", "reg": false, "x": 420, - "y": 180 + "y": 180, + "wires": [ + [ + "73bf252f2983ae0c", + "e8d4582f1a35b5fe" + ] + ] }, { "id": "ab34bd65550a49eb", "type": "change", "z": "f02b32ef07b4b378", "name": "Bathroom audio config", - "wires": [ - [ - "73bf252f2983ae0c", - "e8d4582f1a35b5fe" - ] - ], "rules": [ { "t": "set", @@ -6980,18 +6858,19 @@ "to": "", "reg": false, "x": 420, - "y": 240 + "y": 240, + "wires": [ + [ + "73bf252f2983ae0c", + "e8d4582f1a35b5fe" + ] + ] }, { "id": "1ce85c93fddec1ed", "type": "change", "z": "f02b32ef07b4b378", "name": "All speaker unmute config", - "wires": [ - [ - "e8d4582f1a35b5fe" - ] - ], "rules": [ { "t": "set", @@ -7007,18 +6886,18 @@ "to": "", "reg": false, "x": 430, - "y": 380 + "y": 380, + "wires": [ + [ + "e8d4582f1a35b5fe" + ] + ] }, { "id": "ed546967f38f4321", "type": "change", "z": "f02b32ef07b4b378", "name": "All speaker mute config", - "wires": [ - [ - "73bf252f2983ae0c" - ] - ], "rules": [ { "t": "set", @@ -7034,18 +6913,18 @@ "to": "", "reg": false, "x": 430, - "y": 440 + "y": 440, + "wires": [ + [ + "73bf252f2983ae0c" + ] + ] }, { "id": "4e372d2ae02e476f", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Kitchen audio button", - "wires": [ - [ - "9c40d4014ed62a08" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7092,18 +6971,18 @@ } ], "x": 130, - "y": 120 + "y": 120, + "wires": [ + [ + "9c40d4014ed62a08" + ] + ] }, { "id": "7e30cae17b6f1147", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Bedroom audio button", - "wires": [ - [ - "4a3201a1c23eb1bd" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7150,18 +7029,18 @@ } ], "x": 140, - "y": 180 + "y": 180, + "wires": [ + [ + "4a3201a1c23eb1bd" + ] + ] }, { "id": "7087100e45352fd6", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Bathroom audio button", - "wires": [ - [ - "ab34bd65550a49eb" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7208,18 +7087,18 @@ } ], "x": 140, - "y": 240 + "y": 240, + "wires": [ + [ + "ab34bd65550a49eb" + ] + ] }, { "id": "1e1bbdf54bcc0e71", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "All speakers unmute button", - "wires": [ - [ - "1ce85c93fddec1ed" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7266,18 +7145,18 @@ } ], "x": 150, - "y": 380 + "y": 380, + "wires": [ + [ + "1ce85c93fddec1ed" + ] + ] }, { "id": "0dada2e07914212e", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "All speakers mute button", - "wires": [ - [ - "ed546967f38f4321" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7324,38 +7203,28 @@ } ], "x": 150, - "y": 440 - }, - { - "id": "83cfde5f5f29bfee", - "type": "comment", - "z": "f02b32ef07b4b378", - "name": "Audio Follow system", - "wires": [], - "info": "", - "x": 130, - "y": 520 + "y": 440, + "wires": [ + [ + "ed546967f38f4321" + ] + ] }, { "id": "d6a335eabf0309af", "type": "comment", "z": "f02b32ef07b4b378", "name": "Speaker time out", - "wires": [], "info": "", "x": 120, - "y": 820 + "y": 820, + "wires": [] }, { "id": "8d0c16fdcaa044c5", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Music fade out button", - "wires": [ - [ - "5a53dda5700dcbd4" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7402,18 +7271,18 @@ } ], "x": 140, - "y": 860 + "y": 860, + "wires": [ + [ + "5a53dda5700dcbd4" + ] + ] }, { "id": "487f7f9cb870301d", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set bedroom volume", - "wires": [ - [ - "470f04a1f67ed2c5" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -7435,36 +7304,36 @@ "domain": "media_player", "service": "volume_set", "x": 1700, - "y": 1020 + "y": 1020, + "wires": [ + [ + "470f04a1f67ed2c5" + ] + ] }, { "id": "099e68b4526af252", "type": "easing", "z": "f02b32ef07b4b378", "name": "Calculate fade in volume", - "wires": [ - [ - "148bfd7bfd19a3f2" - ] - ], "easingType": "linear", "outputType": "overTime", "duration": "30000", "interval": "2000", "numberOfValues": 10, "x": 1710, - "y": 880 + "y": 880, + "wires": [ + [ + "148bfd7bfd19a3f2" + ] + ] }, { "id": "465266c8ebc87190", "type": "change", "z": "f02b32ef07b4b378", "name": "Set volume parameters", - "wires": [ - [ - "099e68b4526af252" - ] - ], "rules": [ { "t": "set", @@ -7480,18 +7349,18 @@ "to": "", "reg": false, "x": 1710, - "y": 820 + "y": 820, + "wires": [ + [ + "099e68b4526af252" + ] + ] }, { "id": "148bfd7bfd19a3f2", "type": "calculator", "z": "f02b32ef07b4b378", "name": "Round to max 2 decimals", - "wires": [ - [ - "487f7f9cb870301d" - ] - ], "inputMsgField": "payload", "outputMsgField": "payload", "operation": "rdec", @@ -7501,18 +7370,18 @@ "decimals": "0", "decimals2": 0, "x": 1710, - "y": 940 + "y": 940, + "wires": [ + [ + "487f7f9cb870301d" + ] + ] }, { "id": "5a53dda5700dcbd4", "type": "trigger", "z": "f02b32ef07b4b378", "name": "20min trigger to start fade out", - "wires": [ - [ - "64d51f4ce06f71bb" - ] - ], "op1": "", "op2": "off", "op1type": "nul", @@ -7526,18 +7395,18 @@ "topic": "topic", "outputs": 1, "x": 480, - "y": 860 + "y": 860, + "wires": [ + [ + "64d51f4ce06f71bb" + ] + ] }, { "id": "243eaae96c3615b7", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Music cancel fade out button", - "wires": [ - [ - "5a53dda5700dcbd4" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7572,21 +7441,18 @@ } ], "x": 160, - "y": 920 + "y": 920, + "wires": [ + [ + "5a53dda5700dcbd4" + ] + ] }, { "id": "658612bb048cebd0", "type": "api-current-state", "z": "f02b32ef07b4b378", "name": "Get bedroom volume", - "wires": [ - [ - "9df152f9e9ea7a00" - ], - [ - "2c391596726d163a" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -7619,18 +7485,21 @@ "entity_location": "data", "override_data": "msg", "x": 740, - "y": 860 + "y": 860, + "wires": [ + [ + "9df152f9e9ea7a00" + ], + [ + "2c391596726d163a" + ] + ] }, { "id": "eee9cae5a34371af", "type": "change", "z": "f02b32ef07b4b378", "name": "Set default volume", - "wires": [ - [ - "465266c8ebc87190" - ] - ], "rules": [ { "t": "set", @@ -7646,16 +7515,18 @@ "to": "", "reg": false, "x": 1350, - "y": 860 + "y": 860, + "wires": [ + [ + "465266c8ebc87190" + ] + ] }, { "id": "2c391596726d163a", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Stop media players", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -7680,18 +7551,16 @@ "domain": "media_player", "service": "media_stop", "x": 1690, - "y": 1180 + "y": 1180, + "wires": [ + [] + ] }, { "id": "470f04a1f67ed2c5", "type": "switch", "z": "f02b32ef07b4b378", "name": "Volume all the way down?", - "wires": [ - [ - "2c391596726d163a" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -7705,21 +7574,18 @@ "repair": false, "outputs": 1, "x": 1710, - "y": 1100 + "y": 1100, + "wires": [ + [ + "2c391596726d163a" + ] + ] }, { "id": "32128a2d9466c2a5", "type": "switch", "z": "f02b32ef07b4b378", "name": "Volume is numeric?", - "wires": [ - [ - "465266c8ebc87190" - ], - [ - "eee9cae5a34371af" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -7736,18 +7602,21 @@ "repair": false, "outputs": 2, "x": 1350, - "y": 800 + "y": 800, + "wires": [ + [ + "465266c8ebc87190" + ], + [ + "eee9cae5a34371af" + ] + ] }, { "id": "9df152f9e9ea7a00", "type": "change", "z": "f02b32ef07b4b378", "name": "Set volume from speaker", - "wires": [ - [ - "32128a2d9466c2a5" - ] - ], "rules": [ { "t": "set", @@ -7768,16 +7637,18 @@ "to": "", "reg": false, "x": 1030, - "y": 860 + "y": 860, + "wires": [ + [ + "32128a2d9466c2a5" + ] + ] }, { "id": "64d51f4ce06f71bb", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Stop media players", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -7802,29 +7673,26 @@ "domain": "media_player", "service": "media_stop", "x": 730, - "y": 920 + "y": 920, + "wires": [ + [] + ] }, { "id": "7537b14f401fe338", "type": "comment", "z": "f02b32ef07b4b378", "name": "Disabled fade out flow (breaks HEOS + spotify)", - "wires": [], "info": "", "x": 820, - "y": 820 + "y": 820, + "wires": [] }, { "id": "691572bc73058f7b", "type": "change", "z": "f02b32ef07b4b378", "name": "Livingroom audio config", - "wires": [ - [ - "73bf252f2983ae0c", - "e8d4582f1a35b5fe" - ] - ], "rules": [ { "t": "set", @@ -7847,18 +7715,19 @@ "to": "", "reg": false, "x": 430, - "y": 300 + "y": 300, + "wires": [ + [ + "73bf252f2983ae0c", + "e8d4582f1a35b5fe" + ] + ] }, { "id": "483ec65e18051a31", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Livingroom audio button", - "wires": [ - [ - "691572bc73058f7b" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7905,28 +7774,28 @@ } ], "x": 140, - "y": 300 + "y": 300, + "wires": [ + [ + "691572bc73058f7b" + ] + ] }, { "id": "aa6cfabebf9a872f", "type": "comment", "z": "f02b32ef07b4b378", "name": "Grouping and ungrouping", - "wires": [], "info": "", "x": 150, - "y": 1040 + "y": 1040, + "wires": [] }, { "id": "0a5de0c3e1526c14", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all", - "wires": [ - [ - "608262f04a2a221d" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -7973,18 +7842,18 @@ } ], "x": 100, - "y": 1080 + "y": 1080, + "wires": [ + [ + "608262f04a2a221d" + ] + ] }, { "id": "756d563e795b953a", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl. livingroom", - "wires": [ - [ - "80be5093f48e88fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -8031,18 +7900,18 @@ } ], "x": 150, - "y": 1140 + "y": 1140, + "wires": [ + [ + "80be5093f48e88fc" + ] + ] }, { "id": "a83c93f336d93f56", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl bathroom", - "wires": [ - [ - "aaafe15411371f43" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -8089,18 +7958,18 @@ } ], "x": 150, - "y": 1200 + "y": 1200, + "wires": [ + [ + "aaafe15411371f43" + ] + ] }, { "id": "0fe637de86520e51", "type": "server-state-changed", "z": "f02b32ef07b4b378", "name": "Group all, excl bedroom", - "wires": [ - [ - "980d8e52b0eceaff" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -8147,16 +8016,18 @@ } ], "x": 140, - "y": 1260 + "y": 1260, + "wires": [ + [ + "980d8e52b0eceaff" + ] + ] }, { "id": "ccc51eb8edf2e33d", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Join all speakers", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8176,18 +8047,16 @@ "domain": "media_player", "service": "join", "x": 1130, - "y": 1180 + "y": 1180, + "wires": [ + [] + ] }, { "id": "608262f04a2a221d", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", - "wires": [ - [ - "ccc51eb8edf2e33d" - ] - ], "rules": [ { "t": "set", @@ -8210,18 +8079,18 @@ "to": "", "reg": false, "x": 450, - "y": 1080 + "y": 1080, + "wires": [ + [ + "ccc51eb8edf2e33d" + ] + ] }, { "id": "80be5093f48e88fc", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", - "wires": [ - [ - "ccc51eb8edf2e33d" - ] - ], "rules": [ { "t": "set", @@ -8244,18 +8113,18 @@ "to": "", "reg": false, "x": 450, - "y": 1140 + "y": 1140, + "wires": [ + [ + "ccc51eb8edf2e33d" + ] + ] }, { "id": "aaafe15411371f43", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", - "wires": [ - [ - "ccc51eb8edf2e33d" - ] - ], "rules": [ { "t": "set", @@ -8278,18 +8147,18 @@ "to": "", "reg": false, "x": 450, - "y": 1200 + "y": 1200, + "wires": [ + [ + "ccc51eb8edf2e33d" + ] + ] }, { "id": "980d8e52b0eceaff", "type": "change", "z": "f02b32ef07b4b378", "name": "Set leader and followers", - "wires": [ - [ - "ccc51eb8edf2e33d" - ] - ], "rules": [ { "t": "set", @@ -8312,29 +8181,28 @@ "to": "", "reg": false, "x": 450, - "y": 1260 + "y": 1260, + "wires": [ + [ + "ccc51eb8edf2e33d" + ] + ] }, { "id": "1278b99a481e6dd1", "type": "comment", "z": "f02b32ef07b4b378", "name": "Home Theather volume control on heos start", - "wires": [], "info": "", "x": 210, - "y": 1360 + "y": 1360, + "wires": [] }, { "id": "5f677939f2c09f28", "type": "trigger-state", "z": "f02b32ef07b4b378", "name": "Switching home theather to heos", - "wires": [ - [ - "8c788d92123228cb" - ], - [] - ], "server": "657c7463.48e1e4", "version": 5, "inputs": 0, @@ -8373,18 +8241,19 @@ "stateType": "str", "enableInput": false, "x": 170, - "y": 1400 + "y": 1400, + "wires": [ + [ + "8c788d92123228cb" + ], + [] + ] }, { "id": "8c788d92123228cb", "type": "delay", "z": "f02b32ef07b4b378", "name": "", - "wires": [ - [ - "f1ddda7676ab9bbc" - ] - ], "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", @@ -8398,18 +8267,18 @@ "allowrate": false, "outputs": 1, "x": 430, - "y": 1400 + "y": 1400, + "wires": [ + [ + "f1ddda7676ab9bbc" + ] + ] }, { "id": "f1ddda7676ab9bbc", "type": "api-current-state", "z": "f02b32ef07b4b378", "name": "Fetch bedroom volume", - "wires": [ - [ - "087e6e0c92150113" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -8442,18 +8311,18 @@ "entity_location": "data", "override_data": "msg", "x": 630, - "y": 1400 + "y": 1400, + "wires": [ + [ + "087e6e0c92150113" + ] + ] }, { "id": "087e6e0c92150113", "type": "change", "z": "f02b32ef07b4b378", "name": "Calculate volume", - "wires": [ - [ - "8a59f44f4fc0c8d0" - ] - ], "rules": [ { "t": "set", @@ -8469,16 +8338,18 @@ "to": "", "reg": false, "x": 880, - "y": 1400 + "y": 1400, + "wires": [ + [ + "8a59f44f4fc0c8d0" + ] + ] }, { "id": "8a59f44f4fc0c8d0", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Set home theather volume", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8498,51 +8369,51 @@ "domain": "media_player", "service": "volume_set", "x": 1160, - "y": 1400 + "y": 1400, + "wires": [ + [] + ] }, { "id": "p2catch_aud", "type": "catch", "z": "f02b32ef07b4b378", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 2300, "wires": [ [ "p2fmt_aud" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 2300 + ] }, { "id": "p2fmt_aud", "type": "function", "z": "f02b32ef07b4b378", "name": "Format error", - "wires": [ - [ - "p2ntfy_aud" - ] - ], "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: Home Audio',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 2300 + "y": 2300, + "wires": [ + [ + "p2ntfy_aud" + ] + ] }, { "id": "p2ntfy_aud", "type": "api-call-service", "z": "f02b32ef07b4b378", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8564,24 +8435,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 2300 - }, - { - "type": "tab", - "label": "Home Media", - "id": "da896085.24c698" + "y": 2300, + "wires": [ + [] + ] }, { "id": "c8d37a58.56051", "type": "server-state-changed", "z": "da896085.24c698", "name": "Remote is on", - "wires": [ - [ - "73d6c796.13d8f8" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -8623,14 +8486,19 @@ } ], "x": 130, - "y": 80 + "y": 80, + "wires": [ + [ + "73d6c796.13d8f8" + ], + [] + ] }, { "id": "275763d9.2d137c", "type": "debug", "z": "da896085.24c698", "name": "", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -8638,20 +8506,14 @@ "complete": "true", "targetType": "full", "x": 590, - "y": 260 + "y": 260, + "wires": [] }, { "id": "73d6c796.13d8f8", "type": "switch", "z": "da896085.24c698", "name": "", - "wires": [ - [ - "275763d9.2d137c" - ], - [], - [] - ], "property": "data.new_state.attributes.current_activity", "propertyType": "msg", "rules": [ @@ -8675,16 +8537,20 @@ "repair": false, "outputs": 3, "x": 390, - "y": 80 + "y": 80, + "wires": [ + [ + "275763d9.2d137c" + ], + [], + [] + ] }, { "id": "f337ae51.b639e", "type": "api-call-service", "z": "da896085.24c698", "name": "Switch to TV Scene", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8706,51 +8572,51 @@ "output_location": "", "output_location_type": "none", "x": 890, - "y": 60 + "y": 60, + "wires": [ + [] + ] }, { "id": "p2catch_med", "type": "catch", "z": "da896085.24c698", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 460, "wires": [ [ "p2fmt_med" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 460 + ] }, { "id": "p2fmt_med", "type": "function", "z": "da896085.24c698", "name": "Format error", - "wires": [ - [ - "p2ntfy_med" - ] - ], "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: Home Media',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 460 + "y": 460, + "wires": [ + [ + "p2ntfy_med" + ] + ] }, { "id": "p2ntfy_med", "type": "api-call-service", "z": "da896085.24c698", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8772,23 +8638,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 460 - }, - { - "type": "tab", - "label": "Motion detection", - "id": "a9edb9da.ccb6d" + "y": 460, + "wires": [ + [] + ] }, { "id": "f3a37054.39c5e", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Bathroom Motion", - "wires": [ - [ - "a621255c.9f3f68" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -8830,22 +8689,18 @@ } ], "x": 160, - "y": 180 + "y": 180, + "wires": [ + [ + "a621255c.9f3f68" + ] + ] }, { "id": "a621255c.9f3f68", "type": "switch", "z": "a9edb9da.ccb6d", "name": "On or Off", - "wires": [ - [ - "3d6da756.4dd7d8", - "2a6b709d.d09008" - ], - [ - "2a6b709d.d09008" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -8864,16 +8719,22 @@ "repair": false, "outputs": 2, "x": 340, - "y": 180 + "y": 180, + "wires": [ + [ + "3d6da756.4dd7d8", + "2a6b709d.d09008" + ], + [ + "2a6b709d.d09008" + ] + ] }, { "id": "a4c3349e.8a322", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn on", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8895,16 +8756,16 @@ "output_location": "", "output_location_type": "none", "x": 1140, - "y": 160 + "y": 160, + "wires": [ + [] + ] }, { "id": "53fec2fd.96730c", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn off", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -8928,19 +8789,16 @@ "output_location": "", "output_location_type": "none", "x": 1020, - "y": 300 + "y": 300, + "wires": [ + [] + ] }, { "id": "3d6da756.4dd7d8", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Bathroom light status", - "wires": [ - [ - "251c7437.a18554" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -8968,38 +8826,39 @@ "forType": "num", "forUnits": "minutes", "x": 620, - "y": 60 + "y": 60, + "wires": [ + [ + "251c7437.a18554" + ], + [] + ] }, { "id": "2a6b709d.d09008", "type": "stoptimer-varidelay", "z": "a9edb9da.ccb6d", + "duration": "120", + "durationType": "num", + "units": "Second", + "payloadtype": "num", + "payloadval": "0", "name": "", + "x": 710, + "y": 240, "wires": [ [ "d550e021.fe23a" ], [], [] - ], - "duration": "120", - "durationType": "num", - "units": "Second", - "payloadtype": "num", - "payloadval": "0", - "x": 710, - "y": 240 + ] }, { "id": "b2bc4296.7de718", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Hallway Motion", - "wires": [ - [ - "a15cb282.9b59a8" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -9041,22 +8900,18 @@ } ], "x": 180, - "y": 460 + "y": 460, + "wires": [ + [ + "a15cb282.9b59a8" + ] + ] }, { "id": "a15cb282.9b59a8", "type": "switch", "z": "a9edb9da.ccb6d", "name": "On or Off", - "wires": [ - [ - "e13f2dd9.12937", - "8d847d6b.3e76c8" - ], - [ - "8d847d6b.3e76c8" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -9075,16 +8930,22 @@ "repair": false, "outputs": 2, "x": 380, - "y": 460 + "y": 460, + "wires": [ + [ + "e13f2dd9.12937", + "8d847d6b.3e76c8" + ], + [ + "8d847d6b.3e76c8" + ] + ] }, { "id": "8a2e7e1b.11471", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn off", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -9108,19 +8969,16 @@ "output_location": "", "output_location_type": "none", "x": 1160, - "y": 600 + "y": 600, + "wires": [ + [] + ] }, { "id": "e13f2dd9.12937", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Hallway light status", - "wires": [ - [ - "74e4cae8.021cc4" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -9148,34 +9006,43 @@ "forType": "num", "forUnits": "minutes", "x": 610, - "y": 420 + "y": 420, + "wires": [ + [ + "74e4cae8.021cc4" + ], + [] + ] }, { "id": "8d847d6b.3e76c8", "type": "stoptimer-varidelay", "z": "a9edb9da.ccb6d", + "duration": "120", + "durationType": "num", + "units": "Second", + "payloadtype": "num", + "payloadval": "0", "name": "", + "persist": false, + "x": 670, + "y": 560, "wires": [ [ "84dd47fc.401908" ], [], [] - ], - "duration": "120", - "durationType": "num", - "units": "Second", - "payloadtype": "num", - "payloadval": "0", - "persist": false, - "x": 670, - "y": 560 + ] }, { "id": "2a492dfb.c1d1aa", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", + "env": [], + "x": 630, + "y": 160, "wires": [ [ "2046a794.95dbf8" @@ -9183,21 +9050,13 @@ [ "2046a794.95dbf8" ] - ], - "env": [], - "x": 630, - "y": 160 + ] }, { "id": "251c7437.a18554", "type": "change", "z": "a9edb9da.ccb6d", "name": "Day Mode", - "wires": [ - [ - "a4c3349e.8a322" - ] - ], "rules": [ { "t": "set", @@ -9213,18 +9072,18 @@ "to": "", "reg": false, "x": 870, - "y": 180 + "y": 180, + "wires": [ + [ + "a4c3349e.8a322" + ] + ] }, { "id": "2046a794.95dbf8", "type": "change", "z": "a9edb9da.ccb6d", "name": "NIght Mode", - "wires": [ - [ - "a4c3349e.8a322" - ] - ], "rules": [ { "t": "set", @@ -9240,16 +9099,18 @@ "to": "", "reg": false, "x": 870, - "y": 140 + "y": 140, + "wires": [ + [ + "a4c3349e.8a322" + ] + ] }, { "id": "f75b8e7d.5a41", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Turn on", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -9271,13 +9132,19 @@ "output_location": "", "output_location_type": "none", "x": 1160, - "y": 500 + "y": 500, + "wires": [ + [] + ] }, { "id": "2ec0419c.2b47de", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", + "env": [], + "x": 650, + "y": 500, "wires": [ [ "75d95034.3eedb8" @@ -9285,21 +9152,13 @@ [ "75d95034.3eedb8" ] - ], - "env": [], - "x": 650, - "y": 500 + ] }, { "id": "74e4cae8.021cc4", "type": "change", "z": "a9edb9da.ccb6d", "name": "Day Mode", - "wires": [ - [ - "f75b8e7d.5a41" - ] - ], "rules": [ { "t": "set", @@ -9315,18 +9174,18 @@ "to": "", "reg": false, "x": 890, - "y": 520 + "y": 520, + "wires": [ + [ + "f75b8e7d.5a41" + ] + ] }, { "id": "75d95034.3eedb8", "type": "change", "z": "a9edb9da.ccb6d", "name": "NIght Mode", - "wires": [ - [ - "f75b8e7d.5a41" - ] - ], "rules": [ { "t": "set", @@ -9342,19 +9201,18 @@ "to": "", "reg": false, "x": 890, - "y": 480 + "y": 480, + "wires": [ + [ + "f75b8e7d.5a41" + ] + ] }, { "id": "d81ec1ce.a79708", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Bathroom Motion", - "wires": [ - [ - "871cbf67.15da1" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -9401,19 +9259,19 @@ } ], "x": 180, - "y": 740 + "y": 740, + "wires": [ + [ + "871cbf67.15da1" + ], + [] + ] }, { "id": "4f7b5988.be4f98", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Hallway Motion", - "wires": [ - [ - "968bedf.e30a31" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -9460,19 +9318,19 @@ } ], "x": 180, - "y": 800 + "y": 800, + "wires": [ + [ + "968bedf.e30a31" + ], + [] + ] }, { "id": "b0a84917.d9a89", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Livingroom Motion", - "wires": [ - [ - "d614641a.552438" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -9519,19 +9377,19 @@ } ], "x": 190, - "y": 860 + "y": 860, + "wires": [ + [ + "d614641a.552438" + ], + [] + ] }, { "id": "871cbf67.15da1", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Bathroom", - "wires": [ - [ - "7d3df8ac.4610c", - "bce32dc1.85221" - ] - ], "rules": [ { "t": "set", @@ -9547,19 +9405,19 @@ "to": "", "reg": false, "x": 400, - "y": 740 + "y": 740, + "wires": [ + [ + "7d3df8ac.4610c", + "bce32dc1.85221" + ] + ] }, { "id": "968bedf.e30a31", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Hallway", - "wires": [ - [ - "7d3df8ac.4610c", - "bce32dc1.85221" - ] - ], "rules": [ { "t": "set", @@ -9575,19 +9433,19 @@ "to": "", "reg": false, "x": 390, - "y": 800 + "y": 800, + "wires": [ + [ + "7d3df8ac.4610c", + "bce32dc1.85221" + ] + ] }, { "id": "d614641a.552438", "type": "change", "z": "a9edb9da.ccb6d", "name": "Set Livingroom", - "wires": [ - [ - "7d3df8ac.4610c", - "bce32dc1.85221" - ] - ], "rules": [ { "t": "set", @@ -9603,16 +9461,19 @@ "to": "", "reg": false, "x": 400, - "y": 860 + "y": 860, + "wires": [ + [ + "7d3df8ac.4610c", + "bce32dc1.85221" + ] + ] }, { "id": "7d3df8ac.4610c", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Update last motion to value", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -9636,16 +9497,16 @@ "output_location": "", "output_location_type": "none", "x": 770, - "y": 820 + "y": 820, + "wires": [ + [] + ] }, { "id": "c59f167c.f20e", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -9667,16 +9528,16 @@ "output_location": "", "output_location_type": "none", "x": 1010, - "y": 940 + "y": 940, + "wires": [ + [] + ] }, { "id": "bce32dc1.85221", "type": "template", "z": "a9edb9da.ccb6d", "name": "Motion detected in...", - "wires": [ - [] - ], "field": "payload", "fieldType": "msg", "format": "handlebars", @@ -9684,41 +9545,36 @@ "template": "Motion detected in {{payload}}.", "output": "str", "x": 720, - "y": 940 + "y": 940, + "wires": [ + [] + ] }, { "id": "7529dee.0a6322", "type": "comment", "z": "a9edb9da.ccb6d", "name": "Enable notifications when we have out of home detection", - "wires": [], "info": "", "x": 830, - "y": 900 + "y": 900, + "wires": [] }, { "id": "7b42fe61.f5b758", "type": "comment", "z": "a9edb9da.ccb6d", "name": "Set last motion entity", - "wires": [], "info": "", "x": 190, - "y": 700 + "y": 700, + "wires": [] }, { "id": "d550e021.fe23a", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Still in bathroom?", - "wires": [ - [ - "2a6b709d.d09008" - ], - [ - "53fec2fd.96730c" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -9746,13 +9602,24 @@ "forType": "num", "forUnits": "minutes", "x": 710, - "y": 320 + "y": 320, + "wires": [ + [ + "2a6b709d.d09008" + ], + [ + "53fec2fd.96730c" + ] + ] }, { "id": "3efd032.0055a7c", "type": "subflow:e52c44dc.71cb5", "z": "a9edb9da.ccb6d", "name": "", + "env": [], + "x": 550, + "y": 1100, "wires": [ [ "7c0d40bf.1ee4c" @@ -9760,21 +9627,13 @@ [ "7c0d40bf.1ee4c" ] - ], - "env": [], - "x": 550, - "y": 1100 + ] }, { "id": "a3eba9b6.df5ca8", "type": "inject", "z": "a9edb9da.ccb6d", "name": "", - "wires": [ - [ - "3efd032.0055a7c" - ] - ], "repeat": "", "crontab": "", "once": false, @@ -9783,32 +9642,32 @@ "payload": "", "payloadType": "date", "x": 320, - "y": 1080 + "y": 1080, + "wires": [ + [ + "3efd032.0055a7c" + ] + ] }, { "id": "7c0d40bf.1ee4c", "type": "debug", "z": "a9edb9da.ccb6d", "name": "", - "wires": [], "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 860, - "y": 1100 + "y": 1100, + "wires": [] }, { "id": "fc251c5a.cc6918", "type": "server-state-changed", "z": "a9edb9da.ccb6d", "name": "Last motion room updated", - "wires": [ - [ - "e3ecc53a.1c89e8" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -9855,18 +9714,18 @@ } ], "x": 210, - "y": 1000 + "y": 1000, + "wires": [ + [ + "e3ecc53a.1c89e8" + ] + ] }, { "id": "e3ecc53a.1c89e8", "type": "template", "z": "a9edb9da.ccb6d", "name": "Last motion variable set to...", - "wires": [ - [ - "c59f167c.f20e" - ] - ], "field": "payload", "fieldType": "msg", "format": "handlebars", @@ -9874,21 +9733,18 @@ "template": "Last motion variable set to: {{payload}}.", "output": "str", "x": 520, - "y": 1000 + "y": 1000, + "wires": [ + [ + "c59f167c.f20e" + ] + ] }, { "id": "84dd47fc.401908", "type": "api-current-state", "z": "a9edb9da.ccb6d", "name": "Still in Hallway?", - "wires": [ - [ - "8d847d6b.3e76c8" - ], - [ - "8a2e7e1b.11471" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -9916,51 +9772,56 @@ "forType": "num", "forUnits": "minutes", "x": 660, - "y": 640 + "y": 640, + "wires": [ + [ + "8d847d6b.3e76c8" + ], + [ + "8a2e7e1b.11471" + ] + ] }, { "id": "p2catch_mot", "type": "catch", "z": "a9edb9da.ccb6d", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1300, "wires": [ [ "p2fmt_mot" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 1300 + ] }, { "id": "p2fmt_mot", "type": "function", "z": "a9edb9da.ccb6d", "name": "Format error", - "wires": [ - [ - "p2ntfy_mot" - ] - ], "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: Motion detection',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1300 + "y": 1300, + "wires": [ + [ + "p2ntfy_mot" + ] + ] }, { "id": "p2ntfy_mot", "type": "api-call-service", "z": "a9edb9da.ccb6d", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -9982,23 +9843,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1300 - }, - { - "type": "tab", - "label": "Maintenance", - "id": "a320f821a7cb3f55" + "y": 1300, + "wires": [ + [] + ] }, { "id": "ecee1bee9953f98a", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Low Bat Sensors", - "wires": [ - [ - "5f8552a4635072aa" - ] - ], "server": "657c7463.48e1e4", "version": 1, "rules": [ @@ -10021,18 +9875,18 @@ "outputLocation": "payload", "outputResultsCount": 1, "x": 550, - "y": 180 + "y": 180, + "wires": [ + [ + "5f8552a4635072aa" + ] + ] }, { "id": "1b30535ba22c4655", "type": "inject", "z": "a320f821a7cb3f55", "name": "", - "wires": [ - [ - "293113adda48f9d0" - ] - ], "props": [ { "p": "payload" @@ -10050,14 +9904,18 @@ "payload": "", "payloadType": "date", "x": 160, - "y": 240 + "y": 240, + "wires": [ + [ + "293113adda48f9d0" + ] + ] }, { "id": "b9891a936c8fb9d0", "type": "debug", "z": "a320f821a7cb3f55", "name": "debug 3", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -10066,18 +9924,14 @@ "statusVal": "", "statusType": "auto", "x": 1040, - "y": 540 + "y": 540, + "wires": [] }, { "id": "556cc66d606c190e", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors - Low", - "wires": [ - [ - "5f8552a4635072aa" - ] - ], "server": "657c7463.48e1e4", "version": 1, "rules": [ @@ -10106,18 +9960,18 @@ "outputLocation": "payload", "outputResultsCount": 1, "x": 560, - "y": 300 + "y": 300, + "wires": [ + [ + "5f8552a4635072aa" + ] + ] }, { "id": "1e34ff50a693e724", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors", - "wires": [ - [ - "b9891a936c8fb9d0" - ] - ], "server": "657c7463.48e1e4", "version": 1, "rules": [ @@ -10134,16 +9988,18 @@ "outputLocation": "payload", "outputResultsCount": 1, "x": 540, - "y": 540 + "y": 540, + "wires": [ + [ + "b9891a936c8fb9d0" + ] + ] }, { "id": "89a7c77a676b858b", "type": "ha-get-entities", "z": "a320f821a7cb3f55", "name": "Battery Sensors - Unavailable", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 1, "rules": [ @@ -10172,58 +10028,56 @@ "outputLocation": "payload", "outputResultsCount": 1, "x": 590, - "y": 420 + "y": 420, + "wires": [ + [] + ] }, { "id": "91f002d04003ce84", "type": "comment", "z": "a320f821a7cb3f55", "name": "Filter for all *battery* entities", - "wires": [], "info": "", "x": 580, - "y": 500 + "y": 500, + "wires": [] }, { "id": "ac0b28356c7eb45a", "type": "comment", "z": "a320f821a7cb3f55", "name": "HomeMatic Devices", - "wires": [], "info": "", "x": 550, - "y": 140 + "y": 140, + "wires": [] }, { "id": "a8192e1fcbdc41aa", "type": "comment", "z": "a320f821a7cb3f55", "name": "Hue devices", - "wires": [], "info": "", "x": 530, - "y": 260 + "y": 260, + "wires": [] }, { "id": "6beef06f4f0b788d", "type": "comment", "z": "a320f821a7cb3f55", "name": "Any unavailable device", - "wires": [], "info": "", "x": 560, - "y": 380 + "y": 380, + "wires": [] }, { "id": "5f8552a4635072aa", "type": "split", "z": "a320f821a7cb3f55", "name": "", - "wires": [ - [ - "9dcd82782246d4e9" - ] - ], "splt": "\\n", "spltType": "str", "arraySplt": 1, @@ -10231,16 +10085,18 @@ "stream": false, "addname": "", "x": 850, - "y": 300 + "y": 300, + "wires": [ + [ + "9dcd82782246d4e9" + ] + ] }, { "id": "cc33a58286775199", "type": "api-call-service", "z": "a320f821a7cb3f55", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -10262,18 +10118,16 @@ "output_location": "", "output_location_type": "none", "x": 1270, - "y": 300 + "y": 300, + "wires": [ + [] + ] }, { "id": "9dcd82782246d4e9", "type": "template", "z": "a320f821a7cb3f55", "name": "", - "wires": [ - [ - "cc33a58286775199" - ] - ], "field": "payload", "fieldType": "msg", "format": "handlebars", @@ -10281,20 +10135,18 @@ "template": "Battery level low for {{payload.attributes.friendly_name}} ({{payload.state}}%)", "output": "str", "x": 1060, - "y": 300 + "y": 300, + "wires": [ + [ + "cc33a58286775199" + ] + ] }, { "id": "293113adda48f9d0", "type": "schedex", "z": "a320f821a7cb3f55", "name": "Saturday at 11:00", - "wires": [ - [ - "ecee1bee9953f98a", - "556cc66d606c190e", - "89a7c77a676b858b" - ] - ], "passthroughunhandled": true, "suspended": false, "lat": "", @@ -10317,40 +10169,41 @@ "sat": true, "sun": false, "x": 190, - "y": 300 + "y": 300, + "wires": [ + [ + "ecee1bee9953f98a", + "556cc66d606c190e", + "89a7c77a676b858b" + ] + ] }, { "id": "edaf40fcc105703a", "type": "comment", "z": "a320f821a7cb3f55", "name": "Battery state alerts for all devices", - "wires": [], "info": "", "x": 170, - "y": 140 + "y": 140, + "wires": [] }, { "id": "e4eda627074a2cf3", "type": "comment", "z": "a320f821a7cb3f55", "name": "Unavailable devices alert", - "wires": [], "info": "Any devices that becomes unavailable in Home Assistant will be reported. This might indicate zigbee connecticity issues.", "x": 150, - "y": 620 + "y": 620, + "wires": [] }, { "id": "a2a4917908eed983", "type": "trigger-state", "z": "a320f821a7cb3f55", - "name": "", - "wires": [ - [ - "deb32f94b6f9aad7" - ], - [] - ], "d": true, + "name": "", "server": "657c7463.48e1e4", "version": 5, "inputs": 0, @@ -10380,14 +10233,19 @@ "stateType": "str", "enableInput": false, "x": 120, - "y": 680 + "y": 680, + "wires": [ + [ + "deb32f94b6f9aad7" + ], + [] + ] }, { "id": "deb32f94b6f9aad7", "type": "debug", "z": "a320f821a7cb3f55", "name": "State changed debug", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -10397,38 +10255,34 @@ "statusVal": "", "statusType": "auto", "x": 500, - "y": 680 + "y": 680, + "wires": [] }, { "id": "comment-heos-individual", "type": "comment", "z": "a320f821a7cb3f55", "name": "HEOS individual speaker reset via TCP", - "wires": [], "info": "", "x": 200, - "y": 760 + "y": 760, + "wires": [] }, { "id": "comment-heos-all", "type": "comment", "z": "a320f821a7cb3f55", "name": "HEOS reset all speakers sequentially", - "wires": [], "info": "", "x": 200, - "y": 1120 + "y": 1120, + "wires": [] }, { "id": "heos-trigger-bedroom", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Bedroom", - "wires": [ - [ - "heos-change-target" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -10487,18 +10341,18 @@ } ], "x": 160, - "y": 800 + "y": 800, + "wires": [ + [ + "heos-change-target" + ] + ] }, { "id": "heos-trigger-kitchen", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Kitchen", - "wires": [ - [ - "heos-change-target" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -10557,18 +10411,18 @@ } ], "x": 160, - "y": 880 + "y": 880, + "wires": [ + [ + "heos-change-target" + ] + ] }, { "id": "heos-trigger-bathroom", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Bathroom", - "wires": [ - [ - "heos-change-target" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -10627,18 +10481,18 @@ } ], "x": 160, - "y": 960 + "y": 960, + "wires": [ + [ + "heos-change-target" + ] + ] }, { "id": "heos-trigger-hometheater", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset Speaker Home Theater", - "wires": [ - [ - "heos-change-target" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -10697,19 +10551,18 @@ } ], "x": 160, - "y": 1040 + "y": 1040, + "wires": [ + [ + "heos-change-target" + ] + ] }, { "id": "heos-change-target", "type": "change", "z": "a320f821a7cb3f55", "name": "Set speaker target", - "wires": [ - [ - "heos-tcp", - "heos-debug" - ] - ], "rules": [ { "t": "set", @@ -10746,16 +10599,19 @@ "to": "", "reg": false, "x": 410, - "y": 920 + "y": 920, + "wires": [ + [ + "heos-tcp", + "heos-debug" + ] + ] }, { "id": "heos-tcp", "type": "tcp request", "z": "a320f821a7cb3f55", "name": "Telnet HEOS", - "wires": [ - [] - ], "server": "", "port": "", "out": "immed", @@ -10765,14 +10621,16 @@ "trim": false, "tls": "", "x": 620, - "y": 880 + "y": 880, + "wires": [ + [] + ] }, { "id": "heos-debug", "type": "debug", "z": "a320f821a7cb3f55", "name": "HEOS command (debug)", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -10782,18 +10640,14 @@ "statusVal": "", "statusType": "auto", "x": 620, - "y": 960 + "y": 960, + "wires": [] }, { "id": "heos-trigger-all", "type": "server-state-changed", "z": "a320f821a7cb3f55", "name": "Reset All Speakers", - "wires": [ - [ - "heos-emit-all" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -10840,18 +10694,18 @@ } ], "x": 160, - "y": 1160 + "y": 1160, + "wires": [ + [ + "heos-emit-all" + ] + ] }, { "id": "heos-emit-all", "type": "function", "z": "a320f821a7cb3f55", "name": "Emit 4 button presses", - "wires": [ - [ - "heos-delay-all" - ] - ], "func": "const buttons = [\n \"input_button.reset_speaker_bedroom\",\n \"input_button.reset_speaker_kitchen\",\n \"input_button.reset_speaker_bathroom\",\n \"input_button.reset_speaker_home_theater\"\n];\nreturn [buttons.map(b => ({ ...msg, payload: b }))];", "outputs": 1, "noerr": 0, @@ -10859,18 +10713,18 @@ "finalize": "", "libs": [], "x": 380, - "y": 1160 + "y": 1160, + "wires": [ + [ + "heos-delay-all" + ] + ] }, { "id": "heos-delay-all", "type": "delay", "z": "a320f821a7cb3f55", "name": "5s between resets", - "wires": [ - [ - "heos-service-press" - ] - ], "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", @@ -10884,16 +10738,18 @@ "allowrate": false, "outputs": 1, "x": 580, - "y": 1160 + "y": 1160, + "wires": [ + [ + "heos-service-press" + ] + ] }, { "id": "heos-service-press", "type": "api-call-service", "z": "a320f821a7cb3f55", "name": "Press speaker reset button", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -10913,51 +10769,51 @@ "domain": "input_button", "service": "press", "x": 780, - "y": 1160 + "y": 1160, + "wires": [ + [] + ] }, { "id": "p2catch_mnt", "type": "catch", "z": "a320f821a7cb3f55", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1360, "wires": [ [ "p2fmt_mnt" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 1360 + ] }, { "id": "p2fmt_mnt", "type": "function", "z": "a320f821a7cb3f55", "name": "Format error", - "wires": [ - [ - "p2ntfy_mnt" - ] - ], "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: Maintenance',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1360 + "y": 1360, + "wires": [ + [ + "p2ntfy_mnt" + ] + ] }, { "id": "p2ntfy_mnt", "type": "api-call-service", "z": "a320f821a7cb3f55", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -10979,24 +10835,17 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1360 - }, - { - "type": "tab", - "label": "Bedroom", - "id": "97e0f1338e182d76" + "y": 1360, + "wires": [ + [] + ] }, { "id": "d46b0ef0ec904159", "type": "server-state-changed", "z": "97e0f1338e182d76", - "name": "Bedroom Radiator Boost", - "wires": [ - [ - "c89bd8a3d1ef10f3" - ] - ], "d": true, + "name": "Bedroom Radiator Boost", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -11043,26 +10892,28 @@ } ], "x": 150, - "y": 140 + "y": 140, + "wires": [ + [ + "c89bd8a3d1ef10f3" + ] + ] }, { "id": "2c98b3b74558eb20", "type": "comment", "z": "97e0f1338e182d76", "name": "Radiator boost functionality", - "wires": [], "info": "", "x": 150, - "y": 100 + "y": 100, + "wires": [] }, { "id": "c89bd8a3d1ef10f3", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on boost mode", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11084,28 +10935,26 @@ "domain": "climate", "service": "set_preset_mode", "x": 520, - "y": 140 + "y": 140, + "wires": [ + [] + ] }, { "id": "38a218bd9af588e7", "type": "comment", "z": "97e0f1338e182d76", "name": "UI Scene Selector", - "wires": [], "info": "", "x": 130, - "y": 320 + "y": 320, + "wires": [] }, { "id": "1a65eaabb03a7bf9", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Scene Selector", - "wires": [ - [ - "8b4608485751c75e" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -11152,16 +11001,18 @@ } ], "x": 150, - "y": 360 + "y": 360, + "wires": [ + [ + "8b4608485751c75e" + ] + ] }, { "id": "f58c59e082e101ed", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on Scene", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11183,18 +11034,16 @@ "domain": "scene", "service": "turn_on", "x": 940, - "y": 360 + "y": 360, + "wires": [ + [] + ] }, { "id": "e11131ed218f47ab", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Shift Scene Button", - "wires": [ - [ - "77ec438ec87c0861" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -11241,26 +11090,28 @@ } ], "x": 160, - "y": 580 + "y": 580, + "wires": [ + [ + "77ec438ec87c0861" + ] + ] }, { "id": "4fcc252c63d82516", "type": "comment", "z": "97e0f1338e182d76", "name": "Scene Shifter, updates UI Scene Selector", - "wires": [], "info": "", "x": 200, - "y": 440 + "y": 440, + "wires": [] }, { "id": "77ec438ec87c0861", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger next scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11282,18 +11133,16 @@ "domain": "input_select", "service": "select_next", "x": 520, - "y": 580 + "y": 580, + "wires": [ + [] + ] }, { "id": "35e1934d67c2f753", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom Scene Shifter", - "wires": [ - [ - "e2137d25f8265819" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -11340,16 +11189,18 @@ } ], "x": 140, - "y": 480 + "y": 480, + "wires": [ + [ + "e2137d25f8265819" + ] + ] }, { "id": "e2137d25f8265819", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Update scene in selector", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11371,13 +11222,18 @@ "domain": "input_select", "service": "select_option", "x": 510, - "y": 480 + "y": 480, + "wires": [ + [] + ] }, { "id": "709ee4ecb3d9d6e5", "type": "subflow:52430f5e9f9ee267", "z": "97e0f1338e182d76", "name": "", + "x": 870, + "y": 940, "wires": [ [ "f279d0b1fbbf9cb4" @@ -11397,20 +11253,13 @@ [ "7e5573df8317e57f" ] - ], - "x": 870, - "y": 940 + ] }, { "id": "bca2e47c3d26e6a1", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Bedroom time-based turn on", - "wires": [ - [ - "4f74cdc66a002911" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -11457,18 +11306,18 @@ } ], "x": 160, - "y": 760 + "y": 760, + "wires": [ + [ + "4f74cdc66a002911" + ] + ] }, { "id": "f279d0b1fbbf9cb4", "type": "change", "z": "97e0f1338e182d76", "name": "morning - Energize", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11484,18 +11333,18 @@ "to": "", "reg": false, "x": 1190, - "y": 860 + "y": 860, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "3c152ba239c25d77", "type": "change", "z": "97e0f1338e182d76", "name": "midday - Concentrate", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11511,18 +11360,18 @@ "to": "", "reg": false, "x": 1200, - "y": 900 + "y": 900, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "89faa874997406a2", "type": "change", "z": "97e0f1338e182d76", "name": "late afternoon - Read", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11538,18 +11387,18 @@ "to": "", "reg": false, "x": 1200, - "y": 940 + "y": 940, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "4538f8e1ad5c1e46", "type": "change", "z": "97e0f1338e182d76", "name": "evening - Relax", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11565,18 +11414,18 @@ "to": "", "reg": false, "x": 1180, - "y": 980 + "y": 980, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "0b63dda19923a6c5", "type": "change", "z": "97e0f1338e182d76", "name": "late evening - Rest", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11592,18 +11441,18 @@ "to": "", "reg": false, "x": 1190, - "y": 1020 + "y": 1020, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "7e5573df8317e57f", "type": "change", "z": "97e0f1338e182d76", "name": "night - Nightlight", - "wires": [ - [ - "d84b127597627c5f" - ] - ], "rules": [ { "t": "set", @@ -11619,22 +11468,18 @@ "to": "", "reg": false, "x": 1180, - "y": 1060 + "y": 1060, + "wires": [ + [ + "d84b127597627c5f" + ] + ] }, { "id": "4f74cdc66a002911", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Bedroom lights on?", - "wires": [ - [ - "362048030b8dff62", - "c1af1a7dd6935bf8" - ], - [ - "709ee4ecb3d9d6e5" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -11661,16 +11506,22 @@ "entity_location": "data", "override_data": "msg", "x": 490, - "y": 760 + "y": 760, + "wires": [ + [ + "362048030b8dff62", + "c1af1a7dd6935bf8" + ], + [ + "709ee4ecb3d9d6e5" + ] + ] }, { "id": "176597d96d6e3645", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger specific scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11699,16 +11550,16 @@ "domain": "input_select", "service": "select_option", "x": 2050, - "y": 940 + "y": 940, + "wires": [ + [] + ] }, { "id": "4b1045ce3c6e6ab6", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger next scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11730,18 +11581,16 @@ "domain": "input_select", "service": "select_next", "x": 1680, - "y": 680 + "y": 680, + "wires": [ + [] + ] }, { "id": "362048030b8dff62", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Get UI scene selector state", - "wires": [ - [ - "432318d906637048" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -11774,18 +11623,18 @@ "entity_location": "data", "override_data": "msg", "x": 800, - "y": 660 + "y": 660, + "wires": [ + [ + "432318d906637048" + ] + ] }, { "id": "c1af1a7dd6935bf8", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Get scene shifter state", - "wires": [ - [ - "432318d906637048" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -11818,18 +11667,18 @@ "entity_location": "data", "override_data": "msg", "x": 780, - "y": 700 + "y": 700, + "wires": [ + [ + "432318d906637048" + ] + ] }, { "id": "432318d906637048", "type": "join", "z": "97e0f1338e182d76", "name": "Collect all items", - "wires": [ - [ - "cd8ac9cbde46bf84" - ] - ], "mode": "custom", "build": "object", "property": "payload", @@ -11846,21 +11695,18 @@ "reduceInitType": "", "reduceFixup": "", "x": 1090, - "y": 660 + "y": 660, + "wires": [ + [ + "cd8ac9cbde46bf84" + ] + ] }, { "id": "cd8ac9cbde46bf84", "type": "switch", "z": "97e0f1338e182d76", "name": "Do the UI and internal scene selector (shifter) have an identical value?", - "wires": [ - [ - "4b1045ce3c6e6ab6" - ], - [ - "8f837b53f9ae9e07" - ] - ], "property": "payload.bedroom_scene", "propertyType": "msg", "rules": [ @@ -11877,18 +11723,21 @@ "repair": false, "outputs": 2, "x": 1250, - "y": 720 + "y": 720, + "wires": [ + [ + "4b1045ce3c6e6ab6" + ], + [ + "8f837b53f9ae9e07" + ] + ] }, { "id": "8f837b53f9ae9e07", "type": "change", "z": "97e0f1338e182d76", "name": "clear payload", - "wires": [ - [ - "709ee4ecb3d9d6e5" - ] - ], "rules": [ { "t": "set", @@ -11904,21 +11753,18 @@ "to": "", "reg": false, "x": 1630, - "y": 740 + "y": 740, + "wires": [ + [ + "709ee4ecb3d9d6e5" + ] + ] }, { "id": "d84b127597627c5f", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Scene shifter already on time-based scene?", - "wires": [ - [ - "176597d96d6e3645" - ], - [ - "d2de5c2d59b4614b" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -11938,16 +11784,21 @@ "entity_location": "data", "override_data": "msg", "x": 1550, - "y": 940 + "y": 940, + "wires": [ + [ + "176597d96d6e3645" + ], + [ + "d2de5c2d59b4614b" + ] + ] }, { "id": "2e7b78de395dc593", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Trigger specific scene in selector", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -11976,38 +11827,36 @@ "domain": "input_select", "service": "select_option", "x": 2050, - "y": 1000 + "y": 1000, + "wires": [ + [] + ] }, { "id": "083380396eab878c", "type": "comment", "z": "97e0f1338e182d76", "name": "Check setting of scene shifter and call according function, as shift will update selector, but not if it already has the correct state", - "wires": [], "info": "", "x": 1800, - "y": 900 + "y": 900, + "wires": [] }, { "id": "d389eb4a4df1d94d", "type": "comment", "z": "97e0f1338e182d76", "name": "Only shift if value is identical between selects", - "wires": [], "info": "In case the UI elements are already the same, then i want to trigger the next scene.\nIn case the UI elements are not the same, they should be synchonized.", "x": 1170, - "y": 760 + "y": 760, + "wires": [] }, { "id": "8b4608485751c75e", "type": "string", "z": "97e0f1338e182d76", "name": "Parse user readable text and convert to scene entity ID", - "wires": [ - [ - "f58c59e082e101ed" - ] - ], "methods": [ { "name": "slugify", @@ -12041,36 +11890,38 @@ "object": "msg", "objectout": "msg", "x": 600, - "y": 360 + "y": 360, + "wires": [ + [ + "f58c59e082e101ed" + ] + ] }, { "id": "1b3e31f4b885dc8d", "type": "comment", "z": "97e0f1338e182d76", "name": "Time-based Light", - "wires": [], "info": "", "x": 120, - "y": 720 + "y": 720, + "wires": [] }, { "id": "42199407f205b1a9", "type": "comment", "z": "97e0f1338e182d76", "name": "Hidden Scene Shifter button - only for Dev UI", - "wires": [], "info": "", "x": 210, - "y": 540 + "y": 540, + "wires": [] }, { "id": "31da3053abfcc308", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Turn on/off lights bedroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -12092,21 +11943,16 @@ "domain": "light", "service": "{{ service }}", "x": 1330, - "y": 1460 + "y": 1460, + "wires": [ + [] + ] }, { "id": "7013e43814f349ad", "type": "switch", "z": "97e0f1338e182d76", "name": "On/Off check", - "wires": [ - [ - "4f74cdc66a002911" - ], - [ - "6164ec7d06a81fe4" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12125,21 +11971,21 @@ "repair": false, "outputs": 2, "x": 410, - "y": 1380 + "y": 1380, + "wires": [ + [ + "4f74cdc66a002911" + ], + [ + "6164ec7d06a81fe4" + ] + ] }, { "id": "36feb055644891c5", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Up press/hold", - "wires": [ - [ - "cb02468ec4dfa41b" - ], - [ - "cb02468ec4dfa41b" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12158,18 +12004,21 @@ "repair": false, "outputs": 2, "x": 480, - "y": 1500 + "y": 1500, + "wires": [ + [ + "cb02468ec4dfa41b" + ], + [ + "cb02468ec4dfa41b" + ] + ] }, { "id": "cb02468ec4dfa41b", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase (smooth)", - "wires": [ - [ - "31da3053abfcc308" - ] - ], "rules": [ { "t": "set", @@ -12192,18 +12041,18 @@ "to": "", "reg": false, "x": 830, - "y": 1500 + "y": 1500, + "wires": [ + [ + "31da3053abfcc308" + ] + ] }, { "id": "406db761620bc517", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "31da3053abfcc308" - ] - ], "rules": [ { "t": "set", @@ -12226,18 +12075,18 @@ "to": "", "reg": false, "x": 840, - "y": 1540 + "y": 1540, + "wires": [ + [ + "31da3053abfcc308" + ] + ] }, { "id": "6164ec7d06a81fe4", "type": "change", "z": "97e0f1338e182d76", "name": "Service: turn off", - "wires": [ - [ - "31da3053abfcc308" - ] - ], "rules": [ { "t": "set", @@ -12260,31 +12109,28 @@ "to": "", "reg": false, "x": 800, - "y": 1400 + "y": 1400, + "wires": [ + [ + "31da3053abfcc308" + ] + ] }, { "id": "241ddf98acba2579", "type": "comment", "z": "97e0f1338e182d76", "name": "Dimmer functionality - HUE", - "wires": [], "info": "", "x": 450, - "y": 1460 + "y": 1460, + "wires": [] }, { "id": "79a86fa5f578af3e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Down press/hold", - "wires": [ - [ - "406db761620bc517" - ], - [ - "406db761620bc517" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12303,21 +12149,21 @@ "repair": false, "outputs": 2, "x": 480, - "y": 1540 + "y": 1540, + "wires": [ + [ + "406db761620bc517" + ], + [ + "406db761620bc517" + ] + ] }, { "id": "c28fac638bf817b4", "type": "switch", "z": "97e0f1338e182d76", "name": "On hold", - "wires": [ - [ - "f279d0b1fbbf9cb4" - ], - [ - "4538f8e1ad5c1e46" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12336,32 +12182,31 @@ "repair": false, "outputs": 2, "x": 780, - "y": 1260 + "y": 1260, + "wires": [ + [ + "f279d0b1fbbf9cb4" + ], + [ + "4538f8e1ad5c1e46" + ] + ] }, { "id": "c83798ac3a3167eb", "type": "comment", "z": "97e0f1338e182d76", "name": "Allow two default modes via switch", - "wires": [], "info": "", "x": 860, - "y": 1300 + "y": 1300, + "wires": [] }, { "id": "a04124baa07fa11c", "type": "server-state-changed", "z": "97e0f1338e182d76", "name": "Hue - Bedroom switch", - "wires": [ - [ - "7013e43814f349ad", - "c28fac638bf817b4", - "36feb055644891c5", - "79a86fa5f578af3e", - "b7747d69d24690b6" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -12408,31 +12253,32 @@ } ], "x": 160, - "y": 1380 + "y": 1380, + "wires": [ + [ + "7013e43814f349ad", + "c28fac638bf817b4", + "36feb055644891c5", + "79a86fa5f578af3e", + "b7747d69d24690b6" + ] + ] }, { "id": "60beffc9468624cd", "type": "comment", "z": "97e0f1338e182d76", "name": "Bedroom Lights on/off switch", - "wires": [], "info": "", "x": 180, - "y": 1340 + "y": 1340, + "wires": [] }, { "id": "d2de5c2d59b4614b", "type": "api-current-state", "z": "97e0f1338e182d76", "name": "Scene selector already on time-based scene?", - "wires": [ - [ - "2e7b78de395dc593" - ], - [ - "8b4608485751c75e" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -12452,21 +12298,22 @@ "entity_location": "data", "override_data": "msg", "x": 1560, - "y": 1020 + "y": 1020, + "wires": [ + [ + "2e7b78de395dc593" + ], + [ + "8b4608485751c75e" + ] + ] }, { "id": "01e9aa8d6c3c719e", "type": "server-state-changed", "z": "97e0f1338e182d76", - "name": "Hue - Bedroom switch", - "wires": [ - [ - "0d9343f34a28176f", - "2439bd84c7eea05e", - "62dbd855fe3a4b5e" - ] - ], "d": true, + "name": "Hue - Bedroom switch", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -12513,14 +12360,20 @@ } ], "x": 160, - "y": 1760 + "y": 1760, + "wires": [ + [ + "0d9343f34a28176f", + "2439bd84c7eea05e", + "62dbd855fe3a4b5e" + ] + ] }, { "id": "324a5a3309201c2a", "type": "debug", "z": "97e0f1338e182d76", "name": "debug 4", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -12529,23 +12382,14 @@ "statusVal": "", "statusType": "auto", "x": 580, - "y": 1660 + "y": 1660, + "wires": [] }, { "id": "2439bd84c7eea05e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Up press/hold", - "wires": [ - [ - "c6d79d2f6eb1b78d" - ], - [], - [ - "7b5740dd51a70762" - ], - [] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12574,23 +12418,23 @@ "repair": false, "outputs": 4, "x": 480, - "y": 1760 + "y": 1760, + "wires": [ + [ + "c6d79d2f6eb1b78d" + ], + [], + [ + "7b5740dd51a70762" + ], + [] + ] }, { "id": "62dbd855fe3a4b5e", "type": "switch", "z": "97e0f1338e182d76", "name": "Brightness check - Down press/hold", - "wires": [ - [ - "f37a1bde2003fc2c" - ], - [], - [ - "af38a9711eabea2e" - ], - [] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12619,16 +12463,23 @@ "repair": false, "outputs": 4, "x": 480, - "y": 1960 + "y": 1960, + "wires": [ + [ + "f37a1bde2003fc2c" + ], + [], + [ + "af38a9711eabea2e" + ], + [] + ] }, { "id": "c6d79d2f6eb1b78d", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase by 15", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12651,16 +12502,16 @@ "to": "", "reg": false, "x": 930, - "y": 1720 + "y": 1720, + "wires": [ + [] + ] }, { "id": "f37a1bde2003fc2c", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease by 15", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12683,19 +12534,16 @@ "to": "", "reg": false, "x": 940, - "y": 1940 + "y": 1940, + "wires": [ + [] + ] }, { "id": "0d9343f34a28176f", "type": "switch", "z": "97e0f1338e182d76", "name": "remove empty", - "wires": [ - [ - "324a5a3309201c2a" - ], - [] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -12710,16 +12558,19 @@ "repair": false, "outputs": 2, "x": 420, - "y": 1660 + "y": 1660, + "wires": [ + [ + "324a5a3309201c2a" + ], + [] + ] }, { "id": "af38a9711eabea2e", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness decrease by 15", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12742,16 +12593,16 @@ "to": "", "reg": false, "x": 940, - "y": 2040 + "y": 2040, + "wires": [ + [] + ] }, { "id": "7b5740dd51a70762", "type": "change", "z": "97e0f1338e182d76", "name": "Brightness increase by 15", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12774,16 +12625,16 @@ "to": "", "reg": false, "x": 930, - "y": 1800 + "y": 1800, + "wires": [ + [] + ] }, { "id": "7db0a2f13624e217", "type": "change", "z": "97e0f1338e182d76", "name": "STOP", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12806,16 +12657,16 @@ "to": "", "reg": false, "x": 870, - "y": 1840 + "y": 1840, + "wires": [ + [] + ] }, { "id": "c7d84a01ee9ccf1c", "type": "change", "z": "97e0f1338e182d76", "name": "STOP", - "wires": [ - [] - ], "rules": [ { "t": "set", @@ -12838,14 +12689,16 @@ "to": "", "reg": false, "x": 870, - "y": 2080 + "y": 2080, + "wires": [ + [] + ] }, { "id": "b7747d69d24690b6", "type": "debug", "z": "97e0f1338e182d76", "name": "debug 1", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -12854,51 +12707,49 @@ "statusVal": "", "statusType": "auto", "x": 220, - "y": 1500 + "y": 1500, + "wires": [] }, { "id": "p2catch_bed", "type": "catch", "z": "97e0f1338e182d76", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 2280, "wires": [ [ "p2fmt_bed" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 2280 + ] }, { "id": "p2fmt_bed", "type": "function", "z": "97e0f1338e182d76", "name": "Format error", - "wires": [ - [ - "p2ntfy_bed" - ] - ], "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: Bedroom',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 2280 + "y": 2280, + "wires": [ + [ + "p2ntfy_bed" + ] + ] }, { "id": "p2ntfy_bed", "type": "api-call-service", "z": "97e0f1338e182d76", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -12920,27 +12771,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 2280 - }, - { - "type": "tab", - "label": "Kitchen", - "id": "5af82cd4c44df066" + "y": 2280, + "wires": [ + [] + ] }, { "id": "970f66c027cf1bda", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen smart switch", - "wires": [ - [ - "d5ae93765e66efa4", - "099d186859d09206", - "3ffbb3073f04796e", - "bf062f43abe3400c", - "86f4b8eb539e8b4f" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -12987,21 +12827,22 @@ } ], "x": 170, - "y": 100 + "y": 100, + "wires": [ + [ + "d5ae93765e66efa4", + "099d186859d09206", + "3ffbb3073f04796e", + "bf062f43abe3400c", + "86f4b8eb539e8b4f" + ] + ] }, { "id": "d5ae93765e66efa4", "type": "switch", "z": "5af82cd4c44df066", "name": "On/Off check", - "wires": [ - [ - "28725aa2f0bc83ef" - ], - [ - "102d2d6180407101" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -13020,31 +12861,31 @@ "repair": false, "outputs": 2, "x": 410, - "y": 100 + "y": 100, + "wires": [ + [ + "28725aa2f0bc83ef" + ], + [ + "102d2d6180407101" + ] + ] }, { "id": "deae916e70685ff1", "type": "comment", "z": "5af82cd4c44df066", "name": "Kitchen Lights on/off switch", - "wires": [], "info": "", "x": 190, - "y": 60 + "y": 60, + "wires": [] }, { "id": "099d186859d09206", "type": "switch", "z": "5af82cd4c44df066", "name": "Brightness check - Up press/hold", - "wires": [ - [ - "7c14d1f3a819183d" - ], - [ - "7c14d1f3a819183d" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -13063,18 +12904,21 @@ "repair": false, "outputs": 2, "x": 480, - "y": 340 + "y": 340, + "wires": [ + [ + "7c14d1f3a819183d" + ], + [ + "7c14d1f3a819183d" + ] + ] }, { "id": "6289202be36f95a6", "type": "api-call-service", "z": "5af82cd4c44df066", "name": "Turn on lights kitchen", - "wires": [ - [ - "86f4b8eb539e8b4f" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -13096,18 +12940,18 @@ "domain": "light", "service": "turn_on", "x": 1580, - "y": 200 + "y": 200, + "wires": [ + [ + "86f4b8eb539e8b4f" + ] + ] }, { "id": "7c14d1f3a819183d", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness increase (smooth)", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13123,18 +12967,18 @@ "to": "", "reg": false, "x": 1170, - "y": 340 + "y": 340, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "044378dc99eb8bf0", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13150,18 +12994,18 @@ "to": "", "reg": false, "x": 1160, - "y": 380 + "y": 380, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "102d2d6180407101", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 0 (turn off)", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13177,18 +13021,18 @@ "to": "", "reg": false, "x": 1170, - "y": 160 + "y": 160, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "39aba0a7d9f18c40", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 20%", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13204,18 +13048,18 @@ "to": "", "reg": false, "x": 1190, - "y": 120 + "y": 120, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "4584b1c0133c143c", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100%", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13231,31 +13075,28 @@ "to": "", "reg": false, "x": 1190, - "y": 40 + "y": 40, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "72521808adb6aa7f", "type": "comment", "z": "5af82cd4c44df066", "name": "Dimmer functionality - HUE", - "wires": [], "info": "", "x": 450, - "y": 300 + "y": 300, + "wires": [] }, { "id": "3ffbb3073f04796e", "type": "switch", "z": "5af82cd4c44df066", "name": "Brightness check - Down press/hold", - "wires": [ - [ - "044378dc99eb8bf0" - ], - [ - "044378dc99eb8bf0" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -13274,21 +13115,21 @@ "repair": false, "outputs": 2, "x": 480, - "y": 380 + "y": 380, + "wires": [ + [ + "044378dc99eb8bf0" + ], + [ + "044378dc99eb8bf0" + ] + ] }, { "id": "bf062f43abe3400c", "type": "switch", "z": "5af82cd4c44df066", "name": "On hold", - "wires": [ - [ - "e6992acd908b4480" - ], - [ - "07208f4cb940887d" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -13307,18 +13148,21 @@ "repair": false, "outputs": 2, "x": 400, - "y": 240 + "y": 240, + "wires": [ + [ + "e6992acd908b4480" + ], + [ + "07208f4cb940887d" + ] + ] }, { "id": "e6992acd908b4480", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100% and energize profile", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13334,28 +13178,28 @@ "to": "", "reg": false, "x": 1120, - "y": 240 + "y": 240, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "0f7bdb44f2ca1db8", "type": "comment", "z": "5af82cd4c44df066", "name": "Reset to energize mode (default color hue)", - "wires": [], "info": "", "x": 500, - "y": 200 + "y": 200, + "wires": [] }, { "id": "23aa3bbdf2a47c04", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 0 (turn off)", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13371,18 +13215,18 @@ "to": "", "reg": false, "x": 1170, - "y": 500 + "y": 500, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "893c90eae1394985", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 100%", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13398,28 +13242,28 @@ "to": "", "reg": false, "x": 1190, - "y": 600 + "y": 600, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "39f60aff80425ab8", "type": "comment", "z": "5af82cd4c44df066", "name": "Kitchen motion sensor", - "wires": [], "info": "", "x": 180, - "y": 460 + "y": 460, + "wires": [] }, { "id": "07208f4cb940887d", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 20% and energize profile", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13435,18 +13279,18 @@ "to": "", "reg": false, "x": 1130, - "y": 280 + "y": 280, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "72fce694d3455880", "type": "change", "z": "5af82cd4c44df066", "name": "Brightness to 65%", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13462,14 +13306,18 @@ "to": "", "reg": false, "x": 1190, - "y": 80 + "y": 80, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "86f4b8eb539e8b4f", "type": "debug", "z": "5af82cd4c44df066", "name": "Kitchen Debug", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -13479,24 +13327,14 @@ "statusVal": "", "statusType": "auto", "x": 1580, - "y": 300 + "y": 300, + "wires": [] }, { "id": "38192b587d9b9f39", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen motion sensor", - "wires": [ - [ - "b5a33742cf8ae14a", - "eb433762a15ff684" - ], - [ - "893c90eae1394985", - "eb433762a15ff684", - "b5a33742cf8ae14a" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -13543,18 +13381,24 @@ } ], "x": 180, - "y": 500 + "y": 500, + "wires": [ + [ + "b5a33742cf8ae14a", + "eb433762a15ff684" + ], + [ + "893c90eae1394985", + "eb433762a15ff684", + "b5a33742cf8ae14a" + ] + ] }, { "id": "679f37f58704d88f", "type": "change", "z": "5af82cd4c44df066", "name": "Flash at brightness 100%", - "wires": [ - [ - "6289202be36f95a6" - ] - ], "rules": [ { "t": "set", @@ -13570,18 +13414,18 @@ "to": "", "reg": false, "x": 1170, - "y": 460 + "y": 460, + "wires": [ + [ + "6289202be36f95a6" + ] + ] }, { "id": "fb51416832400a90", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13628,14 +13472,18 @@ } ], "x": 310, - "y": 860 + "y": 860, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "a83bddfc2380a7fc", "type": "debug", "z": "5af82cd4c44df066", "name": "debug 5", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -13644,18 +13492,14 @@ "statusVal": "", "statusType": "auto", "x": 740, - "y": 860 + "y": 860, + "wires": [] }, { "id": "d8bfcf399f7df488", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13702,18 +13546,18 @@ } ], "x": 280, - "y": 920 + "y": 920, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "0f50cf7e0d776d55", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13760,18 +13604,18 @@ } ], "x": 280, - "y": 980 + "y": 980, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "ee1d6a217dd0e238", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13818,18 +13662,18 @@ } ], "x": 280, - "y": 1040 + "y": 1040, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "bbae72e59241d2c0", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13876,18 +13720,18 @@ } ], "x": 280, - "y": 1160 + "y": 1160, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "c223cdc7301b7103", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "", - "wires": [ - [ - "a83bddfc2380a7fc" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -13934,13 +13778,20 @@ } ], "x": 280, - "y": 1100 + "y": 1100, + "wires": [ + [ + "a83bddfc2380a7fc" + ] + ] }, { "id": "28725aa2f0bc83ef", "type": "subflow:52430f5e9f9ee267", "z": "5af82cd4c44df066", "name": "", + "x": 730, + "y": 60, "wires": [ [ "4584b1c0133c143c" @@ -13960,20 +13811,13 @@ [ "39aba0a7d9f18c40" ] - ], - "x": 730, - "y": 60 + ] }, { "id": "b5a33742cf8ae14a", "type": "trigger", "z": "5af82cd4c44df066", "name": "Trigger 2:30min for flash", - "wires": [ - [ - "679f37f58704d88f" - ] - ], "op1": "", "op2": "offf", "op1type": "nul", @@ -13987,18 +13831,18 @@ "topic": "topic", "outputs": 1, "x": 730, - "y": 460 + "y": 460, + "wires": [ + [ + "679f37f58704d88f" + ] + ] }, { "id": "eb433762a15ff684", "type": "trigger", "z": "5af82cd4c44df066", "name": "Trigger 3:00 min for off", - "wires": [ - [ - "23aa3bbdf2a47c04" - ] - ], "op1": "", "op2": "offf", "op1type": "nul", @@ -14012,20 +13856,18 @@ "topic": "topic", "outputs": 1, "x": 720, - "y": 500 + "y": 500, + "wires": [ + [ + "23aa3bbdf2a47c04" + ] + ] }, { "id": "ktchn_timebased_01", "type": "server-state-changed", "z": "5af82cd4c44df066", "name": "Kitchen time-based turn on", - "wires": [ - [ - "28725aa2f0bc83ef", - "b5a33742cf8ae14a", - "eb433762a15ff684" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -14072,51 +13914,55 @@ } ], "x": 190, - "y": 160 + "y": 160, + "wires": [ + [ + "28725aa2f0bc83ef", + "b5a33742cf8ae14a", + "eb433762a15ff684" + ] + ] }, { "id": "p2catch_kit", "type": "catch", "z": "5af82cd4c44df066", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1360, "wires": [ [ "p2fmt_kit" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 1360 + ] }, { "id": "p2fmt_kit", "type": "function", "z": "5af82cd4c44df066", "name": "Format error", - "wires": [ - [ - "p2ntfy_kit" - ] - ], "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: Kitchen',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1360 + "y": 1360, + "wires": [ + [ + "p2ntfy_kit" + ] + ] }, { "id": "p2ntfy_kit", "type": "api-call-service", "z": "5af82cd4c44df066", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -14138,24 +13984,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1360 - }, - { - "type": "tab", - "label": "Balcony", - "id": "10cbea6aaac127cd" + "y": 1360, + "wires": [ + [] + ] }, { "id": "f3d66e8924f18806", "type": "server-state-changed", "z": "10cbea6aaac127cd", "name": "Balcony Tradfri button", - "wires": [ - [ - "f1e907e6ede24945" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -14202,31 +14040,29 @@ } ], "x": 180, - "y": 140 + "y": 140, + "wires": [ + [ + "f1e907e6ede24945" + ], + [] + ] }, { "id": "9412a727b1cbef12", "type": "comment", "z": "10cbea6aaac127cd", "name": "Balcony light control", - "wires": [], "info": "", "x": 170, - "y": 100 + "y": 100, + "wires": [] }, { "id": "f1e907e6ede24945", "type": "api-current-state", "z": "10cbea6aaac127cd", "name": "Balcony Lights On?", - "wires": [ - [ - "199c4827dec86225" - ], - [ - "a29b4c78a44241b6" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -14259,16 +14095,21 @@ "entity_location": "data", "override_data": "msg", "x": 510, - "y": 140 + "y": 140, + "wires": [ + [ + "199c4827dec86225" + ], + [ + "a29b4c78a44241b6" + ] + ] }, { "id": "a29b4c78a44241b6", "type": "api-call-service", "z": "10cbea6aaac127cd", "name": "Turn on balcony lights", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -14290,16 +14131,16 @@ "domain": "light", "service": "turn_on", "x": 860, - "y": 160 + "y": 160, + "wires": [ + [] + ] }, { "id": "199c4827dec86225", "type": "api-call-service", "z": "10cbea6aaac127cd", "name": "Turn of balcony lights", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -14321,51 +14162,51 @@ "domain": "light", "service": "turn_off", "x": 860, - "y": 100 + "y": 100, + "wires": [ + [] + ] }, { "id": "p2catch_bal", "type": "catch", "z": "10cbea6aaac127cd", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 360, "wires": [ [ "p2fmt_bal" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 360 + ] }, { "id": "p2fmt_bal", "type": "function", "z": "10cbea6aaac127cd", "name": "Format error", - "wires": [ - [ - "p2ntfy_bal" - ] - ], "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: Balcony',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 360 + "y": 360, + "wires": [ + [ + "p2ntfy_bal" + ] + ] }, { "id": "p2ntfy_bal", "type": "api-call-service", "z": "10cbea6aaac127cd", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -14387,27 +14228,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 360 - }, - { - "type": "tab", - "label": "Hallway", - "id": "c19dee9f.e72838" + "y": 360, + "wires": [ + [] + ] }, { "id": "1be4d360986fd1f1", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway smart switch", - "wires": [ - [ - "9bea73aa40198378", - "hllw_sw_onhold_01", - "hllw_sw_brup_01", - "hllw_sw_brdn_01", - "hllw_sw_dbg_01" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -14454,21 +14284,22 @@ } ], "x": 160, - "y": 120 + "y": 120, + "wires": [ + [ + "9bea73aa40198378", + "hllw_sw_onhold_01", + "hllw_sw_brup_01", + "hllw_sw_brdn_01", + "hllw_sw_dbg_01" + ] + ] }, { "id": "9bea73aa40198378", "type": "switch", "z": "c19dee9f.e72838", "name": "On/Off check", - "wires": [ - [ - "3369429b11ec6c87" - ], - [ - "492a8c0fafdb95c0" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -14487,26 +14318,31 @@ "repair": false, "outputs": 2, "x": 470, - "y": 220 + "y": 220, + "wires": [ + [ + "3369429b11ec6c87" + ], + [ + "492a8c0fafdb95c0" + ] + ] }, { "id": "93521b5966f6fca9", "type": "comment", "z": "c19dee9f.e72838", "name": "Hallway Lights on/off switch", - "wires": [], "info": "", "x": 180, - "y": 80 + "y": 80, + "wires": [] }, { "id": "28b5f90c956f8589", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Turn on/off lights hallway", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -14528,13 +14364,18 @@ "domain": "light", "service": "turn_on", "x": 1790, - "y": 260 + "y": 260, + "wires": [ + [] + ] }, { "id": "3369429b11ec6c87", "type": "subflow:52430f5e9f9ee267", "z": "c19dee9f.e72838", "name": "", + "x": 890, + "y": 280, "wires": [ [ "9e21108d47dd29fe" @@ -14554,33 +14395,23 @@ [ "hllw_br_state_01" ] - ], - "x": 890, - "y": 280 + ] }, { "id": "c2c1acbc73dc80f4", "type": "comment", "z": "c19dee9f.e72838", "name": "Hallway Motion sensor", - "wires": [], "info": "", "x": 160, - "y": 480 + "y": 480, + "wires": [] }, { "id": "c4a4ba3c5f68d440", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway motion sensor", - "wires": [ - [ - "3369429b11ec6c87", - "4b6861fef07dcf9c", - "cb510a92532ea7f5" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -14629,20 +14460,21 @@ } ], "x": 160, - "y": 520 + "y": 520, + "wires": [ + [ + "3369429b11ec6c87", + "4b6861fef07dcf9c", + "cb510a92532ea7f5" + ], + [] + ] }, { "id": "hllw_timebased_01", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Hallway Time Based Turn On", - "wires": [ - [ - "3369429b11ec6c87", - "4b6861fef07dcf9c", - "cb510a92532ea7f5" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -14689,18 +14521,20 @@ } ], "x": 180, - "y": 580 + "y": 580, + "wires": [ + [ + "3369429b11ec6c87", + "4b6861fef07dcf9c", + "cb510a92532ea7f5" + ] + ] }, { "id": "492a8c0fafdb95c0", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 0 (turn off)", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -14716,18 +14550,18 @@ "to": "", "reg": false, "x": 1350, - "y": 560 + "y": 560, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "dcd933bc4929181e", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 20%", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -14743,18 +14577,18 @@ "to": "", "reg": false, "x": 1310, - "y": 280 + "y": 280, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "9e21108d47dd29fe", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 100%", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -14770,18 +14604,18 @@ "to": "", "reg": false, "x": 1310, - "y": 200 + "y": 200, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "da8f36cbc0df2e8c", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness to 65%", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -14797,18 +14631,18 @@ "to": "", "reg": false, "x": 1310, - "y": 240 + "y": 240, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "1e4d5008dcd7fb69", "type": "change", "z": "c19dee9f.e72838", "name": "Flash at brightness 100%", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -14824,18 +14658,18 @@ "to": "", "reg": false, "x": 1350, - "y": 600 + "y": 600, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "4b6861fef07dcf9c", "type": "trigger", "z": "c19dee9f.e72838", "name": "Trigger 4:30min for flash", - "wires": [ - [ - "1e4d5008dcd7fb69" - ] - ], "op1": "", "op2": "offf", "op1type": "nul", @@ -14849,18 +14683,18 @@ "topic": "topic", "outputs": 1, "x": 710, - "y": 560 + "y": 560, + "wires": [ + [ + "1e4d5008dcd7fb69" + ] + ] }, { "id": "cb510a92532ea7f5", "type": "trigger", "z": "c19dee9f.e72838", "name": "Trigger 5:00 min for off", - "wires": [ - [ - "492a8c0fafdb95c0" - ] - ], "op1": "", "op2": "offf", "op1type": "nul", @@ -14874,21 +14708,18 @@ "topic": "topic", "outputs": 1, "x": 700, - "y": 520 + "y": 520, + "wires": [ + [ + "492a8c0fafdb95c0" + ] + ] }, { "id": "hllw_sw_onhold_01", "type": "switch", "z": "c19dee9f.e72838", "name": "On hold", - "wires": [ - [ - "9e21108d47dd29fe" - ], - [ - "dcd933bc4929181e" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -14907,21 +14738,21 @@ "repair": false, "outputs": 2, "x": 460, - "y": 140 + "y": 140, + "wires": [ + [ + "9e21108d47dd29fe" + ], + [ + "dcd933bc4929181e" + ] + ] }, { "id": "hllw_sw_brup_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Brightness check - Up press/hold", - "wires": [ - [ - "hllw_sw_inc_01" - ], - [ - "hllw_sw_inc_01" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -14940,21 +14771,21 @@ "repair": false, "outputs": 2, "x": 540, - "y": 60 + "y": 60, + "wires": [ + [ + "hllw_sw_inc_01" + ], + [ + "hllw_sw_inc_01" + ] + ] }, { "id": "hllw_sw_brdn_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Brightness check - Down press/hold", - "wires": [ - [ - "hllw_sw_dec_01" - ], - [ - "hllw_sw_dec_01" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -14973,18 +14804,21 @@ "repair": false, "outputs": 2, "x": 540, - "y": 100 + "y": 100, + "wires": [ + [ + "hllw_sw_dec_01" + ], + [ + "hllw_sw_dec_01" + ] + ] }, { "id": "hllw_sw_inc_01", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness increase (smooth)", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -15000,18 +14834,18 @@ "to": "", "reg": false, "x": 1320, - "y": 60 + "y": 60, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "hllw_sw_dec_01", "type": "change", "z": "c19dee9f.e72838", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "28b5f90c956f8589" - ] - ], "rules": [ { "t": "set", @@ -15027,14 +14861,18 @@ "to": "", "reg": false, "x": 1330, - "y": 100 + "y": 100, + "wires": [ + [ + "28b5f90c956f8589" + ] + ] }, { "id": "hllw_sw_dbg_01", "type": "debug", "z": "c19dee9f.e72838", "name": "Hallway Switch Debug", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -15044,31 +14882,24 @@ "statusVal": "", "statusType": "auto", "x": 180, - "y": 200 + "y": 200, + "wires": [] }, { "id": "hllw_goodbye_comment_01", "type": "comment", "z": "c19dee9f.e72838", "name": "Goodbye button", - "wires": [], "info": "", "x": 140, - "y": 660 + "y": 660, + "wires": [] }, { "id": "hllw_goodbye_trigger_01", "type": "server-state-changed", "z": "c19dee9f.e72838", "name": "Goodbye button", - "wires": [ - [ - "hllw_goodbye_espresso_01", - "hllw_goodbye_harmony_01", - "hllw_goodbye_heos_01", - "hllw_goodbye_lights_01" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -15115,16 +14946,21 @@ } ], "x": 140, - "y": 700 + "y": 700, + "wires": [ + [ + "hllw_goodbye_espresso_01", + "hllw_goodbye_harmony_01", + "hllw_goodbye_heos_01", + "hllw_goodbye_lights_01" + ] + ] }, { "id": "hllw_goodbye_espresso_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Espresso off", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15146,16 +14982,16 @@ "domain": "switch", "service": "turn_off", "x": 510, - "y": 700 + "y": 700, + "wires": [ + [] + ] }, { "id": "hllw_goodbye_harmony_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Harmony off", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15177,16 +15013,16 @@ "domain": "remote", "service": "turn_off", "x": 510, - "y": 740 + "y": 740, + "wires": [ + [] + ] }, { "id": "hllw_goodbye_heos_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "HEOS pause", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15210,16 +15046,16 @@ "domain": "media_player", "service": "media_pause", "x": 510, - "y": 780 + "y": 780, + "wires": [ + [] + ] }, { "id": "hllw_goodbye_lights_01", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Lights off (LR/BR/Bath)", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15243,18 +15079,16 @@ "domain": "light", "service": "turn_off", "x": 550, - "y": 820 + "y": 820, + "wires": [ + [] + ] }, { "id": "hllw_br_state_01", "type": "api-current-state", "z": "c19dee9f.e72838", "name": "Bedroom ceiling brightness", - "wires": [ - [ - "hllw_br_switch_01" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -15282,21 +15116,18 @@ "forType": "num", "forUnits": "minutes", "x": 1340, - "y": 400 + "y": 400, + "wires": [ + [ + "hllw_br_switch_01" + ] + ] }, { "id": "hllw_br_switch_01", "type": "switch", "z": "c19dee9f.e72838", "name": "Bedroom brightness > 50%?", - "wires": [ - [ - "da8f36cbc0df2e8c" - ], - [ - "dcd933bc4929181e" - ] - ], "property": "data.attributes.brightness", "propertyType": "msg", "rules": [ @@ -15313,61 +15144,66 @@ "repair": false, "outputs": 2, "x": 1340, - "y": 440 + "y": 440, + "wires": [ + [ + "da8f36cbc0df2e8c" + ], + [ + "dcd933bc4929181e" + ] + ] }, { "id": "d62ce1b52df12205", "type": "comment", "z": "c19dee9f.e72838", "name": "When bedroom is lit - use more brightness", - "wires": [], "info": "", "x": 1380, - "y": 360 + "y": 360, + "wires": [] }, { "id": "p2catch_hal", "type": "catch", "z": "c19dee9f.e72838", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1020, "wires": [ [ "p2fmt_hal" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 1020 + ] }, { "id": "p2fmt_hal", "type": "function", "z": "c19dee9f.e72838", "name": "Format error", - "wires": [ - [ - "p2ntfy_hal" - ] - ], "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: Hallway',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1020 + "y": 1020, + "wires": [ + [ + "p2ntfy_hal" + ] + ] }, { "id": "p2ntfy_hal", "type": "api-call-service", "z": "c19dee9f.e72838", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15389,26 +15225,17 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1020 - }, - { - "type": "tab", - "label": "Temperature & climate", - "id": "1f4d4622.7490ca" + "y": 1020, + "wires": [ + [] + ] }, { "id": "eb217ba8.833d48", "type": "server-state-changed", "z": "1f4d4622.7490ca", - "name": "Outside temperature", - "wires": [ - [ - "c8bf7086.b32ab8", - "be230668.4e6718", - "1de4cd6b31838517" - ] - ], "d": true, + "name": "Outside temperature", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -15455,19 +15282,20 @@ } ], "x": 110, - "y": 120 + "y": 120, + "wires": [ + [ + "c8bf7086.b32ab8", + "be230668.4e6718", + "1de4cd6b31838517" + ] + ] }, { "id": "c8bf7086.b32ab8", "type": "api-current-state", "z": "1f4d4622.7490ca", "name": "Inside temperature", - "wires": [ - [ - "13a9b38f.3ab9d4", - "1de4cd6b31838517" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -15495,19 +15323,19 @@ "forType": "num", "forUnits": "minutes", "x": 470, - "y": 120 + "y": 120, + "wires": [ + [ + "13a9b38f.3ab9d4", + "1de4cd6b31838517" + ] + ] }, { "id": "68aa8fe5.4cd4f", "type": "function", "z": "1f4d4622.7490ca", "name": "Determine cooler or warmer", - "wires": [ - [ - "e27e4896.4eefa", - "1de4cd6b31838517" - ] - ], "func": "var outsideTemp = parseFloat(msg.payload.outside);\nvar insideTemp = parseFloat(msg.payload.inside);\nvar notification = '';\n\nif (outsideTemp < insideTemp) {\n notification = 'Outside is cooler than inside';\n} else {\n notification = 'Outside is warmer than inside';\n}\n\nmsg.payload = notification;\n\nreturn msg;", "outputs": 1, "timeout": "", @@ -15516,16 +15344,19 @@ "finalize": "", "libs": [], "x": 880, - "y": 180 + "y": 180, + "wires": [ + [ + "e27e4896.4eefa", + "1de4cd6b31838517" + ] + ] }, { "id": "e27e4896.4eefa", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Notify via HA", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15547,18 +15378,16 @@ "output_location": "", "output_location_type": "none", "x": 1130, - "y": 180 + "y": 180, + "wires": [ + [] + ] }, { "id": "be230668.4e6718", "type": "change", "z": "1f4d4622.7490ca", "name": "Clear data", - "wires": [ - [ - "2119da07.2ad496" - ] - ], "rules": [ { "t": "delete", @@ -15579,18 +15408,18 @@ "to": "", "reg": false, "x": 470, - "y": 260 + "y": 260, + "wires": [ + [ + "2119da07.2ad496" + ] + ] }, { "id": "13a9b38f.3ab9d4", "type": "change", "z": "1f4d4622.7490ca", "name": "Clear data", - "wires": [ - [ - "2119da07.2ad496" - ] - ], "rules": [ { "t": "delete", @@ -15611,18 +15440,18 @@ "to": "", "reg": false, "x": 470, - "y": 200 + "y": 200, + "wires": [ + [ + "2119da07.2ad496" + ] + ] }, { "id": "2119da07.2ad496", "type": "join", "z": "1f4d4622.7490ca", "name": "", - "wires": [ - [ - "68aa8fe5.4cd4f" - ] - ], "mode": "custom", "build": "object", "property": "payload", @@ -15639,14 +15468,18 @@ "reduceInitType": "", "reduceFixup": "", "x": 670, - "y": 180 + "y": 180, + "wires": [ + [ + "68aa8fe5.4cd4f" + ] + ] }, { "id": "1de4cd6b31838517", "type": "debug", "z": "1f4d4622.7490ca", "name": "Temperature alert", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -15656,42 +15489,35 @@ "statusVal": "", "statusType": "auto", "x": 830, - "y": 60 + "y": 60, + "wires": [] }, { "id": "9a99a3d8e416b026", "type": "comment", "z": "1f4d4622.7490ca", "name": "Temperature alert", - "wires": [], "info": "", "x": 100, - "y": 80 + "y": 80, + "wires": [] }, { "id": "a676209fc00d4d6c", "type": "comment", "z": "1f4d4622.7490ca", "name": "Climate control", - "wires": [], "info": "", "x": 100, - "y": 360 + "y": 360, + "wires": [] }, { "id": "6156c5585680e99e", "type": "server-state-changed", "z": "1f4d4622.7490ca", - "name": "Livingroom window open", - "wires": [ - [ - "ea05134bce8525ef" - ], - [ - "e2f354b6c7b22e8d" - ] - ], "d": true, + "name": "Livingroom window open", "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -15738,17 +15564,22 @@ } ], "x": 130, - "y": 420 + "y": 420, + "wires": [ + [ + "ea05134bce8525ef" + ], + [ + "e2f354b6c7b22e8d" + ] + ] }, { "id": "ea05134bce8525ef", "type": "api-call-service", "z": "1f4d4622.7490ca", - "name": "Activate window open mode", - "wires": [ - [] - ], "d": true, + "name": "Activate window open mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15774,17 +15605,17 @@ "output_location": "", "output_location_type": "none", "x": 520, - "y": 420 + "y": 420, + "wires": [ + [] + ] }, { "id": "e2f354b6c7b22e8d", "type": "api-call-service", "z": "1f4d4622.7490ca", - "name": "Activate window open mode", - "wires": [ - [] - ], "d": true, + "name": "Activate window open mode", "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15806,51 +15637,51 @@ "output_location": "", "output_location_type": "none", "x": 520, - "y": 500 + "y": 500, + "wires": [ + [] + ] }, { "id": "p2catch_tmp", "type": "catch", "z": "1f4d4622.7490ca", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 700, "wires": [ [ "p2fmt_tmp" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 700 + ] }, { "id": "p2fmt_tmp", "type": "function", "z": "1f4d4622.7490ca", "name": "Format error", - "wires": [ - [ - "p2ntfy_tmp" - ] - ], "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: Temperature & climate',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 700 + "y": 700, + "wires": [ + [ + "p2ntfy_tmp" + ] + ] }, { "id": "p2ntfy_tmp", "type": "api-call-service", "z": "1f4d4622.7490ca", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -15872,26 +15703,16 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 700 - }, - { - "type": "tab", - "label": "Living room", - "id": "b70ee13eafa73823" + "y": 700, + "wires": [ + [] + ] }, { "id": "tst0000000000003", "type": "switch", "z": "b70ee13eafa73823", "name": "Filter: brightness step", - "wires": [ - [ - "tst0000000000004" - ], - [ - "tst0000000000004" - ] - ], "property": "dial_motion", "propertyType": "msg", "rules": [ @@ -15910,21 +15731,21 @@ "repair": false, "outputs": 2, "x": 420, - "y": 3420 + "y": 3420, + "wires": [ + [ + "tst0000000000004" + ], + [ + "tst0000000000004" + ] + ] }, { "id": "tst0000000000004", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Music control on?", - "wires": [ - [ - "tst0000000000005" - ], - [ - "tst0000000000009" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -15944,19 +15765,21 @@ "entity_location": "data", "override_data": "msg", "x": 680, - "y": 3420 + "y": 3420, + "wires": [ + [ + "tst0000000000005" + ], + [ + "tst0000000000009" + ] + ] }, { "id": "tst0000000000005", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get current volume", - "wires": [ - [ - "tst0000000000006" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -15983,18 +15806,19 @@ "entity_location": "data", "override_data": "msg", "x": 940, - "y": 3380 + "y": 3380, + "wires": [ + [ + "tst0000000000006" + ], + [] + ] }, { "id": "tst0000000000006", "type": "change", "z": "b70ee13eafa73823", "name": "Store current volume", - "wires": [ - [ - "tst0000000000007" - ] - ], "rules": [ { "t": "set", @@ -16015,18 +15839,18 @@ "to": "", "reg": false, "x": 1200, - "y": 3380 + "y": 3380, + "wires": [ + [ + "tst0000000000007" + ] + ] }, { "id": "tst0000000000007", "type": "function", "z": "b70ee13eafa73823", "name": "Calculate new volume", - "wires": [ - [ - "tst0000000000008" - ] - ], "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nconst modifier = Math.round(stepSize / 3) / 255 * 0.2;\nconst raw = (msg.current_volume || 0) + direction * modifier;\nmsg.payload = Math.round(Math.max(0, Math.min(1, raw)) * 100) / 100;\nreturn msg;", "outputs": 1, "timeout": "", @@ -16035,16 +15859,18 @@ "finalize": "", "libs": [], "x": 1460, - "y": 3380 + "y": 3380, + "wires": [ + [ + "tst0000000000008" + ] + ] }, { "id": "tst0000000000008", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Set Volume", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -16066,19 +15892,16 @@ "domain": "media_player", "service": "volume_set", "x": 1710, - "y": 3380 + "y": 3380, + "wires": [ + [] + ] }, { "id": "tst0000000000009", "type": "function", "z": "b70ee13eafa73823", "name": "Calculate brightness step", - "wires": [ - [ - "tst000000000000e", - "tst000000000000a" - ] - ], "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst stepSize = Number(msg.dial_step_size) || 30;\nmsg.service_payload = {\n brightness_step: direction * Math.round(stepSize / 3),\n transition: 0.1\n};\nflow.set('latestServicePayload', msg.service_payload);\nreturn msg;", "outputs": 1, "timeout": "", @@ -16087,14 +15910,19 @@ "finalize": "", "libs": [], "x": 940, - "y": 3480 + "y": 3480, + "wires": [ + [ + "tst000000000000e", + "tst000000000000a" + ] + ] }, { "id": "tst000000000000e", "type": "debug", "z": "b70ee13eafa73823", "name": "Step debug", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -16104,13 +15932,23 @@ "statusVal": "", "statusType": "auto", "x": 940, - "y": 3560 + "y": 3560, + "wires": [] }, { "id": "tst000000000000a", "type": "function", "z": "b70ee13eafa73823", "name": "Compute & fan out brightness", + "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst rawStep = Number(msg.dial_step_size) || 30;\nconst step = direction * rawStep;\n\nconst lights = [\n 'light.living_room_bookshelf',\n 'light.living_room_main',\n 'light.living_room_top_of_bar',\n 'light.living_room_dining_table'\n];\n\nconst haStates = global.get('homeassistant')?.homeAssistantLatest?.states || {};\n\nconst now = Date.now();\nif (now - (flow.get('lastDial') || 0) > 10 * 60 * 1000) {\n lights.forEach(id => flow.set('brt_' + id.replace(/[^a-z0-9]/g, '_'), null));\n}\nflow.set('lastDial', now);\n\nreturn lights.map(id => {\n if (haStates[id]?.state !== 'on') return null;\n const key = 'brt_' + id.replace(/[^a-z0-9]/g, '_');\n let brt = flow.get(key);\n if (brt == null) brt = haStates[id]?.attributes?.brightness || 128;\n brt = Math.max(1, Math.min(255, brt + step));\n flow.set(key, brt);\n return { brightness: Math.round(brt) };\n});", + "outputs": 4, + "timeout": "", + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1230, + "y": 3480, "wires": [ [ "tst000000000000d" @@ -16124,25 +15962,13 @@ [ "dim_dining_001" ] - ], - "func": "const action = msg.dial_motion;\nconst direction = action === 'brightness_step_up' ? 1 : -1;\nconst rawStep = Number(msg.dial_step_size) || 30;\nconst step = direction * rawStep;\n\nconst lights = [\n 'light.living_room_bookshelf',\n 'light.living_room_main',\n 'light.living_room_top_of_bar',\n 'light.living_room_dining_table'\n];\n\nconst haStates = global.get('homeassistant')?.homeAssistantLatest?.states || {};\n\nconst now = Date.now();\nif (now - (flow.get('lastDial') || 0) > 10 * 60 * 1000) {\n lights.forEach(id => flow.set('brt_' + id.replace(/[^a-z0-9]/g, '_'), null));\n}\nflow.set('lastDial', now);\n\nreturn lights.map(id => {\n if (haStates[id]?.state !== 'on') return null;\n const key = 'brt_' + id.replace(/[^a-z0-9]/g, '_');\n let brt = flow.get(key);\n if (brt == null) brt = haStates[id]?.attributes?.brightness || 128;\n brt = Math.max(1, Math.min(255, brt + step));\n flow.set(key, brt);\n return { brightness: Math.round(brt) };\n});", - "outputs": 4, - "timeout": "", - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 1230, - "y": 3480 + ] }, { "id": "tst000000000000d", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim bookshelf", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -16164,16 +15990,16 @@ "domain": "light", "service": "turn_on", "x": 2240, - "y": 3480 + "y": 3480, + "wires": [ + [] + ] }, { "id": "dim_main_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim ceiling (main)", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16195,16 +16021,16 @@ "domain": "light", "service": "turn_on", "x": 2240, - "y": 3540 + "y": 3540, + "wires": [ + [] + ] }, { "id": "dim_bar_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim top of bar", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16226,16 +16052,16 @@ "domain": "light", "service": "turn_on", "x": 2240, - "y": 3600 + "y": 3600, + "wires": [ + [] + ] }, { "id": "dim_dining_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim dining table", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16257,28 +16083,26 @@ "domain": "light", "service": "turn_on", "x": 2240, - "y": 3660 + "y": 3660, + "wires": [ + [] + ] }, { "id": "ecb0c97ae392b159", "type": "comment", "z": "b70ee13eafa73823", "name": "UI Scene Selector", - "wires": [], "info": "", "x": 130, - "y": 60 + "y": 60, + "wires": [] }, { "id": "d3a49892623d0c67", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Scene Selector", - "wires": [ - [ - "e3ad58f3e13ded81" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -16325,18 +16149,18 @@ } ], "x": 150, - "y": 100 + "y": 100, + "wires": [ + [ + "e3ad58f3e13ded81" + ] + ] }, { "id": "f07c5e952b2f368b", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on Scene", - "wires": [ - [ - "13bf72e70e9bbd73" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16358,18 +16182,18 @@ "domain": "scene", "service": "turn_on", "x": 1640, - "y": 220 + "y": 220, + "wires": [ + [ + "13bf72e70e9bbd73" + ] + ] }, { "id": "766d258dc65a274f", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Shift Scene Button", - "wires": [ - [ - "bfaccee76249a213" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -16416,26 +16240,28 @@ } ], "x": 160, - "y": 320 + "y": 320, + "wires": [ + [ + "bfaccee76249a213" + ] + ] }, { "id": "b0f2fedd2347176d", "type": "comment", "z": "b70ee13eafa73823", "name": "Scene Shifter, updates UI Scene Selector", - "wires": [], "info": "", "x": 200, - "y": 180 + "y": 180, + "wires": [] }, { "id": "bfaccee76249a213", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger next scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16457,18 +16283,16 @@ "domain": "input_select", "service": "select_next", "x": 520, - "y": 320 + "y": 320, + "wires": [ + [] + ] }, { "id": "38801dbb193aaf6a", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Scene Shifter", - "wires": [ - [ - "be4016ddfc38da17" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -16515,16 +16339,18 @@ } ], "x": 150, - "y": 220 + "y": 220, + "wires": [ + [ + "be4016ddfc38da17" + ] + ] }, { "id": "be4016ddfc38da17", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Update scene in selector", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16546,13 +16372,18 @@ "domain": "input_select", "service": "select_option", "x": 510, - "y": 220 + "y": 220, + "wires": [ + [] + ] }, { "id": "ec6ae14bf7d95e92", "type": "subflow:52430f5e9f9ee267", "z": "b70ee13eafa73823", "name": "", + "x": 850, + "y": 600, "wires": [ [ "ecf9fefeac6dc853" @@ -16572,20 +16403,13 @@ [ "8b046197cef5a597" ] - ], - "x": 850, - "y": 600 + ] }, { "id": "fdd0994437d3eb49", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom time-based turn on", - "wires": [ - [ - "2db649c0455c7a49" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -16632,18 +16456,18 @@ } ], "x": 160, - "y": 500 + "y": 500, + "wires": [ + [ + "2db649c0455c7a49" + ] + ] }, { "id": "ecf9fefeac6dc853", "type": "change", "z": "b70ee13eafa73823", "name": "morning - Energize", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16659,18 +16483,18 @@ "to": "", "reg": false, "x": 1150, - "y": 600 + "y": 600, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "19360a877415c87d", "type": "change", "z": "b70ee13eafa73823", "name": "midday - Concentrate", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16686,18 +16510,18 @@ "to": "", "reg": false, "x": 1160, - "y": 640 + "y": 640, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "1efe8dde3508e5c1", "type": "change", "z": "b70ee13eafa73823", "name": "late afternoon - Read", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16713,18 +16537,18 @@ "to": "", "reg": false, "x": 1160, - "y": 680 + "y": 680, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "21f09eeec20cb3f6", "type": "change", "z": "b70ee13eafa73823", "name": "evening - Relax", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16740,18 +16564,18 @@ "to": "", "reg": false, "x": 1140, - "y": 720 + "y": 720, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "b4b48cde6a2830f3", "type": "change", "z": "b70ee13eafa73823", "name": "late evening - Rest", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16767,18 +16591,18 @@ "to": "", "reg": false, "x": 1150, - "y": 760 + "y": 760, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "8b046197cef5a597", "type": "change", "z": "b70ee13eafa73823", "name": "night - Nightlight", - "wires": [ - [ - "fccf425d1d70a288" - ] - ], "rules": [ { "t": "set", @@ -16794,22 +16618,18 @@ "to": "", "reg": false, "x": 1140, - "y": 800 + "y": 800, + "wires": [ + [ + "fccf425d1d70a288" + ] + ] }, { "id": "2db649c0455c7a49", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Livingroom lights on?", - "wires": [ - [ - "ce7a6033db2e3ffa", - "0836295ca0bc0df3" - ], - [ - "ec6ae14bf7d95e92" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -16836,16 +16656,22 @@ "entity_location": "data", "override_data": "msg", "x": 500, - "y": 480 + "y": 480, + "wires": [ + [ + "ce7a6033db2e3ffa", + "0836295ca0bc0df3" + ], + [ + "ec6ae14bf7d95e92" + ] + ] }, { "id": "7016650e62edb33e", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger specific scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16874,16 +16700,16 @@ "domain": "input_select", "service": "select_option", "x": 2050, - "y": 680 + "y": 680, + "wires": [ + [] + ] }, { "id": "7ddf806038a9a543", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger next scene in shifter", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -16905,18 +16731,16 @@ "domain": "input_select", "service": "select_next", "x": 1680, - "y": 420 + "y": 420, + "wires": [ + [] + ] }, { "id": "ce7a6033db2e3ffa", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get UI scene selector state", - "wires": [ - [ - "544bbcfca2ae8966" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -16949,18 +16773,18 @@ "entity_location": "data", "override_data": "msg", "x": 800, - "y": 400 + "y": 400, + "wires": [ + [ + "544bbcfca2ae8966" + ] + ] }, { "id": "0836295ca0bc0df3", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get scene shifter state", - "wires": [ - [ - "544bbcfca2ae8966" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 1, @@ -16993,18 +16817,18 @@ "entity_location": "data", "override_data": "msg", "x": 780, - "y": 440 + "y": 440, + "wires": [ + [ + "544bbcfca2ae8966" + ] + ] }, { "id": "544bbcfca2ae8966", "type": "join", "z": "b70ee13eafa73823", "name": "Collect all items", - "wires": [ - [ - "52a8d21f9e1670bc" - ] - ], "mode": "custom", "build": "object", "property": "payload", @@ -17021,21 +16845,18 @@ "reduceInitType": "", "reduceFixup": "", "x": 1090, - "y": 400 + "y": 400, + "wires": [ + [ + "52a8d21f9e1670bc" + ] + ] }, { "id": "52a8d21f9e1670bc", "type": "switch", "z": "b70ee13eafa73823", "name": "Do the UI and internal scene selector (shifter) have an identical value?", - "wires": [ - [ - "7ddf806038a9a543" - ], - [ - "882484a2b843b11f" - ] - ], "property": "payload.selector_scene", "propertyType": "msg", "rules": [ @@ -17052,18 +16873,21 @@ "repair": false, "outputs": 2, "x": 1250, - "y": 460 + "y": 460, + "wires": [ + [ + "7ddf806038a9a543" + ], + [ + "882484a2b843b11f" + ] + ] }, { "id": "882484a2b843b11f", "type": "change", "z": "b70ee13eafa73823", "name": "clear payload", - "wires": [ - [ - "ec6ae14bf7d95e92" - ] - ], "rules": [ { "t": "set", @@ -17079,21 +16903,18 @@ "to": "", "reg": false, "x": 1630, - "y": 480 + "y": 480, + "wires": [ + [ + "ec6ae14bf7d95e92" + ] + ] }, { "id": "fccf425d1d70a288", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Scene shifter already on time-based scene?", - "wires": [ - [ - "7016650e62edb33e" - ], - [ - "efc95cdb439dfb7f" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -17113,16 +16934,21 @@ "entity_location": "data", "override_data": "msg", "x": 1550, - "y": 680 + "y": 680, + "wires": [ + [ + "7016650e62edb33e" + ], + [ + "efc95cdb439dfb7f" + ] + ] }, { "id": "7399514dde3e0bfe", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Trigger specific scene in selector", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -17151,39 +16977,36 @@ "domain": "input_select", "service": "select_option", "x": 2050, - "y": 740 + "y": 740, + "wires": [ + [] + ] }, { "id": "447435b97ace1c77", "type": "comment", "z": "b70ee13eafa73823", "name": "Check setting of scene shifter and call according function, as shift will update selector, but not if it already has the correct state", - "wires": [], "info": "", "x": 1800, - "y": 640 + "y": 640, + "wires": [] }, { "id": "1f9f81e7a7920976", "type": "comment", "z": "b70ee13eafa73823", "name": "Only shift if value is identical between selects", - "wires": [], "info": "In case the UI elements are already the same, then i want to trigger the next scene.\nIn case the UI elements are not the same, they should be synchonized.", "x": 1170, - "y": 500 + "y": 500, + "wires": [] }, { "id": "e3ad58f3e13ded81", "type": "string", "z": "b70ee13eafa73823", "name": "Parse user readable text and convert to scene entity ID", - "wires": [ - [ - "dining_route_001", - "13bf72e70e9bbd73" - ] - ], "methods": [ { "name": "slugify", @@ -17226,36 +17049,39 @@ "object": "msg", "objectout": "msg", "x": 1520, - "y": 100 + "y": 100, + "wires": [ + [ + "dining_route_001", + "13bf72e70e9bbd73" + ] + ] }, { "id": "6a4eb8cc515c46ea", "type": "comment", "z": "b70ee13eafa73823", "name": "Time-based light scenes", - "wires": [], "info": "", "x": 150, - "y": 460 + "y": 460, + "wires": [] }, { "id": "38ce67093edaca48", "type": "comment", "z": "b70ee13eafa73823", "name": "Hidden Scene Shifter button - only for Dev UI", - "wires": [], "info": "", "x": 210, - "y": 280 + "y": 280, + "wires": [] }, { "id": "142ba7e9832fdf4c", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights livingroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -17277,27 +17103,16 @@ "domain": "light", "service": "{{ service }}", "x": 1340, - "y": 1240 + "y": 1240, + "wires": [ + [] + ] }, { "id": "691f50e528c73024", "type": "switch", "z": "b70ee13eafa73823", "name": "On/Off check", - "wires": [ - [ - "2db649c0455c7a49" - ], - [ - "e64edc58615d79d4" - ], - [ - "2db649c0455c7a49" - ], - [ - "e64edc58615d79d4" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -17326,18 +17141,27 @@ "repair": false, "outputs": 4, "x": 510, - "y": 1120 + "y": 1120, + "wires": [ + [ + "2db649c0455c7a49" + ], + [ + "e64edc58615d79d4" + ], + [ + "2db649c0455c7a49" + ], + [ + "e64edc58615d79d4" + ] + ] }, { "id": "47eeb8d0da59b457", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Up ", - "wires": [ - [ - "3403d228e69854ed" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -17351,18 +17175,18 @@ "repair": false, "outputs": 1, "x": 540, - "y": 1220 + "y": 1220, + "wires": [ + [ + "3403d228e69854ed" + ] + ] }, { "id": "3403d228e69854ed", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", - "wires": [ - [ - "142ba7e9832fdf4c" - ] - ], "rules": [ { "t": "set", @@ -17385,18 +17209,18 @@ "to": "", "reg": false, "x": 830, - "y": 1220 + "y": 1220, + "wires": [ + [ + "142ba7e9832fdf4c" + ] + ] }, { "id": "fe9ea08e5c5eb757", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "142ba7e9832fdf4c" - ] - ], "rules": [ { "t": "set", @@ -17419,18 +17243,18 @@ "to": "", "reg": false, "x": 840, - "y": 1260 + "y": 1260, + "wires": [ + [ + "142ba7e9832fdf4c" + ] + ] }, { "id": "e64edc58615d79d4", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn off", - "wires": [ - [ - "a566b47735e884f7" - ] - ], "rules": [ { "t": "set", @@ -17453,28 +17277,28 @@ "to": "", "reg": false, "x": 800, - "y": 1140 + "y": 1140, + "wires": [ + [ + "a566b47735e884f7" + ] + ] }, { "id": "da4e9761a84ee45b", "type": "comment", "z": "b70ee13eafa73823", "name": "Dimmer functionality - HUE", - "wires": [], "info": "", "x": 550, - "y": 1180 + "y": 1180, + "wires": [] }, { "id": "5c31d80bcb840a96", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Down", - "wires": [ - [ - "fe9ea08e5c5eb757" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -17488,21 +17312,18 @@ "repair": false, "outputs": 1, "x": 550, - "y": 1260 + "y": 1260, + "wires": [ + [ + "fe9ea08e5c5eb757" + ] + ] }, { "id": "17a110d60b7dd497", "type": "switch", "z": "b70ee13eafa73823", "name": "On hold", - "wires": [ - [ - "ecf9fefeac6dc853" - ], - [ - "21f09eeec20cb3f6" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -17521,32 +17342,31 @@ "repair": false, "outputs": 2, "x": 780, - "y": 1000 + "y": 1000, + "wires": [ + [ + "ecf9fefeac6dc853" + ], + [ + "21f09eeec20cb3f6" + ] + ] }, { "id": "3227ee1d0ce6a8e8", "type": "comment", "z": "b70ee13eafa73823", "name": "Allow two default modes via switch", - "wires": [], "info": "", "x": 860, - "y": 1040 + "y": 1040, + "wires": [] }, { "id": "28e866353c605b91", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Hue - Living room tapdial", - "wires": [ - [ - "691f50e528c73024", - "17a110d60b7dd497", - "2de26b31165d3632", - "57a722e2ab174bc1", - "tst0000000000003" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -17605,31 +17425,32 @@ } ], "x": 170, - "y": 1120 + "y": 1120, + "wires": [ + [ + "691f50e528c73024", + "17a110d60b7dd497", + "2de26b31165d3632", + "57a722e2ab174bc1", + "tst0000000000003" + ] + ] }, { "id": "85818d214c994abb", "type": "comment", "z": "b70ee13eafa73823", "name": "Livingroom tap-dial", - "wires": [], "info": "", "x": 150, - "y": 1080 + "y": 1080, + "wires": [] }, { "id": "efc95cdb439dfb7f", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Scene selector already on time-based scene?", - "wires": [ - [ - "7399514dde3e0bfe" - ], - [ - "e3ad58f3e13ded81" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -17649,19 +17470,22 @@ "entity_location": "data", "override_data": "msg", "x": 1560, - "y": 760 + "y": 760, + "wires": [ + [ + "7399514dde3e0bfe" + ], + [ + "e3ad58f3e13ded81" + ] + ] }, { "id": "7de469ae61567be2", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "", - "wires": [ - [ - "4b1badad7ce89076" - ] - ], "d": true, + "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -17708,14 +17532,18 @@ } ], "x": 240, - "y": 1820 + "y": 1820, + "wires": [ + [ + "4b1badad7ce89076" + ] + ] }, { "id": "4b1badad7ce89076", "type": "debug", "z": "b70ee13eafa73823", "name": "debug 6", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -17724,19 +17552,15 @@ "statusVal": "", "statusType": "auto", "x": 660, - "y": 1880 + "y": 1880, + "wires": [] }, { "id": "66756ac444fc22da", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "", - "wires": [ - [ - "4b1badad7ce89076" - ] - ], "d": true, + "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -17783,19 +17607,19 @@ } ], "x": 260, - "y": 1940 + "y": 1940, + "wires": [ + [ + "4b1badad7ce89076" + ] + ] }, { "id": "7d4e2bdc0bcf256d", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "", - "wires": [ - [ - "4b1badad7ce89076" - ] - ], "d": true, + "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -17842,19 +17666,19 @@ } ], "x": 260, - "y": 1900 + "y": 1900, + "wires": [ + [ + "4b1badad7ce89076" + ] + ] }, { "id": "ec9d9a53e6083bcb", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "", - "wires": [ - [ - "4b1badad7ce89076" - ] - ], "d": true, + "name": "", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -17901,14 +17725,18 @@ } ], "x": 270, - "y": 1860 + "y": 1860, + "wires": [ + [ + "4b1badad7ce89076" + ] + ] }, { "id": "13bf72e70e9bbd73", "type": "debug", "z": "b70ee13eafa73823", "name": "debug 7", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -17918,21 +17746,14 @@ "statusVal": "", "statusType": "auto", "x": 1880, - "y": 240 + "y": 240, + "wires": [] }, { "id": "2de26b31165d3632", "type": "switch", "z": "b70ee13eafa73823", "name": "Button 2 release & hold", - "wires": [ - [ - "dining_scene_toggle_001" - ], - [ - "dc98aceee1133a56" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -17951,21 +17772,21 @@ "repair": false, "outputs": 2, "x": 550, - "y": 1360 + "y": 1360, + "wires": [ + [ + "dining_scene_toggle_001" + ], + [ + "dc98aceee1133a56" + ] + ] }, { "id": "2b837d7d2faf1d5a", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Dining table is on?", - "wires": [ - [ - "0d22e917d1b9469d" - ], - [ - "deab274cb333a51e" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -17998,16 +17819,21 @@ "entity_location": "data", "override_data": "msg", "x": 810, - "y": 1340 + "y": 1340, + "wires": [ + [ + "0d22e917d1b9469d" + ], + [ + "deab274cb333a51e" + ] + ] }, { "id": "28f2c687c20d4265", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18029,18 +17855,16 @@ "domain": "light", "service": "{{ service }}", "x": 1340, - "y": 1380 + "y": 1380, + "wires": [ + [] + ] }, { "id": "0d22e917d1b9469d", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn off", - "wires": [ - [ - "28f2c687c20d4265" - ] - ], "rules": [ { "t": "set", @@ -18063,18 +17887,18 @@ "to": "", "reg": false, "x": 1100, - "y": 1360 + "y": 1360, + "wires": [ + [ + "28f2c687c20d4265" + ] + ] }, { "id": "deab274cb333a51e", "type": "change", "z": "b70ee13eafa73823", "name": "Service: turn on", - "wires": [ - [ - "28f2c687c20d4265" - ] - ], "rules": [ { "t": "set", @@ -18097,21 +17921,18 @@ "to": "", "reg": false, "x": 1100, - "y": 1400 + "y": 1400, + "wires": [ + [ + "28f2c687c20d4265" + ] + ] }, { "id": "dc98aceee1133a56", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Any non main light on?", - "wires": [ - [ - "0d22e917d1b9469d" - ], - [ - "deab274cb333a51e" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -18144,16 +17965,21 @@ "entity_location": "data", "override_data": "msg", "x": 820, - "y": 1400 + "y": 1400, + "wires": [ + [ + "0d22e917d1b9469d" + ], + [ + "deab274cb333a51e" + ] + ] }, { "id": "a566b47735e884f7", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on/off lights livingroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18175,47 +18001,36 @@ "domain": "light", "service": "{{ service }}", "x": 1340, - "y": 1160 + "y": 1160, + "wires": [ + [] + ] }, { "id": "b46f52f581f07d43", "type": "comment", "z": "b70ee13eafa73823", "name": "Livingroom tap-dial", - "wires": [], "info": "", "x": 150, - "y": 2020 + "y": 2020, + "wires": [] }, { "id": "10325d851d92b3db", "type": "comment", "z": "b70ee13eafa73823", "name": "Dimmer functionality testing - HUE", - "wires": [], "info": "", "x": 400, - "y": 2020 + "y": 2020, + "wires": [] }, { "id": "2e50d893ea29f932", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Up step", - "wires": [ - [ - "f7192e46a47b653a", - "4c73d1e8092387b2" - ], - [ - "f7192e46a47b653a", - "0c483b69f2455536" - ], - [ - "f7192e46a47b653a", - "0cd947d505af3e73" - ] - ], "property": "dial_motion", "propertyType": "msg", "rules": [ @@ -18239,27 +18054,27 @@ "repair": false, "outputs": 3, "x": 540, - "y": 2260 + "y": 2260, + "wires": [ + [ + "f7192e46a47b653a", + "4c73d1e8092387b2" + ], + [ + "f7192e46a47b653a", + "0c483b69f2455536" + ], + [ + "f7192e46a47b653a", + "0cd947d505af3e73" + ] + ] }, { "id": "a4ea444bb95d8993", "type": "switch", "z": "b70ee13eafa73823", "name": "Brightness check - Down step", - "wires": [ - [ - "f7192e46a47b653a", - "7391f9b1cbede747" - ], - [ - "f7192e46a47b653a", - "05fd0d70d3bd26fd" - ], - [ - "f7192e46a47b653a", - "1649296f3891a37c" - ] - ], "property": "dial_motion", "propertyType": "msg", "rules": [ @@ -18283,18 +18098,27 @@ "repair": false, "outputs": 3, "x": 550, - "y": 2320 + "y": 2320, + "wires": [ + [ + "f7192e46a47b653a", + "7391f9b1cbede747" + ], + [ + "f7192e46a47b653a", + "05fd0d70d3bd26fd" + ], + [ + "f7192e46a47b653a", + "1649296f3891a37c" + ] + ] }, { "id": "0cd947d505af3e73", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18310,18 +18134,18 @@ "to": "", "reg": false, "x": 910, - "y": 2280 + "y": 2280, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "1649296f3891a37c", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18344,14 +18168,18 @@ "to": "", "reg": false, "x": 920, - "y": 2400 + "y": 2400, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "f7192e46a47b653a", "type": "debug", "z": "b70ee13eafa73823", "name": "tapdial debug", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -18361,18 +18189,14 @@ "statusVal": "", "statusType": "auto", "x": 880, - "y": 2500 + "y": 2500, + "wires": [] }, { "id": "0c483b69f2455536", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18388,18 +18212,18 @@ "to": "", "reg": false, "x": 910, - "y": 2240 + "y": 2240, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "4c73d1e8092387b2", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness increase (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18415,18 +18239,18 @@ "to": "", "reg": false, "x": 910, - "y": 2200 + "y": 2200, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "7391f9b1cbede747", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18442,18 +18266,18 @@ "to": "", "reg": false, "x": 920, - "y": 2320 + "y": 2320, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "05fd0d70d3bd26fd", "type": "change", "z": "b70ee13eafa73823", "name": "Brightness decrease (smooth)", - "wires": [ - [ - "0470a1771bbbe584" - ] - ], "rules": [ { "t": "set", @@ -18476,18 +18300,18 @@ "to": "", "reg": false, "x": 920, - "y": 2360 + "y": 2360, + "wires": [ + [ + "0470a1771bbbe584" + ] + ] }, { "id": "0470a1771bbbe584", "type": "ha-get-entities", "z": "b70ee13eafa73823", "name": "Find lights that are on", - "wires": [ - [ - "a28ab05bdedd5bbd" - ] - ], "server": "657c7463.48e1e4", "version": 1, "rules": [ @@ -18510,16 +18334,18 @@ "outputLocation": "payload", "outputResultsCount": 1, "x": 1300, - "y": 2300 + "y": 2300, + "wires": [ + [ + "a28ab05bdedd5bbd" + ] + ] }, { "id": "dab871622d804c6b", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Dim lights that are on", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18541,18 +18367,16 @@ "domain": "light", "service": "turn_on", "x": 1300, - "y": 2480 + "y": 2480, + "wires": [ + [] + ] }, { "id": "07fd05ad8f6aaecb", "type": "change", "z": "b70ee13eafa73823", "name": "Find entity id of each light", - "wires": [ - [ - "dab871622d804c6b" - ] - ], "rules": [ { "t": "set", @@ -18578,18 +18402,18 @@ "to": "", "reg": false, "x": 1310, - "y": 2420 + "y": 2420, + "wires": [ + [ + "dab871622d804c6b" + ] + ] }, { "id": "a28ab05bdedd5bbd", "type": "split", "z": "b70ee13eafa73823", "name": "Loop through each light", - "wires": [ - [ - "07fd05ad8f6aaecb" - ] - ], "splt": "\\n", "spltType": "str", "arraySplt": 1, @@ -18598,28 +18422,28 @@ "addname": "", "property": "payload", "x": 1310, - "y": 2360 + "y": 2360, + "wires": [ + [ + "07fd05ad8f6aaecb" + ] + ] }, { "id": "7b987dbc853e7d20", "type": "comment", "z": "b70ee13eafa73823", "name": "TODO", - "wires": [], "info": "- Does no longer work if lights are all off\n- Filament bulbs seem to be dimmed faster than others and turn off\n- Exclude Tetris light from this magic", "x": 1250, - "y": 2540 + "y": 2540, + "wires": [] }, { "id": "f875e3eadcb1d94f", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Hue - Living room guest switch", - "wires": [ - [ - "691f50e528c73024" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -18666,18 +18490,18 @@ } ], "x": 190, - "y": 1360 + "y": 1360, + "wires": [ + [ + "691f50e528c73024" + ] + ] }, { "id": "57a722e2ab174bc1", "type": "switch", "z": "b70ee13eafa73823", "name": "Button 4 release & hold", - "wires": [ - [ - "124ea1b2096c07ec" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -18691,16 +18515,18 @@ "repair": false, "outputs": 1, "x": 550, - "y": 1560 + "y": 1560, + "wires": [ + [ + "124ea1b2096c07ec" + ] + ] }, { "id": "124ea1b2096c07ec", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Toggle music mode", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18722,21 +18548,16 @@ "domain": "input_boolean", "service": "toggle", "x": 810, - "y": 1560 + "y": 1560, + "wires": [ + [] + ] }, { "id": "451542926c7b1dd2", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Music Control On", - "wires": [ - [ - "f71263e2817da390" - ], - [ - "42aaf23000066a7e" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -18783,18 +18604,21 @@ } ], "x": 140, - "y": 1660 + "y": 1660, + "wires": [ + [ + "f71263e2817da390" + ], + [ + "42aaf23000066a7e" + ] + ] }, { "id": "317a78818934e225", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Flash lights", - "wires": [ - [ - "203f27c455479e23" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18817,18 +18641,18 @@ "domain": "light", "service": "turn_on", "x": 630, - "y": 1720 + "y": 1720, + "wires": [ + [ + "203f27c455479e23" + ] + ] }, { "id": "f71263e2817da390", "type": "change", "z": "b70ee13eafa73823", "name": "Flash Blue", - "wires": [ - [ - "222353ea1c063036" - ] - ], "rules": [ { "t": "set", @@ -18844,18 +18668,18 @@ "to": "", "reg": false, "x": 410, - "y": 1640 + "y": 1640, + "wires": [ + [ + "222353ea1c063036" + ] + ] }, { "id": "42aaf23000066a7e", "type": "change", "z": "b70ee13eafa73823", "name": "Flash Green", - "wires": [ - [ - "222353ea1c063036" - ] - ], "rules": [ { "t": "set", @@ -18871,18 +18695,18 @@ "to": "", "reg": false, "x": 410, - "y": 1680 + "y": 1680, + "wires": [ + [ + "222353ea1c063036" + ] + ] }, { "id": "222353ea1c063036", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Create tmp scene", - "wires": [ - [ - "317a78818934e225" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18902,18 +18726,18 @@ "domain": "scene", "service": "create", "x": 630, - "y": 1660 + "y": 1660, + "wires": [ + [ + "317a78818934e225" + ] + ] }, { "id": "a890dae37cb6e247", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Delete tmp scene", - "wires": [ - [ - "22a05465f41aea40" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18933,18 +18757,18 @@ "domain": "scene", "service": "delete", "x": 1190, - "y": 1720 + "y": 1720, + "wires": [ + [ + "22a05465f41aea40" + ] + ] }, { "id": "8be5c8df48382bc5", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Go back to previous scene", - "wires": [ - [ - "a890dae37cb6e247" - ] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -18964,18 +18788,18 @@ "domain": "scene", "service": "turn_on", "x": 940, - "y": 1720 + "y": 1720, + "wires": [ + [ + "a890dae37cb6e247" + ] + ] }, { "id": "203f27c455479e23", "type": "delay", "z": "b70ee13eafa73823", "name": "", - "wires": [ - [ - "8be5c8df48382bc5" - ] - ], "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", @@ -18989,16 +18813,18 @@ "allowrate": false, "outputs": 1, "x": 640, - "y": 1780 + "y": 1780, + "wires": [ + [ + "8be5c8df48382bc5" + ] + ] }, { "id": "22a05465f41aea40", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Stop any effects", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -19021,19 +18847,16 @@ "domain": "light", "service": "turn_on", "x": 900, - "y": 1800 + "y": 1800, + "wires": [ + [] + ] }, { "id": "99ed51ceae7915cf", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Music control on?", - "wires": [ - [ - "9e1b61c654b9ee81" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -19053,24 +18876,19 @@ "entity_location": "data", "override_data": "msg", "x": 190, - "y": 2120 + "y": 2120, + "wires": [ + [ + "9e1b61c654b9ee81" + ], + [] + ] }, { "id": "179f0b0c2b86c079", "type": "switch", "z": "b70ee13eafa73823", "name": "Volume check - Up step", - "wires": [ - [ - "cc8831b6182557d2" - ], - [ - "0029357f750ce03c" - ], - [ - "a3f678465cf5e81f" - ] - ], "property": "dial_motion", "propertyType": "msg", "rules": [ @@ -19094,24 +18912,24 @@ "repair": false, "outputs": 3, "x": 890, - "y": 2040 + "y": 2040, + "wires": [ + [ + "cc8831b6182557d2" + ], + [ + "0029357f750ce03c" + ], + [ + "a3f678465cf5e81f" + ] + ] }, { "id": "6943ef25dc561946", "type": "switch", "z": "b70ee13eafa73823", "name": "Volume check - Down step", - "wires": [ - [ - "d8d786fbf89d22e8" - ], - [ - "e6bc9026eba92ef0" - ], - [ - "c8b0a802aa7912c4" - ] - ], "property": "dial_motion", "propertyType": "msg", "rules": [ @@ -19135,16 +18953,24 @@ "repair": false, "outputs": 3, "x": 900, - "y": 2100 + "y": 2100, + "wires": [ + [ + "d8d786fbf89d22e8" + ], + [ + "e6bc9026eba92ef0" + ], + [ + "c8b0a802aa7912c4" + ] + ] }, { "id": "6260853b954dce29", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Set Volume", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": true, @@ -19166,19 +18992,16 @@ "domain": "media_player", "service": "volume_set", "x": 1510, - "y": 2160 + "y": 2160, + "wires": [ + [] + ] }, { "id": "9e1b61c654b9ee81", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get current volume", - "wires": [ - [ - "dbffbb3c2e701c5d" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -19205,19 +19028,19 @@ "entity_location": "data", "override_data": "msg", "x": 510, - "y": 2120 + "y": 2120, + "wires": [ + [ + "dbffbb3c2e701c5d" + ], + [] + ] }, { "id": "dbffbb3c2e701c5d", "type": "change", "z": "b70ee13eafa73823", "name": "Store current volume", - "wires": [ - [ - "179f0b0c2b86c079", - "6943ef25dc561946" - ] - ], "rules": [ { "t": "set", @@ -19238,18 +19061,19 @@ "to": "", "reg": false, "x": 520, - "y": 2060 + "y": 2060, + "wires": [ + [ + "179f0b0c2b86c079", + "6943ef25dc561946" + ] + ] }, { "id": "cc8831b6182557d2", "type": "change", "z": "b70ee13eafa73823", "name": "0.07", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19265,18 +19089,18 @@ "to": "", "reg": false, "x": 1130, - "y": 1960 + "y": 1960, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "0029357f750ce03c", "type": "change", "z": "b70ee13eafa73823", "name": "0.03", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19292,18 +19116,18 @@ "to": "", "reg": false, "x": 1130, - "y": 2000 + "y": 2000, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "a3f678465cf5e81f", "type": "change", "z": "b70ee13eafa73823", "name": "0.01", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19319,18 +19143,18 @@ "to": "", "reg": false, "x": 1130, - "y": 2040 + "y": 2040, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "d8d786fbf89d22e8", "type": "change", "z": "b70ee13eafa73823", "name": "-0.07", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19346,18 +19170,18 @@ "to": "", "reg": false, "x": 1130, - "y": 2100 + "y": 2100, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "e6bc9026eba92ef0", "type": "change", "z": "b70ee13eafa73823", "name": "-0.03", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19373,18 +19197,18 @@ "to": "", "reg": false, "x": 1130, - "y": 2140 + "y": 2140, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "c8b0a802aa7912c4", "type": "change", "z": "b70ee13eafa73823", "name": "-0.01", - "wires": [ - [ - "3080f3a618d4368b" - ] - ], "rules": [ { "t": "set", @@ -19400,18 +19224,18 @@ "to": "", "reg": false, "x": 1130, - "y": 2180 + "y": 2180, + "wires": [ + [ + "3080f3a618d4368b" + ] + ] }, { "id": "7534af436f628e33", "type": "calculator", "z": "b70ee13eafa73823", "name": "Sum and ensure 2 decimals", - "wires": [ - [ - "6260853b954dce29" - ] - ], "inputMsgField": "payload", "outputMsgField": "payload", "operation": "sum", @@ -19421,18 +19245,18 @@ "decimals": 0, "decimals2": "2", "x": 1480, - "y": 2100 + "y": 2100, + "wires": [ + [ + "6260853b954dce29" + ] + ] }, { "id": "3080f3a618d4368b", "type": "change", "z": "b70ee13eafa73823", "name": "Create summable array", - "wires": [ - [ - "7534af436f628e33" - ] - ], "rules": [ { "t": "set", @@ -19448,21 +19272,18 @@ "to": "", "reg": false, "x": 1390, - "y": 2040 + "y": 2040, + "wires": [ + [ + "7534af436f628e33" + ] + ] }, { "id": "ccdac6a5471ce5d1", "type": "trigger-state", "z": "b70ee13eafa73823", "name": "Switching home theater to non heos", - "wires": [ - [ - "8b41a466c57cf276" - ], - [ - "1a1fb3664cb5cbc4" - ] - ], "server": "657c7463.48e1e4", "version": 5, "inputs": 0, @@ -19492,21 +19313,21 @@ "stateType": "str", "enableInput": false, "x": 220, - "y": 2620 + "y": 2620, + "wires": [ + [ + "8b41a466c57cf276" + ], + [ + "1a1fb3664cb5cbc4" + ] + ] }, { "id": "8b41a466c57cf276", "type": "switch", "z": "b70ee13eafa73823", "name": "Prev source was HEOS", - "wires": [ - [ - "9bf8ce152f92cc25" - ], - [ - "d5c9055d644276d7" - ] - ], "property": "data.old_state.attributes.source", "propertyType": "msg", "rules": [ @@ -19523,21 +19344,21 @@ "repair": false, "outputs": 2, "x": 570, - "y": 2680 + "y": 2680, + "wires": [ + [ + "9bf8ce152f92cc25" + ], + [ + "d5c9055d644276d7" + ] + ] }, { "id": "9bf8ce152f92cc25", "type": "switch", "z": "b70ee13eafa73823", "name": "Prev state was playing", - "wires": [ - [ - "8ae9c55c69b0ff6c" - ], - [ - "d5c9055d644276d7" - ] - ], "property": "data.old_state.state", "propertyType": "msg", "rules": [ @@ -19554,16 +19375,21 @@ "repair": false, "outputs": 2, "x": 560, - "y": 2620 + "y": 2620, + "wires": [ + [ + "8ae9c55c69b0ff6c" + ], + [ + "d5c9055d644276d7" + ] + ] }, { "id": "8ae9c55c69b0ff6c", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Pause media", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -19587,18 +19413,16 @@ "domain": "media_player", "service": "media_pause", "x": 1170, - "y": 2620 + "y": 2620, + "wires": [ + [] + ] }, { "id": "ab3f3ef4e3ab317d", "type": "split", "z": "b70ee13eafa73823", "name": "Split array", - "wires": [ - [ - "3194aebd902a20ff" - ] - ], "splt": "\\n", "spltType": "str", "arraySplt": 1, @@ -19607,18 +19431,18 @@ "addname": "", "property": "payload", "x": 1180, - "y": 2680 + "y": 2680, + "wires": [ + [ + "3194aebd902a20ff" + ] + ] }, { "id": "d5c9055d644276d7", "type": "change", "z": "b70ee13eafa73823", "name": "All media players, but livingroom", - "wires": [ - [ - "ab3f3ef4e3ab317d" - ] - ], "rules": [ { "t": "set", @@ -19634,19 +19458,18 @@ "to": "", "reg": false, "x": 950, - "y": 2680 + "y": 2680, + "wires": [ + [ + "ab3f3ef4e3ab317d" + ] + ] }, { "id": "76d6452c8ce8fa5c", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Get current state", - "wires": [ - [ - "6754aadb473ead61" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -19679,18 +19502,19 @@ "entity_location": "data", "override_data": "msg", "x": 910, - "y": 2740 + "y": 2740, + "wires": [ + [ + "6754aadb473ead61" + ], + [] + ] }, { "id": "6754aadb473ead61", "type": "change", "z": "b70ee13eafa73823", "name": "Get leader (if grouped) or self", - "wires": [ - [ - "3d1036d3fa33e2ad" - ] - ], "rules": [ { "t": "set", @@ -19706,16 +19530,18 @@ "to": "", "reg": false, "x": 1160, - "y": 2740 + "y": 2740, + "wires": [ + [ + "3d1036d3fa33e2ad" + ] + ] }, { "id": "3d1036d3fa33e2ad", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Pause media player", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -19735,18 +19561,16 @@ "domain": "media_player", "service": "media_pause", "x": 920, - "y": 2800 + "y": 2800, + "wires": [ + [] + ] }, { "id": "3194aebd902a20ff", "type": "delay", "z": "b70ee13eafa73823", "name": "", - "wires": [ - [ - "76d6452c8ce8fa5c" - ] - ], "pauseType": "rate", "timeout": "500", "timeoutUnits": "milliseconds", @@ -19760,14 +19584,18 @@ "allowrate": false, "outputs": 1, "x": 1360, - "y": 2680 + "y": 2680, + "wires": [ + [ + "76d6452c8ce8fa5c" + ] + ] }, { "id": "1a1fb3664cb5cbc4", "type": "debug", "z": "b70ee13eafa73823", "name": "No match", - "wires": [], "active": true, "tosidebar": true, "console": false, @@ -19777,38 +19605,34 @@ "statusVal": "", "statusType": "auto", "x": 490, - "y": 2720 + "y": 2720, + "wires": [] }, { "id": "e3060a7791881147", "type": "comment", "z": "b70ee13eafa73823", "name": "TV On - pause music", - "wires": [], "info": "", "x": 180, - "y": 2580 + "y": 2580, + "wires": [] }, { "id": "dc2a982e648d103b", "type": "comment", "z": "b70ee13eafa73823", "name": "Pause TV & lights", - "wires": [], "info": "", "x": 170, - "y": 2880 + "y": 2880, + "wires": [] }, { "id": "394cb7ef271fc2f8", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Media Box state", - "wires": [ - [ - "e04092e8f97898cf" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -19861,21 +19685,18 @@ } ], "x": 160, - "y": 2920 + "y": 2920, + "wires": [ + [ + "e04092e8f97898cf" + ] + ] }, { "id": "dc7567e498a75b12", "type": "switch", "z": "b70ee13eafa73823", "name": "Check state", - "wires": [ - [ - "39ea254eb72f0901" - ], - [ - "787b1101083df9bf" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -19894,19 +19715,21 @@ "repair": false, "outputs": 2, "x": 510, - "y": 2920 + "y": 2920, + "wires": [ + [ + "39ea254eb72f0901" + ], + [ + "787b1101083df9bf" + ] + ] }, { "id": "787b1101083df9bf", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Lights in movie mode?", - "wires": [ - [ - "71916041b8ca3d07" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -19933,19 +19756,19 @@ "entity_location": "data", "override_data": "msg", "x": 780, - "y": 2960 + "y": 2960, + "wires": [ + [ + "71916041b8ca3d07" + ], + [] + ] }, { "id": "39ea254eb72f0901", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Lights in movie-pause mode?", - "wires": [ - [ - "bb3c4a6174931a21" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -19972,16 +19795,19 @@ "entity_location": "data", "override_data": "msg", "x": 800, - "y": 2900 + "y": 2900, + "wires": [ + [ + "bb3c4a6174931a21" + ], + [] + ] }, { "id": "7f0f0d6e3eb5f8cb", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Update scene in selector", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20003,18 +19829,16 @@ "domain": "input_select", "service": "select_option", "x": 1390, - "y": 2920 + "y": 2920, + "wires": [ + [] + ] }, { "id": "bb3c4a6174931a21", "type": "change", "z": "b70ee13eafa73823", "name": "Switch to Movie mode", - "wires": [ - [ - "7f0f0d6e3eb5f8cb" - ] - ], "rules": [ { "t": "set", @@ -20030,18 +19854,18 @@ "to": "", "reg": false, "x": 1080, - "y": 2900 + "y": 2900, + "wires": [ + [ + "7f0f0d6e3eb5f8cb" + ] + ] }, { "id": "71916041b8ca3d07", "type": "change", "z": "b70ee13eafa73823", "name": "Switch to Movie pause mode", - "wires": [ - [ - "7f0f0d6e3eb5f8cb" - ] - ], "rules": [ { "t": "set", @@ -20057,19 +19881,19 @@ "to": "", "reg": false, "x": 1100, - "y": 2940 + "y": 2940, + "wires": [ + [ + "7f0f0d6e3eb5f8cb" + ] + ] }, { "id": "dfd77a76dc2e0568", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "Midday starts", - "wires": [ - [ - "6073e4e66bb6e228" - ] - ], "d": true, + "name": "Midday starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -20116,32 +19940,32 @@ } ], "x": 130, - "y": 680 + "y": 680, + "wires": [ + [ + "6073e4e66bb6e228" + ] + ] }, { "id": "6073e4e66bb6e228", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", + "x": 250, + "y": 740, "wires": [ [ "f833288986e00ae0" ] - ], - "x": 250, - "y": 740 + ] }, { "id": "afa6cccb1cfc8ddb", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "Late afternoon starts", - "wires": [ - [ - "2e03442c0d67da32" - ] - ], "d": true, + "name": "Late afternoon starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -20188,32 +20012,32 @@ } ], "x": 150, - "y": 780 + "y": 780, + "wires": [ + [ + "2e03442c0d67da32" + ] + ] }, { "id": "2e03442c0d67da32", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", + "x": 270, + "y": 840, "wires": [ [ "f833288986e00ae0" ] - ], - "x": 270, - "y": 840 + ] }, { "id": "097585a397ef8e60", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "Evening starts", - "wires": [ - [ - "67659db54987a408" - ] - ], "d": true, + "name": "Evening starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -20260,32 +20084,32 @@ } ], "x": 130, - "y": 880 + "y": 880, + "wires": [ + [ + "67659db54987a408" + ] + ] }, { "id": "67659db54987a408", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", + "x": 270, + "y": 940, "wires": [ [ "f833288986e00ae0" ] - ], - "x": 270, - "y": 940 + ] }, { "id": "a02362b40496cf27", "type": "server-state-changed", "z": "b70ee13eafa73823", - "name": "Late evening starts", - "wires": [ - [ - "a2f0111dc2cad4b2" - ] - ], "d": true, + "name": "Late evening starts", "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -20332,33 +20156,31 @@ } ], "x": 150, - "y": 980 + "y": 980, + "wires": [ + [ + "a2f0111dc2cad4b2" + ] + ] }, { "id": "a2f0111dc2cad4b2", "type": "subflow:be8264a322721305", "z": "b70ee13eafa73823", "name": "", + "x": 270, + "y": 1040, "wires": [ [ "f833288986e00ae0" ] - ], - "x": 270, - "y": 1040 + ] }, { "id": "f833288986e00ae0", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Livingroom lights on?", - "wires": [ - [ - "0836295ca0bc0df3", - "ce7a6033db2e3ffa" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -20385,28 +20207,30 @@ "entity_location": "data", "override_data": "msg", "x": 500, - "y": 520 + "y": 520, + "wires": [ + [ + "0836295ca0bc0df3", + "ce7a6033db2e3ffa" + ], + [] + ] }, { "id": "613a9be150591ee7", "type": "comment", "z": "b70ee13eafa73823", "name": "Harmony Remote Control", - "wires": [], "info": "", "x": 190, - "y": 3160 + "y": 3160, + "wires": [] }, { "id": "397fc02eaed29a41", "type": "server-events", "z": "b70ee13eafa73823", "name": "Listen to roku command events", - "wires": [ - [ - "dcc93b3ba73bee14" - ] - ], "server": "657c7463.48e1e4", "version": 3, "exposeAsEntityConfig": "", @@ -20428,38 +20252,18 @@ } ], "x": 210, - "y": 3200 + "y": 3200, + "wires": [ + [ + "dcc93b3ba73bee14" + ] + ] }, { "id": "dcc93b3ba73bee14", "type": "switch", "z": "b70ee13eafa73823", "name": "Event switch", - "wires": [ - [], - [ - "0cd947d505af3e73" - ], - [ - "1649296f3891a37c" - ], - [ - "8fd5e325dc59160a" - ], - [], - [ - "bb3c4a6174931a21" - ], - [ - "71916041b8ca3d07" - ], - [], - [], - [], - [], - [], - [] - ], "property": "payload.event.key", "propertyType": "msg", "rules": [ @@ -20533,16 +20337,38 @@ "repair": false, "outputs": 13, "x": 490, - "y": 3220 + "y": 3220, + "wires": [ + [], + [ + "0cd947d505af3e73" + ], + [ + "1649296f3891a37c" + ], + [ + "8fd5e325dc59160a" + ], + [], + [ + "bb3c4a6174931a21" + ], + [ + "71916041b8ca3d07" + ], + [], + [], + [], + [], + [], + [] + ] }, { "id": "8fd5e325dc59160a", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Shift the scene", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20564,18 +20390,16 @@ "domain": "input_button", "service": "press", "x": 880, - "y": 3200 + "y": 3200, + "wires": [ + [] + ] }, { "id": "e04092e8f97898cf", "type": "trigger", "z": "b70ee13eafa73823", "name": "wait 1 sec", - "wires": [ - [ - "dc7567e498a75b12" - ] - ], "op1": "", "op2": "", "op1type": "nul", @@ -20589,19 +20413,18 @@ "topic": "topic", "outputs": 1, "x": 340, - "y": 2920 + "y": 2920, + "wires": [ + [ + "dc7567e498a75b12" + ] + ] }, { "id": "ssc_motion_lr_19dda5bc955", "type": "server-state-changed", "z": "b70ee13eafa73823", "name": "Livingroom Motion Sensor", - "wires": [ - [ - "ca7ee0d8f3f6d02e" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -20647,19 +20470,19 @@ } ], "x": 150, - "y": 580 + "y": 580, + "wires": [ + [ + "ca7ee0d8f3f6d02e" + ], + [] + ] }, { "id": "ca7ee0d8f3f6d02e", "type": "api-current-state", "z": "b70ee13eafa73823", "name": "Motion - lights already on?", - "wires": [ - [], - [ - "ec6ae14bf7d95e92" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -20686,18 +20509,19 @@ "entity_location": "data", "override_data": "msg", "x": 520, - "y": 580 + "y": 580, + "wires": [ + [], + [ + "ec6ae14bf7d95e92" + ] + ] }, { "id": "dining_route_001", "type": "function", "z": "b70ee13eafa73823", "name": "Swap to no-dining scene if dining table off", - "wires": [ - [ - "f07c5e952b2f368b" - ] - ], "func": "const states = global.get('homeassistant')?.homeAssistantLatest?.states || {};\nconst diningOn = states['light.living_room_dining_table']?.state === 'on';\nif (!diningOn) {\n msg.entity_id = msg.entity_id.replace(/_ha$/, '') + '_no_dining';\n}\nreturn msg;", "outputs": 1, "timeout": 0, @@ -20706,13 +20530,26 @@ "finalize": "", "libs": [], "x": 1560, - "y": 160 + "y": 160, + "wires": [ + [ + "f07c5e952b2f368b" + ] + ] }, { "id": "dining_scene_toggle_001", "type": "function", "z": "b70ee13eafa73823", "name": "Dining toggle: apply scene variant", + "func": "const states = global.get('homeassistant')?.homeAssistantLatest?.states || {};\nconst diningOn = states['light.living_room_dining_table']?.state === 'on';\n\nconst mainLights = [\n 'light.living_room_ceiling_1',\n 'light.living_room_ceiling_2',\n 'light.living_room_ceiling_3',\n 'light.living_room_bookshelf',\n 'light.living_room_top_of_bar'\n];\nconst sceneActive = mainLights.some(id => states[id]?.state === 'on');\n\nif (!sceneActive) {\n return diningOn ? [null, { ...msg }, null] : [null, null, { ...msg }];\n}\n\nconst selectorName = states['input_select.livingroom_scene_selector']?.state || '';\nconst slug = selectorName.toLowerCase()\n .replace(/[^a-z0-9 ]/g, '')\n .trim()\n .replace(/ +/g, '_');\n\nconst sceneId = diningOn\n ? 'scene.livingroom_' + slug + '_no_dining'\n : 'scene.livingroom_' + slug + '_ha';\n\nreturn [{ ...msg, entity_id: sceneId }, diningOn ? { ...msg } : null, null];", + "outputs": 3, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 1060, + "y": 1340, "wires": [ [ "dining_scene_apply_001" @@ -20723,24 +20560,13 @@ [ "dining_light_on_001" ] - ], - "func": "const states = global.get('homeassistant')?.homeAssistantLatest?.states || {};\nconst diningOn = states['light.living_room_dining_table']?.state === 'on';\n\nconst mainLights = [\n 'light.living_room_ceiling_1',\n 'light.living_room_ceiling_2',\n 'light.living_room_ceiling_3',\n 'light.living_room_bookshelf',\n 'light.living_room_top_of_bar'\n];\nconst sceneActive = mainLights.some(id => states[id]?.state === 'on');\n\nif (!sceneActive) {\n return diningOn ? [null, { ...msg }, null] : [null, null, { ...msg }];\n}\n\nconst selectorName = states['input_select.livingroom_scene_selector']?.state || '';\nconst slug = selectorName.toLowerCase()\n .replace(/[^a-z0-9 ]/g, '')\n .trim()\n .replace(/ +/g, '_');\n\nconst sceneId = diningOn\n ? 'scene.livingroom_' + slug + '_no_dining'\n : 'scene.livingroom_' + slug + '_ha';\n\nreturn [{ ...msg, entity_id: sceneId }, diningOn ? { ...msg } : null, null];", - "outputs": 3, - "noerr": 0, - "initialize": "", - "finalize": "", - "libs": [], - "x": 1060, - "y": 1340 + ] }, { "id": "dining_scene_apply_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Apply scene variant", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20762,16 +20588,16 @@ "domain": "scene", "service": "turn_on", "x": 1300, - "y": 1300 + "y": 1300, + "wires": [ + [] + ] }, { "id": "dining_light_off_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn off dining lamp", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20793,16 +20619,16 @@ "domain": "light", "service": "turn_off", "x": 1300, - "y": 1380 + "y": 1380, + "wires": [ + [] + ] }, { "id": "dining_light_on_001", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Turn on dining lamp", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20824,51 +20650,51 @@ "domain": "light", "service": "turn_on", "x": 1300, - "y": 1460 + "y": 1460, + "wires": [ + [] + ] }, { "id": "p2catch_lr", "type": "catch", "z": "b70ee13eafa73823", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 3860, "wires": [ [ "p2fmt_lr" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 3860 + ] }, { "id": "p2fmt_lr", "type": "function", "z": "b70ee13eafa73823", "name": "Format error", - "wires": [ - [ - "p2ntfy_lr" - ] - ], "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: Living room',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 3860 + "y": 3860, + "wires": [ + [ + "p2ntfy_lr" + ] + ] }, { "id": "p2ntfy_lr", "type": "api-call-service", "z": "b70ee13eafa73823", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -20890,18 +20716,18 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 3860 - }, - { - "type": "tab", - "label": "Bathroom", - "id": "c7f876875da48b87" + "y": 3860, + "wires": [ + [] + ] }, { "id": "13c933aa7d791e63", "type": "subflow:52430f5e9f9ee267", "z": "c7f876875da48b87", "name": "", + "x": 670, + "y": 160, "wires": [ [ "cc46642a3ea04954" @@ -20921,20 +20747,13 @@ [ "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", @@ -20948,18 +20767,18 @@ "topic": "topic", "outputs": 1, "x": 600, - "y": 360 + "y": 360, + "wires": [ + [ + "ce6d7cb10437a4ac" + ] + ] }, { "id": "a2887d07baac63d5", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5:00 min", - "wires": [ - [ - "ce6d7cb10437a4ac" - ] - ], "op1": "", "op2": "300", "op1type": "nul", @@ -20973,18 +20792,18 @@ "topic": "topic", "outputs": 1, "x": 610, - "y": 320 + "y": 320, + "wires": [ + [ + "ce6d7cb10437a4ac" + ] + ] }, { "id": "173369324c7a842c", "type": "change", "z": "c7f876875da48b87", "name": "Flash at brightness 100%", - "wires": [ - [ - "3013e31f0b3d9303" - ] - ], "rules": [ { "t": "set", @@ -21000,19 +20819,18 @@ "to": "", "reg": false, "x": 1150, - "y": 440 + "y": 440, + "wires": [ + [ + "3013e31f0b3d9303" + ] + ] }, { "id": "812f8294add5575c", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom lights on", - "wires": [ - [ - "eab005bf8b682c46" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -21059,19 +20877,19 @@ } ], "x": 150, - "y": 240 + "y": 240, + "wires": [ + [ + "eab005bf8b682c46" + ], + [] + ] }, { "id": "23f3fd10ac242022", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom Humidity Changed", - "wires": [ - [ - "f1a2b3c4d5e60001" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -21118,16 +20936,19 @@ } ], "x": 180, - "y": 1040 + "y": 1040, + "wires": [ + [ + "f1a2b3c4d5e60001" + ], + [] + ] }, { "id": "b2a9a137a909e257", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn on fan", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21149,18 +20970,16 @@ "domain": "switch", "service": "turn_on", "x": 670, - "y": 1040 + "y": 1040, + "wires": [ + [] + ] }, { "id": "7e4f4bb9c0c9ef2b", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5:00", - "wires": [ - [ - "82599133dd2b9883" - ] - ], "op1": "", "op2": "5 minutes past", "op1type": "nul", @@ -21174,19 +20993,18 @@ "topic": "topic", "outputs": 1, "x": 670, - "y": 1120 + "y": 1120, + "wires": [ + [ + "82599133dd2b9883" + ] + ] }, { "id": "82599133dd2b9883", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Get Bathroom Humidity", - "wires": [ - [ - "d6e7f8a9b0c10002" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -21219,16 +21037,19 @@ "entity_location": "data", "override_data": "msg", "x": 950, - "y": 1120 + "y": 1120, + "wires": [ + [ + "d6e7f8a9b0c10002" + ], + [] + ] }, { "id": "27d9e5846a679b8b", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off fan", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21250,29 +21071,26 @@ "domain": "switch", "service": "turn_off", "x": 1510, - "y": 1120 + "y": 1120, + "wires": [ + [] + ] }, { "id": "4548a32796918fd8", "type": "comment", "z": "c7f876875da48b87", "name": "Bathroom ventilator automation shower", - "wires": [], "info": "", "x": 210, - "y": 1000 + "y": 1000, + "wires": [] }, { "id": "3d44cb85e182a197", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathroom fan turned on", - "wires": [ - [ - "7e4f4bb9c0c9ef2b" - ], - [] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -21319,27 +21137,19 @@ } ], "x": 160, - "y": 1120 + "y": 1120, + "wires": [ + [ + "7e4f4bb9c0c9ef2b" + ], + [] + ] }, { "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, @@ -21386,18 +21196,27 @@ } ], "x": 180, - "y": 320 + "y": 320, + "wires": [ + [ + "eab005bf8b682c46", + "a2887d07baac63d5", + "8ff99e0276ad242f", + "580c3afd65deefed", + "cbba47369f1e6479" + ], + [ + "a2887d07baac63d5", + "8ff99e0276ad242f", + "52af4ffdf85f60e4" + ] + ] }, { "id": "cc46642a3ea04954", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Bright", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], "rules": [ { "t": "set", @@ -21413,16 +21232,18 @@ "to": "", "reg": false, "x": 1010, - "y": 120 + "y": 120, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] }, { "id": "ed2d549e91e1399d", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn on Scene", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21444,18 +21265,16 @@ "domain": "scene", "service": "turn_on", "x": 1560, - "y": 100 + "y": 100, + "wires": [ + [] + ] }, { "id": "1ae97faec6bec4ae", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Evening", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], "rules": [ { "t": "set", @@ -21471,18 +21290,18 @@ "to": "", "reg": false, "x": 1010, - "y": 160 + "y": 160, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] }, { "id": "ddf62bacca5574f6", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Night", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], "rules": [ { "t": "set", @@ -21498,16 +21317,18 @@ "to": "", "reg": false, "x": 1000, - "y": 200 + "y": 200, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] }, { "id": "3013e31f0b3d9303", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Execute effect on lights bathroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21529,29 +21350,26 @@ "domain": "light", "service": "turn_on", "x": 1540, - "y": 440 + "y": 440, + "wires": [ + [] + ] }, { "id": "bdccd31c131b65fb", "type": "comment", "z": "c7f876875da48b87", "name": "Bathroom automated lights", - "wires": [], "info": "", "x": 170, - "y": 200 + "y": 200, + "wires": [] }, { "id": "a9f5122a5704e0e2", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", - "wires": [ - [ - "ff97c96955f8d423" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -21571,22 +21389,19 @@ "entity_location": "data", "override_data": "msg", "x": 1040, - "y": 340 + "y": 340, + "wires": [ + [ + "ff97c96955f8d423" + ], + [] + ] }, { "id": "38ff5b8ecfcbfdd0", "type": "server-state-changed", "z": "c7f876875da48b87", "name": "Bathmode turned on", - "wires": [ - [ - "20da8eedd69886b0", - "f4a8732084a282d7" - ], - [ - "13c933aa7d791e63" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 2, @@ -21633,18 +21448,22 @@ } ], "x": 150, - "y": 100 + "y": 100, + "wires": [ + [ + "20da8eedd69886b0", + "f4a8732084a282d7" + ], + [ + "13c933aa7d791e63" + ] + ] }, { "id": "20da8eedd69886b0", "type": "change", "z": "c7f876875da48b87", "name": "Scene Bathroom Bath", - "wires": [ - [ - "ed2d549e91e1399d" - ] - ], "rules": [ { "t": "set", @@ -21660,29 +21479,28 @@ "to": "", "reg": false, "x": 1000, - "y": 80 + "y": 80, + "wires": [ + [ + "ed2d549e91e1399d" + ] + ] }, { "id": "b8f30c8224cf9d74", "type": "comment", "z": "c7f876875da48b87", "name": "Bathmode ", - "wires": [], "info": "", "x": 120, - "y": 60 + "y": 60, + "wires": [] }, { "id": "eab005bf8b682c46", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", - "wires": [ - [ - "13c933aa7d791e63" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -21702,16 +21520,19 @@ "entity_location": "data", "override_data": "msg", "x": 440, - "y": 220 + "y": 220, + "wires": [ + [ + "13c933aa7d791e63" + ], + [] + ] }, { "id": "97b500f5140c1dc1", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off lights bathroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21733,18 +21554,16 @@ "domain": "light", "service": "turn_off", "x": 1510, - "y": 380 + "y": 380, + "wires": [ + [] + ] }, { "id": "ce6d7cb10437a4ac", "type": "change", "z": "c7f876875da48b87", "name": "Store which delay", - "wires": [ - [ - "a9f5122a5704e0e2" - ] - ], "rules": [ { "t": "set", @@ -21760,21 +21579,18 @@ "to": "", "reg": false, "x": 830, - "y": 340 + "y": 340, + "wires": [ + [ + "a9f5122a5704e0e2" + ] + ] }, { "id": "ff97c96955f8d423", "type": "switch", "z": "c7f876875da48b87", "name": "5:00 or 4:30 min delay", - "wires": [ - [ - "97b500f5140c1dc1" - ], - [ - "173369324c7a842c" - ] - ], "property": "delay", "propertyType": "msg", "rules": [ @@ -21793,18 +21609,21 @@ "repair": false, "outputs": 2, "x": 840, - "y": 420 + "y": 420, + "wires": [ + [ + "97b500f5140c1dc1" + ], + [ + "173369324c7a842c" + ] + ] }, { "id": "cbba47369f1e6479", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait 1:30 min", - "wires": [ - [ - "e12d8801b6c6f320" - ] - ], "op1": "", "op2": "90", "op1type": "nul", @@ -21818,18 +21637,18 @@ "topic": "topic", "outputs": 1, "x": 640, - "y": 660 + "y": 660, + "wires": [ + [ + "e12d8801b6c6f320" + ] + ] }, { "id": "580c3afd65deefed", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 2:00 min", - "wires": [ - [ - "e12d8801b6c6f320" - ] - ], "op1": "", "op2": "120", "op1type": "nul", @@ -21843,18 +21662,18 @@ "topic": "topic", "outputs": 1, "x": 650, - "y": 620 + "y": 620, + "wires": [ + [ + "e12d8801b6c6f320" + ] + ] }, { "id": "26f9395831aa077c", "type": "change", "z": "c7f876875da48b87", "name": "Flash at brightness 100%", - "wires": [ - [ - "b1e7dd85582b7d3e" - ] - ], "rules": [ { "t": "set", @@ -21870,16 +21689,18 @@ "to": "", "reg": false, "x": 1270, - "y": 820 + "y": 820, + "wires": [ + [ + "b1e7dd85582b7d3e" + ] + ] }, { "id": "b1e7dd85582b7d3e", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Execute effect on lights bathroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21901,19 +21722,16 @@ "domain": "light", "service": "turn_on", "x": 1580, - "y": 820 + "y": 820, + "wires": [ + [] + ] }, { "id": "07d4571f236fd04b", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Noone bathing?", - "wires": [ - [ - "32e3e60ad0e0d9a1" - ], - [] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -21933,16 +21751,19 @@ "entity_location": "data", "override_data": "msg", "x": 1100, - "y": 640 + "y": 640, + "wires": [ + [ + "32e3e60ad0e0d9a1" + ], + [] + ] }, { "id": "a8ad8572dc926e44", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off lights bathroom", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -21964,18 +21785,16 @@ "domain": "light", "service": "turn_off", "x": 1550, - "y": 760 + "y": 760, + "wires": [ + [] + ] }, { "id": "ade1222fab2ea469", "type": "inject", "z": "c7f876875da48b87", "name": "", - "wires": [ - [ - "32e3e60ad0e0d9a1" - ] - ], "props": [ { "p": "payload" @@ -21993,19 +21812,18 @@ "payload": "", "payloadType": "date", "x": 140, - "y": 740 + "y": 740, + "wires": [ + [ + "32e3e60ad0e0d9a1" + ] + ] }, { "id": "32e3e60ad0e0d9a1", "type": "api-current-state", "z": "c7f876875da48b87", "name": "Bathroom door closed?", - "wires": [ - [], - [ - "bbd7dc3adff7b866" - ] - ], "server": "657c7463.48e1e4", "version": 3, "outputs": 2, @@ -22038,19 +21856,19 @@ "entity_location": "data", "override_data": "msg", "x": 1350, - "y": 640 + "y": 640, + "wires": [ + [], + [ + "bbd7dc3adff7b866" + ] + ] }, { "id": "52af4ffdf85f60e4", "type": "change", "z": "c7f876875da48b87", "name": "Store motion off time", - "wires": [ - [ - "580c3afd65deefed", - "cbba47369f1e6479" - ] - ], "rules": [ { "t": "set", @@ -22066,18 +21884,19 @@ "to": "", "reg": false, "x": 400, - "y": 680 + "y": 680, + "wires": [ + [ + "580c3afd65deefed", + "cbba47369f1e6479" + ] + ] }, { "id": "e12d8801b6c6f320", "type": "change", "z": "c7f876875da48b87", "name": "Store which delay", - "wires": [ - [ - "07d4571f236fd04b" - ] - ], "rules": [ { "t": "set", @@ -22093,21 +21912,18 @@ "to": "", "reg": false, "x": 890, - "y": 640 + "y": 640, + "wires": [ + [ + "07d4571f236fd04b" + ] + ] }, { "id": "bbd7dc3adff7b866", "type": "switch", "z": "c7f876875da48b87", "name": "2:00 or 1:30 min delay", - "wires": [ - [ - "a8ad8572dc926e44" - ], - [ - "26f9395831aa077c" - ] - ], "property": "delay", "propertyType": "msg", "rules": [ @@ -22126,18 +21942,21 @@ "repair": false, "outputs": 2, "x": 940, - "y": 780 + "y": 780, + "wires": [ + [ + "a8ad8572dc926e44" + ], + [ + "26f9395831aa077c" + ] + ] }, { "id": "f4a8732084a282d7", "type": "trigger", "z": "c7f876875da48b87", "name": "Wait for 5 hours", - "wires": [ - [ - "4b98e17771cc3851" - ] - ], "op1": "", "op2": "", "op1type": "nul", @@ -22151,16 +21970,18 @@ "topic": "topic", "outputs": 1, "x": 600, - "y": 520 + "y": 520, + "wires": [ + [ + "4b98e17771cc3851" + ] + ] }, { "id": "4b98e17771cc3851", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Turn off bath mode", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -22182,28 +22003,26 @@ "domain": "input_boolean", "service": "turn_off", "x": 850, - "y": 520 + "y": 520, + "wires": [ + [] + ] }, { "id": "bb74897476a1a5e6", "type": "comment", "z": "c7f876875da48b87", "name": "Automatic turn off bath mode after X hours", - "wires": [], "info": "", "x": 220, - "y": 480 + "y": 480, + "wires": [] }, { "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, @@ -22212,21 +22031,18 @@ "finalize": "", "libs": [], "x": 460, - "y": 1040 + "y": 1040, + "wires": [ + [ + "b2a9a137a909e257" + ] + ] }, { "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, @@ -22235,20 +22051,21 @@ "finalize": "", "libs": [], "x": 1240, - "y": 1120 + "y": 1120, + "wires": [ + [ + "27d9e5846a679b8b" + ], + [ + "7e4f4bb9c0c9ef2b" + ] + ] }, { "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, @@ -22295,18 +22112,20 @@ } ], "x": 180, - "y": 140 + "y": 140, + "wires": [ + [ + "13c933aa7d791e63", + "a2887d07baac63d5", + "8ff99e0276ad242f" + ] + ] }, { "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, @@ -22334,21 +22153,18 @@ "forType": "num", "forUnits": "minutes", "x": 830, - "y": 240 + "y": 240, + "wires": [ + [ + "bath_br_switch_01" + ] + ] }, { "id": "bath_br_switch_01", "type": "switch", "z": "c7f876875da48b87", "name": "Bedroom brightness > 50%?", - "wires": [ - [ - "1ae97faec6bec4ae" - ], - [ - "ddf62bacca5574f6" - ] - ], "property": "data.attributes.brightness", "propertyType": "msg", "rules": [ @@ -22365,51 +22181,56 @@ "repair": false, "outputs": 2, "x": 1080, - "y": 240 + "y": 240, + "wires": [ + [ + "1ae97faec6bec4ae" + ], + [ + "ddf62bacca5574f6" + ] + ] }, { "id": "p2catch_bth", "type": "catch", "z": "c7f876875da48b87", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1320, "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, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1320 + "y": 1320, + "wires": [ + [ + "p2ntfy_bth" + ] + ] }, { "id": "p2ntfy_bth", "type": "api-call-service", "z": "c7f876875da48b87", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -22431,33 +22252,26 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1320 - }, - { - "type": "tab", - "label": "Home Presence", - "id": "6dfa989bb120e6c6" + "y": 1320, + "wires": [ + [] + ] }, { "id": "pres_c_homemode", "type": "comment", "z": "6dfa989bb120e6c6", "name": "── Home Mode ──", - "wires": [], "info": "", "x": 130, - "y": 60 + "y": 60, + "wires": [] }, { "id": "pres001a2b3c4d5e", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Mischa presence", - "wires": [ - [ - "pres002a2b3c4d5e" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22504,21 +22318,18 @@ } ], "x": 120, - "y": 100 + "y": 100, + "wires": [ + [ + "pres002a2b3c4d5e" + ] + ] }, { "id": "pres002a2b3c4d5e", "type": "switch", "z": "6dfa989bb120e6c6", "name": "Home or Away?", - "wires": [ - [ - "pres003a2b3c4d5e" - ], - [ - "pres004a2b3c4d5e" - ] - ], "property": "payload", "propertyType": "msg", "rules": [ @@ -22537,16 +22348,21 @@ "repair": false, "outputs": 2, "x": 400, - "y": 100 + "y": 100, + "wires": [ + [ + "pres003a2b3c4d5e" + ], + [ + "pres004a2b3c4d5e" + ] + ] }, { "id": "pres003a2b3c4d5e", "type": "api-call-service", "z": "6dfa989bb120e6c6", "name": "Set Home", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -22568,16 +22384,16 @@ "domain": "input_select", "service": "select_option", "x": 660, - "y": 60 + "y": 60, + "wires": [ + [] + ] }, { "id": "pres004a2b3c4d5e", "type": "api-call-service", "z": "6dfa989bb120e6c6", "name": "Set Away", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -22599,78 +22415,76 @@ "domain": "input_select", "service": "select_option", "x": 660, - "y": 140 + "y": 140, + "wires": [ + [] + ] }, { "id": "pres_sm_c_header", "type": "comment", "z": "6dfa989bb120e6c6", "name": "── Room Presence State Machine ──", - "wires": [], "info": "", "x": 190, - "y": 300 + "y": 300, + "wires": [] }, { "id": "pres_sm_c_person", "type": "comment", "z": "6dfa989bb120e6c6", "name": "Person", - "wires": [], "info": "", "x": 90, - "y": 360 + "y": 360, + "wires": [] }, { "id": "pres_sm_c_hall", "type": "comment", "z": "6dfa989bb120e6c6", "name": "Hallway (direction + state)", - "wires": [], "info": "", "x": 150, - "y": 480 + "y": 480, + "wires": [] }, { "id": "pres_sm_c_rooms", "type": "comment", "z": "6dfa989bb120e6c6", "name": "Room Motion Sensors", - "wires": [], "info": "", "x": 140, - "y": 780 + "y": 780, + "wires": [] }, { "id": "pres_sm_c_sm", "type": "comment", "z": "6dfa989bb120e6c6", "name": "State Machine", - "wires": [], "info": "", "x": 450, - "y": 580 + "y": 580, + "wires": [] }, { "id": "pres_sm_c_out", "type": "comment", "z": "6dfa989bb120e6c6", "name": "Outputs", - "wires": [], "info": "", "x": 730, - "y": 580 + "y": 580, + "wires": [] }, { "id": "pres_sm_person", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Person (room SM)", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22717,18 +22531,18 @@ } ], "x": 130, - "y": 400 + "y": 400, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_hall1", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Hallway S1 (corner/front door)", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22775,18 +22589,18 @@ } ], "x": 160, - "y": 520 + "y": 520, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_hall2", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Hallway S2 (near living room)", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22833,18 +22647,18 @@ } ], "x": 160, - "y": 580 + "y": 580, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_hall3", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Hallway S3 (near kitchen)", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22891,18 +22705,18 @@ } ], "x": 150, - "y": 640 + "y": 640, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_hallg", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Hallway (group)", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -22949,18 +22763,18 @@ } ], "x": 120, - "y": 700 + "y": 700, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_lr", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Living Room Motion", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -23007,18 +22821,18 @@ } ], "x": 130, - "y": 820 + "y": 820, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_bed", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Bedroom Motion", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -23065,18 +22879,18 @@ } ], "x": 120, - "y": 880 + "y": 880, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_bath", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Bathroom Motion", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -23123,18 +22937,18 @@ } ], "x": 120, - "y": 940 + "y": 940, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_kit", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Kitchen Motion", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -23181,21 +22995,18 @@ } ], "x": 120, - "y": 1000 + "y": 1000, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "pres_sm_func", "type": "function", "z": "6dfa989bb120e6c6", "name": "Room Presence SM", - "wires": [ - [ - "pres_sm_api" - ], - [ - "pres_sm_dbg" - ] - ], "func": "// === ROOM PRESENCE STATE MACHINE ===\n// msg.topic = triggering entity_id (from triggerId output property)\n// msg.payload = entity state string\n// msg.data = full HASC event data\n\nconst entityId = (msg.data && msg.data.entity_id) ? msg.data.entity_id : (msg.topic || '');\nconst newState = (msg.data && msg.data.new_state) ? msg.data.new_state.state : msg.payload;\n\n// Guest mode guard — multi-person breaks single-occupant assumptions\nconst ha = global.get('homeassistant') || {};\nconst haStates = (ha.homeAssistantLatest || {}).states || {};\nconst guestMode = (haStates['input_boolean.guest_mode'] || {}).state;\nif (guestMode === 'on') return null;\n\n// Current state from flow context\nconst currentRoom = flow.get('currentRoom') || 'unknown';\n\n// ── Helpers ────────────────────────────────────────────────────────────────\n\nfunction capitalize(s) {\n const map = {\n unknown: 'Unknown', away: 'Away', hallway: 'Hallway',\n living_room: 'Livingroom', bedroom: 'Bedroom',\n bathroom: 'Bathroom', kitchen: 'Kitchen', balcony: 'Balcony'\n };\n return map[s] || (s.charAt(0).toUpperCase() + s.slice(1));\n}\n\nfunction cancelDestTimer() {\n const h = flow.get('destTimerHandle');\n if (h) { clearTimeout(h); flow.set('destTimerHandle', null); }\n}\n\n\nfunction setDestTimer() {\n cancelDestTimer();\n const h = setTimeout(function () {\n const lr = flow.get('lastRoom') || 'unknown';\n flow.set('currentRoom', lr);\n flow.set('destTimerHandle', null);\n node.send([\n { payload: capitalize(lr) },\n { payload: '[presence] dest-timer expired → reverted to ' + lr }\n ]);\n }, 90000);\n flow.set('destTimerHandle', h);\n}\n\n\nfunction setState(newRoom) {\n const prev = flow.get('currentRoom') || 'unknown';\n if (newRoom === prev) return null; // no change needed\n flow.set('lastRoom', prev);\n flow.set('currentRoom', newRoom);\n return [\n { payload: capitalize(newRoom) },\n { payload: '[presence] ' + prev + ' → ' + newRoom + ' (via ' + entityId + ')' }\n ];\n}\n\nfunction updateHallwaySequence(sensorNum) {\n // TODO: direction detection not yet implemented — sequence data is stored but not consumed.\n // Intended to detect hallway direction (e.g. S1→S2 = heading toward living room,\n // S2→S1 = heading toward front door).\n let seq = flow.get('hallwaySequence') || [];\n const now = Date.now();\n seq = seq.filter(function (e) { return now - e.time < 15000; });\n seq.push({ sensor: sensorNum, time: now });\n flow.set('hallwaySequence', seq);\n flow.set('lastHallwayTime', now);\n}\n\n// ── Transitions ────────────────────────────────────────────────────────────\n\n// 1. Person home / away\nif (entityId === 'person.mischa_gorinskat') {\n if (newState === 'not_home') {\n cancelDestTimer();\n return setState('away');\n }\n if (newState === 'home') {\n return setState('unknown');\n }\n return null;\n}\n\n// Ignore all motion when person is away\nif (currentRoom === 'away') return null;\n\n// 2. Individual hallway sensors — direction tracking only, no state change\nif (entityId === 'binary_sensor.hallway_motion_sensor_1_occupancy') {\n if (newState === 'on') updateHallwaySequence(1);\n return null;\n}\nif (entityId === 'binary_sensor.hallway_motion_sensor_2_occupancy') {\n if (newState === 'on') updateHallwaySequence(2);\n return null;\n}\nif (entityId === 'binary_sensor.hallway_motion_sensor_3_occupancy') {\n if (newState === 'on') updateHallwaySequence(3);\n return null;\n}\n\n// 3. Hallway group — primary state change trigger\nif (entityId === 'binary_sensor.hallway_occupancy') {\n if (newState === 'on') {\n flow.set('lastRoom', currentRoom); // save room before entering hallway\n setDestTimer(); // 90s: if no room fires → revert\n return setState('hallway');\n }\n return null; // hallway turning off doesn't trigger a state change\n}\n\n// 4. Room sensors\nconst roomMap = {\n 'binary_sensor.livingroom_motion_sensor_occupancy': 'living_room',\n 'binary_sensor.bedroom_motion_sensor_occupancy': 'bedroom',\n 'binary_sensor.bathroom_motion_occupancy': 'bathroom',\n 'binary_sensor.kitchen_motion_sensor_occupancy': 'kitchen',\n 'binary_sensor.balcony_motion_occupancy': 'balcony'\n};\n\nconst targetRoom = roomMap[entityId];\nif (targetRoom && newState === 'on') {\n cancelDestTimer(); // confirmed destination\n\n const canTransition =\n currentRoom === 'hallway' ||\n currentRoom === targetRoom ||\n currentRoom === 'unknown' ||\n (targetRoom === 'living_room' && currentRoom === 'balcony') || // return from balcony\n (targetRoom === 'balcony' && currentRoom === 'living_room'); // step onto balcony\n\n if (canTransition) return setState(targetRoom);\n return null;\n}\n\nreturn null;", "outputs": 2, "timeout": 0, @@ -23204,16 +23015,21 @@ "finalize": "", "libs": [], "x": 480, - "y": 620 + "y": 620, + "wires": [ + [ + "pres_sm_api" + ], + [ + "pres_sm_dbg" + ] + ] }, { "id": "pres_sm_api", "type": "api-call-service", "z": "6dfa989bb120e6c6", "name": "Set Room Presence", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -23235,14 +23051,16 @@ "domain": "input_select", "service": "select_option", "x": 780, - "y": 620 + "y": 620, + "wires": [ + [] + ] }, { "id": "pres_sm_dbg", "type": "debug", "z": "6dfa989bb120e6c6", "name": "Presence log", - "wires": [], "active": false, "tosidebar": true, "console": false, @@ -23252,18 +23070,14 @@ "statusVal": "", "statusType": "auto", "x": 750, - "y": 680 + "y": 680, + "wires": [] }, { "id": "pres_sm_balcony", "type": "server-state-changed", "z": "6dfa989bb120e6c6", "name": "Balcony Motion", - "wires": [ - [ - "pres_sm_func" - ] - ], "server": "657c7463.48e1e4", "version": 6, "outputs": 1, @@ -23310,51 +23124,53 @@ } ], "x": 120, - "y": 1060 + "y": 1060, + "wires": [ + [ + "pres_sm_func" + ] + ] }, { "id": "p2catch_prs", "type": "catch", "z": "6dfa989bb120e6c6", "name": "Catch all errors", + "scope": null, + "uncaught": false, + "x": 160, + "y": 1260, "wires": [ [ "p2fmt_prs" ] - ], - "scope": null, - "uncaught": false, - "x": 160, - "y": 1260 + ] }, { "id": "p2fmt_prs", "type": "function", "z": "6dfa989bb120e6c6", "name": "Format error", - "wires": [ - [ - "p2ntfy_prs" - ] - ], "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: Home Presence',\n message: err + (src ? '\\n\\nNode: ' + src : '')\n});\nreturn msg;", "outputs": 1, + "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "timeout": "", "x": 400, - "y": 1260 + "y": 1260, + "wires": [ + [ + "p2ntfy_prs" + ] + ] }, { "id": "p2ntfy_prs", "type": "api-call-service", "z": "6dfa989bb120e6c6", "name": "Notify error", - "wires": [ - [] - ], "server": "657c7463.48e1e4", "version": 7, "debugenabled": false, @@ -23376,6 +23192,9 @@ "output_location": "", "output_location_type": "none", "x": 660, - "y": 1260 + "y": 1260, + "wires": [ + [] + ] } ] \ No newline at end of file