[ { "id": "bcb4426f5301b9f2", "type": "tab", "label": "K.Routine", "disabled": false, "info": "", "env": [] }, { "id": "ae92592138b2c924", "type": "group", "z": "bcb4426f5301b9f2", "name": "routine - cleanup", "style": { "label": true }, "nodes": [ "29b883f9654391c8", "67c721e1c392ce95" ], "x": 68, "y": 1513, "w": 974, "h": 614 }, { "id": "eefe7f96cf64784b", "type": "group", "z": "bcb4426f5301b9f2", "name": "routine - convert", "style": { "fill": "#777777", "fill-opacity": "0.05", "label": true }, "nodes": [ "1f31199c6478bed6", "4c2fd374879bcc62", "e9594aa2f7507ac5", "414cdce0186b98d1", "1efacea0cfc080e2" ], "x": 68, "y": 173, "w": 1074, "h": 1294 }, { "id": "a0496edd95de60f3", "type": "group", "z": "bcb4426f5301b9f2", "name": "catch error", "style": { "fill": "#ff0000", "fill-opacity": "0.05", "label": true, "stroke": "#ff0000" }, "nodes": [ "2623529da72f4fab", "b1fb932b0ddc8a02", "9be1a70bcb57bda6" ], "x": 534, "y": 19, "w": 422, "h": 82 }, { "id": "86745759c5123379", "type": "group", "z": "bcb4426f5301b9f2", "name": "routine - search", "style": { "fill": "#777777", "fill-opacity": "0.05", "label": true }, "nodes": [ "72f51982c4844cb9", "4014b042aee9da95", "3c8f18d59bc57893", "0c4ddf3cde7a1e48", "aadbfea0ba5c45ac", "6d6cb3547780038f" ], "x": 1188, "y": 173, "w": 2524, "h": 1214 }, { "id": "45b2c91cc17508eb", "type": "group", "z": "bcb4426f5301b9f2", "name": "routine -scene", "style": { "fill": "#777777", "fill-opacity": "0.05", "label": true }, "nodes": [ "045e623bc9372013", "3e3cab934a02705f", "64c6321bb60023c8", "25501926b0199872", "b34b57138cb1f0b8", "b69787e8c4f19d69", "f988b45c3d4a17ef", "9f00d3d0bf810df6", "307791bd329226f2", "9b5a799c5df750d4", "d806e40ba2ef7092", "e667a9372137a0e2" ], "x": 68, "y": 2173, "w": 2724, "h": 2594 }, { "id": "29b883f9654391c8", "type": "group", "z": "bcb4426f5301b9f2", "g": "ae92592138b2c924", "name": "cleanup measurement", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "7662aba4a1cc9dd0", "0e0adba49a29f70f", "b6d241198242a6e5", "71e189afd8659a2d", "f54479dc5f66620e", "ce0256824b38971d", "e5ceb5335c3b0d43", "577298e83998f6d7", "af147f11a3d4d652", "afcaa4289efc76f2", "73cc2886c2652521" ], "x": 94, "y": 1539, "w": 922, "h": 382 }, { "id": "1efacea0cfc080e2", "type": "group", "z": "bcb4426f5301b9f2", "g": "eefe7f96cf64784b", "name": "convert to dimmer (0-99)", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "5070cadd19aa3954", "d40b223a978b9a1e", "6f7e7a5d7ebd031d", "ba9d70c1045cb088", "e7ac1f9f3c8ae78c", "4f02d67d81a83e86", "99e1c9e8654a9f81", "191e6f3cf830909c", "5cc363dda9bce25f" ], "x": 94, "y": 1179, "w": 1022, "h": 262 }, { "id": "414cdce0186b98d1", "type": "group", "z": "bcb4426f5301b9f2", "g": "eefe7f96cf64784b", "name": "convert to percent", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "0414c3f0d95341ac", "b6f0d1b534279a98", "6ec40cadb83543dd", "d84b5b147f5fa7a4", "73a136cc319902eb", "bc396dcc308c42ee", "f9f49c8d382ee23d", "3086da9f511d035c", "9185658a21e14bc0" ], "x": 94, "y": 879, "w": 1022, "h": 262 }, { "id": "e9594aa2f7507ac5", "type": "group", "z": "bcb4426f5301b9f2", "g": "eefe7f96cf64784b", "name": "convert to number", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "c213314798c4a9be", "2e643b1746a93b44", "4b32e84f6c624568", "31b42964ff3deb4f", "c2532fc6bfffd154", "e112327c4a55aa35", "91841d3915124c8e", "3354f1abc3e1c2cb", "8218f7e7b47837c8" ], "x": 94, "y": 579, "w": 1022, "h": 262 }, { "id": "4c2fd374879bcc62", "type": "group", "z": "bcb4426f5301b9f2", "g": "eefe7f96cf64784b", "name": "convert payload to boolean", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "a72b20551a3b1f8c", "b75da43db9ea9e7e", "ef13c93a34fcab87", "45647475dad51f30", "825837a029db8ec5", "bd6f2717b2f30241", "73a1379dd26a21ce", "5727bb6deb67bb8e" ], "x": 94, "y": 316.5, "w": 1022, "h": 224.5 }, { "id": "1f31199c6478bed6", "type": "group", "z": "bcb4426f5301b9f2", "g": "eefe7f96cf64784b", "name": "convert minute from midnight to hour", "style": { "fill": "#92d04f", "fill-opacity": "0.05", "label": true, "stroke": "#92d04f" }, "nodes": [ "20617e4a877c8fc3", "2467c6c0b11061b2", "0385dd3208b83d41" ], "x": 94, "y": 199, "w": 402, "h": 82 }, { "id": "72f51982c4844cb9", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "get search", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "2e0a9a817ddbf587", "e37a5575a3f29d39", "76d1c023d5b35ff4", "c7a019355872d175", "2ca73eb7becd74fa", "67b1906b253417ba", "c818166ce482c9ea" ], "x": 1214, "y": 199, "w": 882, "h": 142 }, { "id": "4014b042aee9da95", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search temperature", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "ddd39f991efd9d31", "caa4b983330ad4e6", "3b472a6e4d9e2543", "32eced70dca88722", "f4db36e02df945e3" ], "x": 1214, "y": 619, "w": 832, "h": 142 }, { "id": "3c8f18d59bc57893", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search humidity", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "fe7aea286ecc9d35", "bef84cb5efd8c2ca", "49927aaaafcc60ec", "928c3fc0fa3c5d18", "cc102f3a82a49a8e" ], "x": 1214, "y": 799, "w": 812, "h": 142 }, { "id": "0c4ddf3cde7a1e48", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search luminosity", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "13fd23967c40a92e", "1efc470e05455106", "aa96d5f77fcf68e5", "a270d561b0b64cf1", "046bf60c40a4df98" ], "x": 1214, "y": 979, "w": 832, "h": 142 }, { "id": "aadbfea0ba5c45ac", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search motion", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "2056847a88301b2a", "c421ec88d5d06d7d", "fc6bb2e0b3eb77b2", "618d9c3f33eefa02", "e68d7c0f7721c679", "12b1109de2f09cfc", "a064a6c08fd2f40e", "6b4bc7764df41753", "6c18cec9a1d74489", "02373ad0b61f2a49", "719eb321350dc033", "0845a36d7c0aef49", "333d8ba06abef807", "276eb14e1448224d" ], "x": 1214, "y": 1159, "w": 2192, "h": 202 }, { "id": "045e623bc9372013", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "get routine", "style": { "stroke": "#92d04f", "fill-opacity": "0.05", "label": true, "fill": "#92d04f" }, "nodes": [ "e520201563045cb4", "a8f829fc8739cbb4", "c85ce3c75b98194c", "72d48a3deee90360", "e3a3ecfeaece1f56", "4d2bb338a00188bc", "88ccb4248f722c7c", "990a132bdc19ba61", "d23cdc7e80275f61" ], "x": 94, "y": 2199, "w": 962, "h": 142 }, { "id": "3e3cab934a02705f", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine mode", "style": { "fill-opacity": "0.05", "label": true, "fill": "#92d04f", "stroke": "#92d04f" }, "nodes": [ "786e0b4140b91eec", "62542a01ce24c466", "e3a35f2dd6b2effb", "662f3d7d7dc36aa5", "d6ab2dddb189d358", "2910033beb566769", "d443f248bce0dea7", "5c82e25e697c0d09", "c1a22098f4c6b607", "f01348b36d2a9638", "48d872c1b6b9f14e", "d23ac11c26d59e4c", "a69fbd6551e4fdc3", "caaebc71902e0463" ], "x": 94, "y": 2379, "w": 2092, "h": 262 }, { "id": "64c6321bb60023c8", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine motion", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "0ecfc7dac3dc83c0", "c5b20f0c23888919", "323c3fcbf4964c63", "4ce06c7bae7e516c", "410b8eabf0b0e224", "4062a49e5518576b", "7864c4a726691281", "47a324541ec2b6d3", "a161c5ca3d8a7cbd", "6e52a200ac67e354", "c46a31d677767693", "6d71d5859b10c11e" ], "x": 94, "y": 3459, "w": 2012, "h": 202 }, { "id": "25501926b0199872", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine retention", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "4a635ad2a4ed1736", "d0d24a8b117023f6", "52a33cee0e647f92", "6a0f0e71db157af3", "9b3093c5a5deb452", "b8b9d93908937f8c", "22152f0515ad69cc", "4d9991942988ca8c", "d063b27f8e80f37a", "4722e25f42aea056", "cae336906ea60890", "393ec8decef297e9", "4424ab4df00e08ab", "ffbd707de9b88a2a" ], "x": 94, "y": 3699, "w": 2432, "h": 202 }, { "id": "b34b57138cb1f0b8", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine darkness", "style": { "fill": "#92d04f", "fill-opacity": "0.05", "label": true, "stroke": "#92d04f" }, "nodes": [ "e4e85b184291d354", "868cdb733181338e", "eca9437aa8d37772", "e2dec83660823bf1", "71ecc4394b7cd05d", "61c2bd67b3234fc7", "466c44b0fc1258a7", "8ebbcb564e209cfe", "f7baae7f1933153b", "173b0a787256ad6e", "f4fc24ae76a91012", "3abf64e6a345da67" ], "x": 94, "y": 3939, "w": 2132, "h": 202 }, { "id": "b69787e8c4f19d69", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine luminosity", "style": { "fill": "#92d04f", "fill-opacity": "0.05", "label": true, "stroke": "#92d04f" }, "nodes": [ "cf26b829266bd04d", "ee16cba79f20cab6", "4adbb709556ae11d", "71518dbc12244577", "7fa7e12c70c95e89", "288d2e1448cc8b87", "a657a100c0565a83", "a39f08f65c396752", "72d6ed833a034f7d", "0ca5636806f3803d", "d4b36602686961b1", "89bf9e5c676a419c" ], "x": 94, "y": 4179, "w": 2142, "h": 202 }, { "id": "f988b45c3d4a17ef", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine value", "style": { "fill": "#92d04f", "fill-opacity": "0.05", "label": true, "stroke": "#92d04f" }, "nodes": [ "7faaa39c9c2c3e20", "5471122f3d914196", "9143e0b7b9fb3da2", "d8a3424e6a6f2827", "38e608120e43ab47", "b45278a6c6f45dfa", "121a9d42a981eb6b", "03700a180e6f8f5b", "9817b8c4d33159f8", "a91140dc661eacbf", "e1587fba40d7939d", "3543fc558bdce918", "621c0f611ba16957", "00f7d91e9a6c7617", "56ad085f1663d4c0", "a8bcb0395fa8accc", "0d08a03de0051e7c", "587236e6160da46c", "5a60da9d02342972", "fd900a26e130d2ff", "ba453f0ad70a75cc" ], "x": 94, "y": 2679, "w": 2672, "h": 382 }, { "id": "9f00d3d0bf810df6", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine timer", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "37f065b203f116d2", "04fda8ed412120ca", "cbe63d29435cb7ce", "bfe242eadca39791", "9dd47ae7d0e90c33", "7953d461e902f8ac", "834ce9850cdb0a72", "8a154930c7214f18", "23ef9aaffb31c21d", "fe78724dc1f72f65", "dfea66c91b07899f", "4a5ceb9b3c8f086f", "f71bea4c343fe0db", "952e936c8f1df120", "62c79bf2c5d8ec18", "f0d22091d2275f34", "87a3f60a0c03a21b", "5fbf2cbdb32f0e97", "68ca4fce9324436b", "ec1f489e4f505a2f" ], "x": 94, "y": 3099, "w": 1972, "h": 322 }, { "id": "307791bd329226f2", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine nocturnal", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "7017965f91bd177c", "56d6ee950d3d34c2", "eadfca81c8de4eb0", "dfec2e7efb555d4d", "ce2126235b863201", "e09b198994376110" ], "x": 94, "y": 4419, "w": 732, "h": 142 }, { "id": "9b5a799c5df750d4", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine daily", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "096892189e1be538", "ecec645c51268d24", "b51db40b65f89f75", "0edba4106bc26051", "c63c05889184c3bc", "e19c1916670880d7", "bde274663e77041e" ], "x": 94, "y": 4599, "w": 992, "h": 142 }, { "id": "67c721e1c392ce95", "type": "group", "z": "bcb4426f5301b9f2", "g": "ae92592138b2c924", "name": "cleanup - get short field", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "434f87c8d8fc6bbe", "c24f3d6f90d2b48c", "1063523382ddaa94", "4c8f3b4e9500ab16", "aeb0d3b6747c9280", "1b97b56ade9a8291" ], "x": 94, "y": 1959, "w": 662, "h": 142 }, { "id": "6d6cb3547780038f", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "get search field", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "63d576c59c72d487", "c8adad442791f18d", "0993151366888a6b", "887a9038d6639660", "57578e259ab0268c", "91e7dfc3c8108b06", "e43d2ea5180895eb", "2296b4ea298a4c72", "eabe1caabd0e57bb", "d6ae0dbd98f320d7", "0ec06f9bc9a77ac2", "a1b41356df668e41", "68788cf7b1f1d8b6", "ab77d6fa10f465f3", "8e60adca1a22f123", "0fe612fcfd28c570", "77270fac9cacc97f", "34e98bc055db6ee2" ], "x": 1214, "y": 379, "w": 2472, "h": 202 }, { "id": "afcaa4289efc76f2", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "range", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "-50", "vt": "num", "v2": "50", "v2t": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 690, "y": 1820, "wires": [ [ "73cc2886c2652521" ], [ "b6d241198242a6e5" ] ] }, { "id": "af147f11a3d4d652", "type": "change", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "round", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$round(msg.payload,1)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 530, "y": 1640, "wires": [ [ "577298e83998f6d7" ] ] }, { "id": "577298e83998f6d7", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "range", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "0", "vt": "num", "v2": "99", "v2t": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 690, "y": 1640, "wires": [ [ "73cc2886c2652521" ], [ "b6d241198242a6e5" ] ] }, { "id": "e5ceb5335c3b0d43", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "range", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "-20000", "vt": "num", "v2": "20000", "v2t": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 690, "y": 1760, "wires": [ [ "73cc2886c2652521" ], [ "b6d241198242a6e5" ] ] }, { "id": "ce0256824b38971d", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "range", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "0", "vt": "num", "v2": "20000", "v2t": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 690, "y": 1700, "wires": [ [ "73cc2886c2652521" ], [ "b6d241198242a6e5" ] ] }, { "id": "f54479dc5f66620e", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "range", "property": "payload", "propertyType": "msg", "rules": [ { "t": "btwn", "v": "-20", "vt": "num", "v2": "50", "v2t": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 690, "y": 1580, "wires": [ [ "73cc2886c2652521" ], [ "b6d241198242a6e5" ] ] }, { "id": "71e189afd8659a2d", "type": "change", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "round", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$round(msg.payload,1)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 530, "y": 1580, "wires": [ [ "f54479dc5f66620e" ] ] }, { "id": "b6d241198242a6e5", "type": "link out", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "cleanup measurement", "mode": "return", "links": [], "x": 975, "y": 1820, "wires": [] }, { "id": "0e0adba49a29f70f", "type": "switch", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "select measurement", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "eq", "v": "temperature", "vt": "str" }, { "t": "eq", "v": "humidity", "vt": "str" }, { "t": "eq", "v": "luminosity", "vt": "str" }, { "t": "eq", "v": "power", "vt": "str" }, { "t": "eq", "v": "current", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 6, "x": 320, "y": 1820, "wires": [ [ "71e189afd8659a2d" ], [ "af147f11a3d4d652" ], [ "ce0256824b38971d" ], [ "e5ceb5335c3b0d43" ], [ "afcaa4289efc76f2" ], [ "73cc2886c2652521" ] ] }, { "id": "7662aba4a1cc9dd0", "type": "link in", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "cleanup measurement", "links": [], "x": 135, "y": 1820, "wires": [ [ "0e0adba49a29f70f" ] ] }, { "id": "99e1c9e8654a9f81", "type": "link out", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert to dimmer", "mode": "return", "links": [], "x": 1075, "y": 1400, "wires": [] }, { "id": "4f02d67d81a83e86", "type": "link in", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert to dimmer", "links": [], "x": 135, "y": 1280, "wires": [ [ "5070cadd19aa3954" ] ] }, { "id": "e7ac1f9f3c8ae78c", "type": "change", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "0", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1340, "wires": [ [ "191e6f3cf830909c" ] ] }, { "id": "ba9d70c1045cb088", "type": "change", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "nb", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$number(msg.payload)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1280, "wires": [ [ "191e6f3cf830909c" ] ] }, { "id": "6f7e7a5d7ebd031d", "type": "change", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "99", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "99", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1220, "wires": [ [ "191e6f3cf830909c" ] ] }, { "id": "d40b223a978b9a1e", "type": "switch", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "format to dimmer", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gt", "v": "99", "vt": "str" }, { "t": "lt", "v": "0", "vt": "num" }, { "t": "istype", "v": "number", "vt": "number" }, { "t": "true" }, { "t": "false" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 6, "x": 590, "y": 1280, "wires": [ [ "6f7e7a5d7ebd031d" ], [ "e7ac1f9f3c8ae78c" ], [ "ba9d70c1045cb088" ], [ "6f7e7a5d7ebd031d" ], [ "e7ac1f9f3c8ae78c" ], [ "5cc363dda9bce25f" ] ] }, { "id": "5070cadd19aa3954", "type": "json", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 1280, "wires": [ [ "d40b223a978b9a1e" ] ] }, { "id": "f9f49c8d382ee23d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert to percent", "mode": "return", "links": [], "x": 1075, "y": 1100, "wires": [] }, { "id": "bc396dcc308c42ee", "type": "link in", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert to percent", "links": [], "x": 135, "y": 980, "wires": [ [ "0414c3f0d95341ac" ] ] }, { "id": "73a136cc319902eb", "type": "change", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "0", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1040, "wires": [ [ "9185658a21e14bc0" ] ] }, { "id": "d84b5b147f5fa7a4", "type": "change", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "nb", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$number(msg.payload)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 980, "wires": [ [ "9185658a21e14bc0" ] ] }, { "id": "6ec40cadb83543dd", "type": "change", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "100", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "100", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 920, "wires": [ [ "9185658a21e14bc0" ] ] }, { "id": "b6f0d1b534279a98", "type": "switch", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "format to percent", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gt", "v": "100", "vt": "str" }, { "t": "lt", "v": "0", "vt": "num" }, { "t": "istype", "v": "number", "vt": "number" }, { "t": "true" }, { "t": "false" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 6, "x": 590, "y": 980, "wires": [ [ "6ec40cadb83543dd" ], [ "73a136cc319902eb" ], [ "d84b5b147f5fa7a4" ], [ "6ec40cadb83543dd" ], [ "73a136cc319902eb" ], [ "3086da9f511d035c" ] ] }, { "id": "0414c3f0d95341ac", "type": "json", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 980, "wires": [ [ "b6f0d1b534279a98" ] ] }, { "id": "91841d3915124c8e", "type": "link out", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert to number", "mode": "return", "links": [], "x": 1075, "y": 740, "wires": [] }, { "id": "e112327c4a55aa35", "type": "link in", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert to number", "links": [], "x": 135, "y": 680, "wires": [ [ "c213314798c4a9be" ] ] }, { "id": "c2532fc6bfffd154", "type": "change", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "0", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 740, "wires": [ [ "8218f7e7b47837c8" ] ] }, { "id": "31b42964ff3deb4f", "type": "change", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "1", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 680, "wires": [ [ "8218f7e7b47837c8" ] ] }, { "id": "4b32e84f6c624568", "type": "change", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "nb", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$number(msg.payload)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 620, "wires": [ [ "8218f7e7b47837c8" ] ] }, { "id": "2e643b1746a93b44", "type": "switch", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "format to number", "property": "payload", "propertyType": "msg", "rules": [ { "t": "istype", "v": "number", "vt": "number" }, { "t": "true" }, { "t": "false" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 4, "x": 590, "y": 680, "wires": [ [ "4b32e84f6c624568" ], [ "31b42964ff3deb4f" ], [ "c2532fc6bfffd154" ], [ "3354f1abc3e1c2cb" ] ] }, { "id": "c213314798c4a9be", "type": "json", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 680, "wires": [ [ "2e643b1746a93b44" ] ] }, { "id": "bd6f2717b2f30241", "type": "link out", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert to boolean", "mode": "return", "links": [], "x": 1075, "y": 500, "wires": [] }, { "id": "825837a029db8ec5", "type": "change", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "true", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 440, "wires": [ [ "5727bb6deb67bb8e" ] ] }, { "id": "45647475dad51f30", "type": "change", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "false", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 380, "wires": [ [ "5727bb6deb67bb8e" ] ] }, { "id": "ef13c93a34fcab87", "type": "switch", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "format to boolean", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lte", "v": "0", "vt": "num" }, { "t": "gt", "v": "0", "vt": "num" }, { "t": "false" }, { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 5, "x": 590, "y": 380, "wires": [ [ "45647475dad51f30" ], [ "825837a029db8ec5" ], [ "45647475dad51f30" ], [ "825837a029db8ec5" ], [ "73a1379dd26a21ce" ] ] }, { "id": "b75da43db9ea9e7e", "type": "json", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 310, "y": 380, "wires": [ [ "ef13c93a34fcab87" ] ] }, { "id": "a72b20551a3b1f8c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert to boolean", "links": [], "x": 135, "y": 380, "wires": [ [ "b75da43db9ea9e7e" ] ] }, { "id": "0385dd3208b83d41", "type": "function", "z": "bcb4426f5301b9f2", "g": "1f31199c6478bed6", "name": "minute to HH:mm", "func": "var d = Number(msg.payload);\nvar h = Math.floor(d / 60);\nvar m = Math.floor(d % 60);\nif (h < 10) { h = h < 5 ? '00' : '0' + h; }\nif (m < 10) { m = m < 5 ? '00' : '0' + m; }\nmsg.payload = h + ':' + m;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 290, "y": 240, "wires": [ [ "2467c6c0b11061b2" ] ] }, { "id": "2467c6c0b11061b2", "type": "link out", "z": "bcb4426f5301b9f2", "g": "1f31199c6478bed6", "name": "minute to HH:mm", "mode": "return", "links": [], "x": 455, "y": 240, "wires": [] }, { "id": "20617e4a877c8fc3", "type": "link in", "z": "bcb4426f5301b9f2", "g": "1f31199c6478bed6", "name": "minute to HH:mm", "links": [], "x": 135, "y": 240, "wires": [ [ "0385dd3208b83d41" ] ] }, { "id": "2623529da72f4fab", "type": "catch", "z": "bcb4426f5301b9f2", "g": "a0496edd95de60f3", "name": "catch error", "scope": null, "uncaught": false, "x": 620, "y": 60, "wires": [ [ "b1fb932b0ddc8a02" ] ] }, { "id": "2e0a9a817ddbf587", "type": "link in", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "get search", "links": [], "x": 1255, "y": 300, "wires": [ [ "76d1c023d5b35ff4" ] ] }, { "id": "e37a5575a3f29d39", "type": "link out", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "get search", "mode": "return", "links": [], "x": 2055, "y": 300, "wires": [] }, { "id": "76d1c023d5b35ff4", "type": "delay", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "100 ms", "pauseType": "delay", "timeout": "100", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1400, "y": 300, "wires": [ [ "c7a019355872d175" ] ] }, { "id": "c7a019355872d175", "type": "switch", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "check bucket", "property": "scene", "propertyType": "msg", "rules": [ { "t": "hask", "v": "bucket", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1590, "y": 300, "wires": [ [ "2ca73eb7becd74fa" ], [ "c818166ce482c9ea" ] ] }, { "id": "2ca73eb7becd74fa", "type": "switch", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "exists", "property": "metrics[msg.scene.bucket]", "propertyType": "global", "rules": [ { "t": "hask", "v": "measurement", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1770, "y": 240, "wires": [ [ "67b1906b253417ba" ], [ "c818166ce482c9ea" ] ] }, { "id": "67b1906b253417ba", "type": "change", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" }, { "t": "set", "p": "measurement", "pt": "msg", "to": "metrics[msg.scene.bucket][msg.measurement]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1930, "y": 240, "wires": [ [ "e37a5575a3f29d39" ] ] }, { "id": "c818166ce482c9ea", "type": "change", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1930, "y": 300, "wires": [ [ "e37a5575a3f29d39" ] ] }, { "id": "ddd39f991efd9d31", "type": "link in", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "search temperature", "links": [], "x": 1255, "y": 720, "wires": [ [ "f4db36e02df945e3" ] ] }, { "id": "caa4b983330ad4e6", "type": "link out", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "search temperature", "mode": "return", "links": [], "x": 1835, "y": 720, "wires": [] }, { "id": "3b472a6e4d9e2543", "type": "debug", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "search temperature", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1910, "y": 660, "wires": [] }, { "id": "32eced70dca88722", "type": "link call", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "", "links": [ "63d576c59c72d487" ], "linkType": "static", "timeout": "30", "x": 1680, "y": 720, "wires": [ [ "caa4b983330ad4e6", "3b472a6e4d9e2543" ] ] }, { "id": "f4db36e02df945e3", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "temperature", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[\t 'cmv',\t 'left bay',\t 'right bay',\t 'detector',\t 'door',\t 'air conditioner',\t 'sensor',\t 'probe'\t ]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1440, "y": 720, "wires": [ [ "32eced70dca88722" ] ] }, { "id": "fe7aea286ecc9d35", "type": "link out", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "search humidity", "mode": "return", "links": [], "x": 1835, "y": 900, "wires": [] }, { "id": "bef84cb5efd8c2ca", "type": "debug", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "search humidity", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1900, "y": 840, "wires": [] }, { "id": "49927aaaafcc60ec", "type": "link in", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "search humidity", "links": [], "x": 1255, "y": 900, "wires": [ [ "928c3fc0fa3c5d18" ] ] }, { "id": "928c3fc0fa3c5d18", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "humidity", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[\t 'detector',\t 'sensor',\t 'probe'\t ]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1440, "y": 900, "wires": [ [ "cc102f3a82a49a8e" ] ] }, { "id": "cc102f3a82a49a8e", "type": "link call", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "", "links": [ "63d576c59c72d487" ], "linkType": "static", "timeout": "30", "x": 1680, "y": 900, "wires": [ [ "fe7aea286ecc9d35", "bef84cb5efd8c2ca" ] ] }, { "id": "13fd23967c40a92e", "type": "link out", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "search luminosity", "mode": "return", "links": [], "x": 1835, "y": 1080, "wires": [] }, { "id": "1efc470e05455106", "type": "debug", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "search luminosity", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1910, "y": 1020, "wires": [] }, { "id": "aa96d5f77fcf68e5", "type": "link in", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "search luminosity", "links": [], "x": 1255, "y": 1080, "wires": [ [ "a270d561b0b64cf1" ] ] }, { "id": "2056847a88301b2a", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "measurement", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement", "tot": "msg" }, { "t": "set", "p": "final_payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2040, "y": 1260, "wires": [ [ "a064a6c08fd2f40e" ] ] }, { "id": "c421ec88d5d06d7d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "search motion", "mode": "return", "links": [], "x": 3215, "y": 1320, "wires": [] }, { "id": "fc6bb2e0b3eb77b2", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3090, "y": 1320, "wires": [ [ "e68d7c0f7721c679" ] ] }, { "id": "618d9c3f33eefa02", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "final_payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3090, "y": 1260, "wires": [ [ "e68d7c0f7721c679", "c421ec88d5d06d7d" ] ] }, { "id": "e68d7c0f7721c679", "type": "debug", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "search motion", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 3280, "y": 1260, "wires": [] }, { "id": "12b1109de2f09cfc", "type": "link in", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "search motion", "links": [], "x": 1255, "y": 1320, "wires": [ [ "0845a36d7c0aef49" ] ] }, { "id": "a064a6c08fd2f40e", "type": "split", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 2230, "y": 1260, "wires": [ [ "719eb321350dc033" ] ] }, { "id": "6b4bc7764df41753", "type": "join", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 2930, "y": 1260, "wires": [ [ "618d9c3f33eefa02" ] ] }, { "id": "6c18cec9a1d74489", "type": "switch", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "exists", "property": "motion", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 2590, "y": 1260, "wires": [ [ "02373ad0b61f2a49" ], [ "6b4bc7764df41753" ] ] }, { "id": "02373ad0b61f2a49", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "set activ", "rules": [ { "t": "set", "p": "final_payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2760, "y": 1200, "wires": [ [ "6b4bc7764df41753" ] ] }, { "id": "719eb321350dc033", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "from global", "rules": [ { "t": "set", "p": "motion", "pt": "msg", "to": "metrics[msg.scene.bucket]['motion'][msg.field]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2410, "y": 1260, "wires": [ [ "6c18cec9a1d74489" ] ] }, { "id": "0845a36d7c0aef49", "type": "change", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "motion", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1440, "y": 1320, "wires": [ [ "333d8ba06abef807" ] ] }, { "id": "333d8ba06abef807", "type": "link call", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 1670, "y": 1320, "wires": [ [ "276eb14e1448224d" ] ] }, { "id": "276eb14e1448224d", "type": "switch", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "rsp", "property": "search.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1850, "y": 1320, "wires": [ [ "2056847a88301b2a" ], [ "fc6bb2e0b3eb77b2" ] ] }, { "id": "e520201563045cb4", "type": "link in", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "get routine", "links": [], "x": 135, "y": 2300, "wires": [ [ "990a132bdc19ba61" ] ] }, { "id": "a8f829fc8739cbb4", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "from global metrics", "rules": [ { "t": "set", "p": "routine", "pt": "msg", "to": "metrics[msg.scene.bucket][msg.scene.type]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 2300, "wires": [ [ "c85ce3c75b98194c" ] ] }, { "id": "c85ce3c75b98194c", "type": "switch", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "exists", "property": "routine", "propertyType": "msg", "rules": [ { "t": "istype", "v": "object", "vt": "object" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 730, "y": 2300, "wires": [ [ "4d2bb338a00188bc" ], [ "72d48a3deee90360" ] ] }, { "id": "72d48a3deee90360", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "rsp -1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 2300, "wires": [ [ "e3a3ecfeaece1f56" ] ] }, { "id": "e3a3ecfeaece1f56", "type": "link out", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "get routine", "mode": "return", "links": [], "x": 1015, "y": 2240, "wires": [] }, { "id": "4d2bb338a00188bc", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 2240, "wires": [ [ "e3a3ecfeaece1f56" ] ] }, { "id": "88ccb4248f722c7c", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" }, { "t": "set", "p": "routine.actif", "pt": "msg", "to": "msg.routine.actif?true:false", "tot": "jsonata" }, { "t": "set", "p": "routine.mouvement", "pt": "msg", "to": "msg.routine.mouvement?true:false", "tot": "jsonata" }, { "t": "set", "p": "routine.nocturne", "pt": "msg", "to": "msg.routine.nocturne?true:false", "tot": "jsonata" }, { "t": "set", "p": "routine.maintient", "pt": "msg", "to": "msg.routine.maintient?true:false", "tot": "jsonata" }, { "t": "set", "p": "routine.minuterie", "pt": "msg", "to": "msg.routine.minuterie?$number(msg.routine.minuterie):15", "tot": "jsonata" }, { "t": "set", "p": "routine.faible", "pt": "msg", "to": "msg.routine.faible?$number(msg.routine.faible):4", "tot": "jsonata" }, { "t": "set", "p": "routine.fort", "pt": "msg", "to": "msg.routine.fort?$number(msg.routine.fort):40", "tot": "jsonata" }, { "t": "set", "p": "routine.obscurite", "pt": "msg", "to": "msg.routine.obscurite?$number(msg.routine.obscurite):0", "tot": "jsonata" }, { "t": "set", "p": "routine.payload", "pt": "msg", "to": "metrics[msg.scene.bucket][msg.scene.measurement][msg.scene.field]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 730, "y": 2240, "wires": [ [] ] }, { "id": "786e0b4140b91eec", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "mode automate", "property": "metrics.system.mode.automate", "propertyType": "global", "rules": [ { "t": "eq", "v": "automatic", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1060, "y": 2480, "wires": [ [ "62542a01ce24c466" ], [ "d443f248bce0dea7" ] ] }, { "id": "62542a01ce24c466", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "mode type exists", "property": "metrics.system.mode", "propertyType": "global", "rules": [ { "t": "hask", "v": "scene.type", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1290, "y": 2420, "wires": [ [ "e3a35f2dd6b2effb" ], [ "d6ab2dddb189d358" ] ] }, { "id": "e3a35f2dd6b2effb", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "mode type not off", "property": "metrics.system.mode[msg.scene.type]", "propertyType": "global", "rules": [ { "t": "neq", "v": "off", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1530, "y": 2480, "wires": [ [ "d6ab2dddb189d358" ], [ "d443f248bce0dea7" ] ] }, { "id": "662f3d7d7dc36aa5", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "mode master", "property": "metrics.system.mode.master", "propertyType": "global", "rules": [ { "t": "eq", "v": "about.automate", "vt": "global" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 830, "y": 2540, "wires": [ [ "786e0b4140b91eec" ], [ "d443f248bce0dea7" ] ] }, { "id": "d6ab2dddb189d358", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "actif", "property": "routine.actif", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1730, "y": 2420, "wires": [ [ "2910033beb566769" ], [ "d443f248bce0dea7" ] ] }, { "id": "2910033beb566769", "type": "change", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1890, "y": 2480, "wires": [ [ "5c82e25e697c0d09", "f01348b36d2a9638" ] ] }, { "id": "d443f248bce0dea7", "type": "change", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "rsp -1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1890, "y": 2540, "wires": [ [ "5c82e25e697c0d09", "f01348b36d2a9638" ] ] }, { "id": "5c82e25e697c0d09", "type": "debug", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "routine mode", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2070, "y": 2540, "wires": [] }, { "id": "c1a22098f4c6b607", "type": "link in", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "routine mode", "links": [], "x": 135, "y": 2600, "wires": [ [ "caaebc71902e0463" ] ] }, { "id": "f01348b36d2a9638", "type": "link out", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "routine mode", "mode": "return", "links": [], "x": 2015, "y": 2600, "wires": [] }, { "id": "48d872c1b6b9f14e", "type": "link call", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "", "links": [ "e520201563045cb4" ], "linkType": "static", "timeout": "30", "x": 470, "y": 2600, "wires": [ [ "d23ac11c26d59e4c" ] ] }, { "id": "d23ac11c26d59e4c", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "rsp", "property": "routine.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 650, "y": 2600, "wires": [ [ "662f3d7d7dc36aa5" ], [ "a69fbd6551e4fdc3" ] ] }, { "id": "a69fbd6551e4fdc3", "type": "change", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "rsp 0", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1890, "y": 2600, "wires": [ [ "5c82e25e697c0d09", "f01348b36d2a9638" ] ] }, { "id": "caaebc71902e0463", "type": "delay", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "150 ms", "pauseType": "delay", "timeout": "150", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 280, "y": 2600, "wires": [ [ "48d872c1b6b9f14e" ] ] }, { "id": "0ecfc7dac3dc83c0", "type": "link out", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "routine motion", "mode": "return", "links": [], "x": 1915, "y": 3620, "wires": [] }, { "id": "c5b20f0c23888919", "type": "switch", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "motion actif", "property": "routine.motion", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 290, "y": 3560, "wires": [ [ "323c3fcbf4964c63" ], [ "c46a31d677767693" ] ] }, { "id": "323c3fcbf4964c63", "type": "switch", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "has measurement", "property": "metrics[msg.scene.bucket]", "propertyType": "global", "rules": [ { "t": "hask", "v": "motion", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 510, "y": 3500, "wires": [ [ "4062a49e5518576b" ], [ "c46a31d677767693" ] ] }, { "id": "4ce06c7bae7e516c", "type": "change", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1370, "y": 3500, "wires": [ [ "410b8eabf0b0e224" ] ] }, { "id": "410b8eabf0b0e224", "type": "join", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": "false", "timeout": "", "count": "", "reduceRight": false, "x": 1530, "y": 3560, "wires": [ [ "a161c5ca3d8a7cbd" ] ] }, { "id": "4062a49e5518576b", "type": "change", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "find all motion sensor", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.scene.bucket]motion", "tot": "global", "dc": true }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 760, "y": 3500, "wires": [ [ "7864c4a726691281" ] ] }, { "id": "7864c4a726691281", "type": "split", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "split measurement", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "property": "payload", "x": 1010, "y": 3560, "wires": [ [ "47a324541ec2b6d3" ] ] }, { "id": "47a324541ec2b6d3", "type": "switch", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "true", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1210, "y": 3560, "wires": [ [ "4ce06c7bae7e516c" ], [ "410b8eabf0b0e224" ] ] }, { "id": "a161c5ca3d8a7cbd", "type": "change", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "regain initial payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "delete", "p": "old_payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1740, "y": 3620, "wires": [ [ "0ecfc7dac3dc83c0", "6e52a200ac67e354" ] ] }, { "id": "6e52a200ac67e354", "type": "debug", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "routine motion", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1980, "y": 3560, "wires": [] }, { "id": "c46a31d677767693", "type": "change", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "rsp 0", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 710, "y": 3620, "wires": [ [ "a161c5ca3d8a7cbd" ] ] }, { "id": "6d71d5859b10c11e", "type": "link in", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "routine motion", "links": [], "x": 135, "y": 3560, "wires": [ [ "c5b20f0c23888919" ] ] }, { "id": "4a635ad2a4ed1736", "type": "switch", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "retention actif", "property": "routine.retention", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 300, "y": 3800, "wires": [ [ "d0d24a8b117023f6" ], [ "4722e25f42aea056" ] ] }, { "id": "d0d24a8b117023f6", "type": "switch", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "has measurement", "property": "metrics[msg.scene.bucket]", "propertyType": "global", "rules": [ { "t": "hask", "v": "retention", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 530, "y": 3740, "wires": [ [ "ffbd707de9b88a2a" ], [ "4722e25f42aea056" ] ] }, { "id": "52a33cee0e647f92", "type": "change", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1790, "y": 3740, "wires": [ [ "6a0f0e71db157af3" ] ] }, { "id": "6a0f0e71db157af3", "type": "join", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": "false", "timeout": "", "count": "", "reduceRight": false, "x": 1950, "y": 3800, "wires": [ [ "4d9991942988ca8c" ] ] }, { "id": "9b3093c5a5deb452", "type": "change", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "find all motion sensor", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.scene.bucket]motion", "tot": "global", "dc": true } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1140, "y": 3740, "wires": [ [ "b8b9d93908937f8c" ] ] }, { "id": "b8b9d93908937f8c", "type": "split", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "split measurement", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "property": "payload", "x": 1430, "y": 3740, "wires": [ [ "22152f0515ad69cc" ] ] }, { "id": "22152f0515ad69cc", "type": "switch", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "true", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1630, "y": 3800, "wires": [ [ "52a33cee0e647f92" ], [ "6a0f0e71db157af3" ] ] }, { "id": "4d9991942988ca8c", "type": "change", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "regain initial payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "delete", "p": "old_payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2160, "y": 3860, "wires": [ [ "d063b27f8e80f37a", "393ec8decef297e9" ] ] }, { "id": "d063b27f8e80f37a", "type": "debug", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "routine retention", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2400, "y": 3800, "wires": [] }, { "id": "4722e25f42aea056", "type": "change", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "rsp 0", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 730, "y": 3860, "wires": [ [ "4d9991942988ca8c" ] ] }, { "id": "cae336906ea60890", "type": "link in", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "routine retention", "links": [], "x": 135, "y": 3800, "wires": [ [ "4a635ad2a4ed1736" ] ] }, { "id": "393ec8decef297e9", "type": "link out", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "routine retention", "mode": "return", "links": [], "x": 2335, "y": 3860, "wires": [] }, { "id": "4424ab4df00e08ab", "type": "switch", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "not off", "property": "scene.off", "propertyType": "msg", "rules": [ { "t": "neq", "v": "metrics[msg.scene.bucket][msg.scene.measurement][msg.scene.field]", "vt": "global" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 890, "y": 3800, "wires": [ [ "9b3093c5a5deb452" ], [ "4d9991942988ca8c" ] ] }, { "id": "ffbd707de9b88a2a", "type": "change", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "rsp -1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 730, "y": 3740, "wires": [ [ "4424ab4df00e08ab" ] ] }, { "id": "e4e85b184291d354", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "darkness actif", "property": "routine.darkness", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 300, "y": 4040, "wires": [ [ "868cdb733181338e" ], [ "f4fc24ae76a91012" ] ] }, { "id": "868cdb733181338e", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "has measurement", "property": "metrics[msg.scene.bucket]", "propertyType": "global", "rules": [ { "t": "hask", "v": "luminosity", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 530, "y": 3980, "wires": [ [ "eca9437aa8d37772" ], [ "f4fc24ae76a91012" ] ] }, { "id": "eca9437aa8d37772", "type": "change", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "find all luminosity sensor", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.scene.bucket]luminosity", "tot": "global" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 3980, "wires": [ [ "e2dec83660823bf1" ] ] }, { "id": "e2dec83660823bf1", "type": "split", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "split measurement", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "property": "payload", "x": 1050, "y": 4040, "wires": [ [ "71ecc4394b7cd05d" ] ] }, { "id": "71ecc4394b7cd05d", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "field <= reglage", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lte", "v": "routine.darkness", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1280, "y": 4040, "wires": [ [ "8ebbcb564e209cfe" ], [ "61c2bd67b3234fc7" ] ] }, { "id": "61c2bd67b3234fc7", "type": "join", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "num", "reduceFixup": "", "x": 1630, "y": 4040, "wires": [ [ "f7baae7f1933153b" ] ] }, { "id": "466c44b0fc1258a7", "type": "link out", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "routine darkness", "mode": "return", "links": [], "x": 2015, "y": 4100, "wires": [] }, { "id": "8ebbcb564e209cfe", "type": "change", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1470, "y": 3980, "wires": [ [ "61c2bd67b3234fc7" ] ] }, { "id": "f7baae7f1933153b", "type": "change", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "regain initial payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "delete", "p": "old_payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1840, "y": 4100, "wires": [ [ "466c44b0fc1258a7", "173b0a787256ad6e" ] ] }, { "id": "173b0a787256ad6e", "type": "debug", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "routine darkness", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2090, "y": 4040, "wires": [] }, { "id": "f4fc24ae76a91012", "type": "change", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "rsp 0", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 730, "y": 4100, "wires": [ [ "f7baae7f1933153b" ] ] }, { "id": "3abf64e6a345da67", "type": "link in", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "routine darkness", "links": [], "x": 135, "y": 4040, "wires": [ [ "e4e85b184291d354" ] ] }, { "id": "cf26b829266bd04d", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "luminosity actif", "property": "routine.luminosity", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 310, "y": 4280, "wires": [ [ "ee16cba79f20cab6" ], [ "d4b36602686961b1" ] ] }, { "id": "ee16cba79f20cab6", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "has measurement", "property": "metrics[msg.scene.bucket]", "propertyType": "global", "rules": [ { "t": "hask", "v": "luminosity", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 540, "y": 4220, "wires": [ [ "4adbb709556ae11d" ], [ "d4b36602686961b1" ] ] }, { "id": "4adbb709556ae11d", "type": "change", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "find all luminosity sensor", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.scene.bucket]luminosity", "tot": "global" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 800, "y": 4220, "wires": [ [ "71518dbc12244577" ] ] }, { "id": "71518dbc12244577", "type": "split", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "split measurement", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "property": "payload", "x": 1060, "y": 4280, "wires": [ [ "7fa7e12c70c95e89" ] ] }, { "id": "7fa7e12c70c95e89", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "field >= reglage", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gte", "v": "routine.luminosity", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1290, "y": 4280, "wires": [ [ "a39f08f65c396752" ], [ "288d2e1448cc8b87" ] ] }, { "id": "288d2e1448cc8b87", "type": "join", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": "", "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "num", "reduceFixup": "", "x": 1640, "y": 4280, "wires": [ [ "72d6ed833a034f7d" ] ] }, { "id": "a657a100c0565a83", "type": "link out", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "routine luminosity", "mode": "return", "links": [], "x": 2025, "y": 4340, "wires": [] }, { "id": "a39f08f65c396752", "type": "change", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1480, "y": 4220, "wires": [ [ "288d2e1448cc8b87" ] ] }, { "id": "72d6ed833a034f7d", "type": "change", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "reagin initial payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "delete", "p": "old_payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1850, "y": 4340, "wires": [ [ "a657a100c0565a83", "0ca5636806f3803d" ] ] }, { "id": "0ca5636806f3803d", "type": "debug", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "routine luminosity", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2100, "y": 4280, "wires": [] }, { "id": "d4b36602686961b1", "type": "change", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "rsp 0", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 740, "y": 4340, "wires": [ [ "72d6ed833a034f7d" ] ] }, { "id": "89bf9e5c676a419c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "routine luminosity", "links": [], "x": 135, "y": 4280, "wires": [ [ "cf26b829266bd04d" ] ] }, { "id": "7faaa39c9c2c3e20", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "reglage", "property": "metrics.system.mode[msg.scene.type]", "propertyType": "global", "rules": [ { "t": "eq", "v": "high", "vt": "str" }, { "t": "eq", "v": "low", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1780, "y": 2780, "wires": [ [ "5471122f3d914196" ], [ "9143e0b7b9fb3da2" ] ] }, { "id": "5471122f3d914196", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "high", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "msg.routine.high?msg.routine.high:40", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1950, "y": 2780, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "9143e0b7b9fb3da2", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "low", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "msg.routine.low?msg.routine.low:4", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1950, "y": 2840, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "d8a3424e6a6f2827", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "compare payload to existing value", "property": "payload", "propertyType": "msg", "rules": [ { "t": "neq", "v": "metrics[msg.scene.bucket][msg.scene.measurement][msg.scene.field]", "vt": "global" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 2220, "y": 2900, "wires": [ [ "00f7d91e9a6c7617" ], [ "56ad085f1663d4c0" ] ] }, { "id": "38e608120e43ab47", "type": "link out", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine luminosite", "mode": "return", "links": [], "x": 2595, "y": 3020, "wires": [] }, { "id": "b45278a6c6f45dfa", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "state", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1350, "y": 2780, "wires": [ [ "121a9d42a981eb6b" ], [ "a8bcb0395fa8accc" ] ] }, { "id": "121a9d42a981eb6b", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "scene off", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "scene.off", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1960, "y": 2720, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "03700a180e6f8f5b", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "format", "property": "scene.format", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dimmer", "vt": "str" }, { "t": "eq", "v": "number", "vt": "str" }, { "t": "eq", "v": "boolean", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 4, "x": 950, "y": 2960, "wires": [ [ "a91140dc661eacbf" ], [ "a91140dc661eacbf" ], [ "9817b8c4d33159f8" ], [ "fd900a26e130d2ff", "5a60da9d02342972" ] ] }, { "id": "9817b8c4d33159f8", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "booelan", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$boolean($number(msg.payload))", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1960, "y": 2960, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "a91140dc661eacbf", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "payload to number", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "$number(msg.payload)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1150, "y": 2780, "wires": [ [ "b45278a6c6f45dfa" ] ] }, { "id": "e1587fba40d7939d", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "set payload as existing value", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.scene.bucket][msg.scene.measurement][msg.scene.field]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 720, "y": 2840, "wires": [ [ "03700a180e6f8f5b" ] ] }, { "id": "3543fc558bdce918", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "system bucket", "property": "bucket", "propertyType": "msg", "rules": [ { "t": "eq", "v": "system", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 300, "y": 2960, "wires": [ [ "ba453f0ad70a75cc" ], [ "03700a180e6f8f5b" ] ] }, { "id": "621c0f611ba16957", "type": "debug", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine value", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2650, "y": 2960, "wires": [] }, { "id": "00f7d91e9a6c7617", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2470, "y": 2900, "wires": [ [ "38e608120e43ab47", "621c0f611ba16957" ] ] }, { "id": "56ad085f1663d4c0", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "rsp -1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2470, "y": 2960, "wires": [ [ "621c0f611ba16957", "38e608120e43ab47" ] ] }, { "id": "a8bcb0395fa8accc", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "has dimmer reglage", "property": "scene.format", "propertyType": "msg", "rules": [ { "t": "eq", "v": "dimmer", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1560, "y": 2840, "wires": [ [ "7faaa39c9c2c3e20" ], [ "0d08a03de0051e7c" ] ] }, { "id": "0d08a03de0051e7c", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "scene on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "scene.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1960, "y": 2900, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "587236e6160da46c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine value", "links": [], "x": 135, "y": 2960, "wires": [ [ "3543fc558bdce918" ] ] }, { "id": "5a60da9d02342972", "type": "change", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "rsp 0", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2470, "y": 3020, "wires": [ [ "38e608120e43ab47", "621c0f611ba16957" ] ] }, { "id": "fd900a26e130d2ff", "type": "debug", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine value - unknown format", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1190, "y": 3020, "wires": [] }, { "id": "37f065b203f116d2", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer", "mode": "return", "links": [], "x": 1895, "y": 3380, "wires": [] }, { "id": "04fda8ed412120ca", "type": "delay", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "5 s", "pauseType": "delay", "timeout": "5", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 450, "y": 3320, "wires": [ [ "bfe242eadca39791" ] ] }, { "id": "cbe63d29435cb7ce", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "timer actif", "property": "routine.timer", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 280, "y": 3380, "wires": [ [ "04fda8ed412120ca", "8a154930c7214f18" ], [ "8a154930c7214f18" ] ] }, { "id": "bfe242eadca39791", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "existing value is not like scene off", "property": "metrics[msg.scene.bucket][msg.scene.measurement][msg.scene.field]", "propertyType": "global", "rules": [ { "t": "neq", "v": "scene.off", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 700, "y": 3320, "wires": [ [ "fe78724dc1f72f65" ], [ "7953d461e902f8ac" ] ] }, { "id": "9dd47ae7d0e90c33", "type": "debug", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1950, "y": 3320, "wires": [] }, { "id": "7953d461e902f8ac", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "rsp -1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "-1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1770, "y": 3320, "wires": [ [ "9dd47ae7d0e90c33", "37f065b203f116d2", "23ef9aaffb31c21d" ] ] }, { "id": "834ce9850cdb0a72", "type": "link in", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer", "links": [], "x": 135, "y": 3380, "wires": [ [ "cbe63d29435cb7ce" ] ] }, { "id": "8a154930c7214f18", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "rsp 0", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1770, "y": 3380, "wires": [ [ "37f065b203f116d2", "23ef9aaffb31c21d" ] ] }, { "id": "23ef9aaffb31c21d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer out", "mode": "link", "links": [ "96f83c7e2e8a15cc", "3cc31621bae4b8f4" ], "x": 1895, "y": 3200, "wires": [] }, { "id": "7017965f91bd177c", "type": "switch", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "nocturnal actif", "property": "routine.nocturnal", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 300, "y": 4520, "wires": [ [ "ce2126235b863201" ], [ "e09b198994376110" ] ] }, { "id": "56d6ee950d3d34c2", "type": "link out", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine nocturnal", "mode": "return", "links": [], "x": 615, "y": 4520, "wires": [] }, { "id": "eadfca81c8de4eb0", "type": "debug", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine nocturnal", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 690, "y": 4460, "wires": [] }, { "id": "dfec2e7efb555d4d", "type": "link in", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine nocturnal", "links": [], "x": 135, "y": 4520, "wires": [ [ "7017965f91bd177c" ] ] }, { "id": "ce2126235b863201", "type": "change", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "rsp", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "metrics.system.mode.nycthemer", "tot": "global" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "msg.routine.response='night'?1:-1", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 490, "y": 4460, "wires": [ [ "eadfca81c8de4eb0", "56d6ee950d3d34c2" ] ] }, { "id": "e09b198994376110", "type": "change", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "rsp 0", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 490, "y": 4520, "wires": [ [ "56d6ee950d3d34c2", "eadfca81c8de4eb0" ] ] }, { "id": "096892189e1be538", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "routine daily", "mode": "return", "links": [], "x": 635, "y": 4700, "wires": [] }, { "id": "ecec645c51268d24", "type": "change", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "rsp 0", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 4700, "wires": [ [ "096892189e1be538", "0edba4106bc26051" ] ] }, { "id": "b51db40b65f89f75", "type": "change", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "rsp", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "msg.routine.daily?-1:1", "tot": "jsonata" }, { "t": "set", "p": "scene.update_daily", "pt": "msg", "to": "msg.routine.response=1", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 4640, "wires": [ [ "096892189e1be538", "0edba4106bc26051" ] ] }, { "id": "0edba4106bc26051", "type": "debug", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "routine daily", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 690, "y": 4640, "wires": [] }, { "id": "c63c05889184c3bc", "type": "link in", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "routine daily", "links": [], "x": 135, "y": 4640, "wires": [ [ "bde274663e77041e" ] ] }, { "id": "e19c1916670880d7", "type": "comment", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "rsp : 1 if done, -1 if not done, 0 if not present", "info": "", "x": 890, "y": 4700, "wires": [] }, { "id": "d806e40ba2ef7092", "type": "comment", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "return msg.routine.response : 1 = active and valid, 0 = not active, -1 active and not valid", "info": "", "x": 1480, "y": 2240, "wires": [] }, { "id": "e667a9372137a0e2", "type": "comment", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "scene must call \"routine mode\" first", "info": "", "x": 1320, "y": 2300, "wires": [] }, { "id": "b1fb932b0ddc8a02", "type": "change", "z": "bcb4426f5301b9f2", "g": "a0496edd95de60f3", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "routine", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 60, "wires": [ [ "9be1a70bcb57bda6" ] ] }, { "id": "9be1a70bcb57bda6", "type": "link out", "z": "bcb4426f5301b9f2", "g": "a0496edd95de60f3", "name": "catch error", "mode": "link", "links": [ "a52f0e788cd4dca3" ], "x": 915, "y": 60, "wires": [] }, { "id": "dfea66c91b07899f", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "timer from routine", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "scene.off", "tot": "msg" }, { "t": "set", "p": "timer", "pt": "msg", "to": "{\t 'path':msg.scene.type & '/' & msg.scene.bucket & '/' & msg.scene.measurement & '/' & msg.scene.field,\t 'time':$millis() + (msg.routine.timer * 60000)\t}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1370, "y": 3200, "wires": [ [ "4a5ceb9b3c8f086f" ] ] }, { "id": "fe78724dc1f72f65", "type": "delay", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "rate 10 msg / s", "pauseType": "rate", "timeout": "5", "timeoutUnits": "seconds", "rate": "10", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 980, "y": 3260, "wires": [ [ "ec1f489e4f505a2f" ] ] }, { "id": "4a5ceb9b3c8f086f", "type": "function", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "copy msg", "func": "// script var\nvar msg = msg;\nvar newmsg = {};\n\nif (typeof msg === 'undefined'){\n return null;\n}\n\n// recreate msg\nnewmsg = {\n 'payload': msg\n};\n\nnode.status({ fill: 'green', shape: \"ring\", text: msg.timer.path });\nreturn newmsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "\n", "finalize": "\n", "libs": [], "x": 1580, "y": 3200, "wires": [ [ "f71bea4c343fe0db" ] ] }, { "id": "f71bea4c343fe0db", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "to global", "rules": [ { "t": "set", "p": "timers[msg.payload.timer.path]", "pt": "global", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1760, "y": 3200, "wires": [ [ "23ef9aaffb31c21d" ] ] }, { "id": "62c79bf2c5d8ec18", "type": "link in", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer cron", "links": [ "004bb30c27c94fb4" ], "x": 855, "y": 3140, "wires": [ [ "f0d22091d2275f34" ] ] }, { "id": "f0d22091d2275f34", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "from global", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "timers", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1010, "y": 3140, "wires": [ [ "87a3f60a0c03a21b" ] ] }, { "id": "87a3f60a0c03a21b", "type": "split", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 1190, "y": 3140, "wires": [ [ "5fbf2cbdb32f0e97" ] ] }, { "id": "5fbf2cbdb32f0e97", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "check expired timer", "property": "payload.timer.time", "propertyType": "msg", "rules": [ { "t": "lt", "v": "$millis()", "vt": "jsonata" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1390, "y": 3140, "wires": [ [ "68ca4fce9324436b" ] ] }, { "id": "68ca4fce9324436b", "type": "function", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "copy msg", "func": "// script var\nvar msg = msg;\nvar newmsg = {};\n\nif (typeof msg === 'undefined'){\n return null;\n}\n\n// recreate msg\nnewmsg = msg.payload;\n\nnode.status({ fill: 'green', shape: \"ring\", text: msg.payload.timer.path });\nreturn newmsg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "\n", "finalize": "\n", "libs": [], "x": 1600, "y": 3140, "wires": [ [ "952e936c8f1df120" ] ] }, { "id": "952e936c8f1df120", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "rsp 1", "rules": [ { "t": "delete", "p": "timers[msg.timer.path]", "pt": "global" }, { "t": "delete", "p": "parts", "pt": "msg" }, { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1770, "y": 3140, "wires": [ [ "23ef9aaffb31c21d", "9dd47ae7d0e90c33", "37f065b203f116d2" ] ] }, { "id": "ec1f489e4f505a2f", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "bucket", "property": "bucket", "propertyType": "msg", "rules": [ { "t": "neq", "v": "system", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1170, "y": 3260, "wires": [ [ "dfea66c91b07899f" ], [ "7953d461e902f8ac" ] ] }, { "id": "434f87c8d8fc6bbe", "type": "change", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "split", "rules": [ { "t": "set", "p": "split_field", "pt": "msg", "to": "$reverse($split(msg.field,' '))", "tot": "jsonata" }, { "t": "set", "p": "end_field", "pt": "msg", "to": "false", "tot": "bool" }, { "t": "set", "p": "end_field", "pt": "msg", "to": "$match(msg.split_field[0],/[0-9]+/)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 270, "y": 2000, "wires": [ [ "c24f3d6f90d2b48c" ] ] }, { "id": "c24f3d6f90d2b48c", "type": "switch", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "check", "property": "end_field", "propertyType": "msg", "rules": [ { "t": "nempty" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 430, "y": 2000, "wires": [ [ "1063523382ddaa94" ], [ "4c8f3b4e9500ab16" ] ] }, { "id": "1063523382ddaa94", "type": "change", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "end", "rules": [ { "t": "set", "p": "end_field", "pt": "msg", "to": "' '&msg.end_field.match", "tot": "jsonata" }, { "t": "set", "p": "short_field", "pt": "msg", "to": "$substringBefore(msg.field,msg.end_field)", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 2000, "wires": [ [ "1b97b56ade9a8291" ] ] }, { "id": "4c8f3b4e9500ab16", "type": "change", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "end", "rules": [ { "t": "set", "p": "end_field", "pt": "msg", "to": "", "tot": "str" }, { "t": "set", "p": "short_field", "pt": "msg", "to": "field", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 2060, "wires": [ [ "1b97b56ade9a8291" ] ] }, { "id": "aeb0d3b6747c9280", "type": "link in", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "cleanup - get short field", "links": [], "x": 135, "y": 2000, "wires": [ [ "434f87c8d8fc6bbe" ] ] }, { "id": "1b97b56ade9a8291", "type": "link out", "z": "bcb4426f5301b9f2", "g": "67c721e1c392ce95", "name": "cleanup - get short field", "mode": "return", "links": [], "x": 715, "y": 2000, "wires": [] }, { "id": "63d576c59c72d487", "type": "link in", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "get search field", "links": [], "x": 1255, "y": 540, "wires": [ [ "91e7dfc3c8108b06" ] ] }, { "id": "c8adad442791f18d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "get search field", "mode": "return", "links": [], "x": 3495, "y": 540, "wires": [] }, { "id": "0993151366888a6b", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3370, "y": 540, "wires": [ [ "57578e259ab0268c", "c8adad442791f18d" ] ] }, { "id": "887a9038d6639660", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "exists", "tot": "msg" }, { "t": "delete", "p": "exists", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3370, "y": 480, "wires": [ [ "57578e259ab0268c", "c8adad442791f18d" ] ] }, { "id": "57578e259ab0268c", "type": "debug", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "get search field", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 3560, "y": 480, "wires": [] }, { "id": "91e7dfc3c8108b06", "type": "link call", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 1410, "y": 540, "wires": [ [ "e43d2ea5180895eb" ] ] }, { "id": "e43d2ea5180895eb", "type": "switch", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "rsp", "property": "search.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1590, "y": 540, "wires": [ [ "ab77d6fa10f465f3" ], [ "0993151366888a6b" ] ] }, { "id": "2296b4ea298a4c72", "type": "comment", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "select field by preference order", "info": "", "x": 1510, "y": 480, "wires": [] }, { "id": "eabe1caabd0e57bb", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "suffix", "rules": [ { "t": "set", "p": "field", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[' 5',' 4',' 3',' 2',' 1','']", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2070, "y": 480, "wires": [ [ "d6ae0dbd98f320d7" ] ] }, { "id": "d6ae0dbd98f320d7", "type": "split", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 2230, "y": 480, "wires": [ [ "68788cf7b1f1d8b6" ] ] }, { "id": "0ec06f9bc9a77ac2", "type": "switch", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "has field", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "hask", "v": "field", "vt": "msg" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 2560, "y": 480, "wires": [ [ "a1b41356df668e41" ], [ "0fe612fcfd28c570" ] ] }, { "id": "a1b41356df668e41", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "exists", "rules": [ { "t": "set", "p": "exists", "pt": "msg", "to": "measurement[msg.field]", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2730, "y": 420, "wires": [ [ "0fe612fcfd28c570" ] ] }, { "id": "68788cf7b1f1d8b6", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "field", "rules": [ { "t": "set", "p": "field", "pt": "msg", "to": "msg.field&msg.payload", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2390, "y": 480, "wires": [ [ "0ec06f9bc9a77ac2" ] ] }, { "id": "ab77d6fa10f465f3", "type": "change", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "fields", "rules": [ { "t": "delete", "p": "exists", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1750, "y": 480, "wires": [ [ "8e60adca1a22f123" ] ] }, { "id": "8e60adca1a22f123", "type": "split", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 1910, "y": 480, "wires": [ [ "eabe1caabd0e57bb" ] ] }, { "id": "0fe612fcfd28c570", "type": "join", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": "false", "timeout": "", "count": "", "reduceRight": false, "x": 2890, "y": 480, "wires": [ [ "77270fac9cacc97f" ] ] }, { "id": "77270fac9cacc97f", "type": "join", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "", "mode": "auto", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": "false", "timeout": "", "count": "", "reduceRight": false, "x": 3050, "y": 480, "wires": [ [ "34e98bc055db6ee2" ] ] }, { "id": "34e98bc055db6ee2", "type": "switch", "z": "bcb4426f5301b9f2", "g": "6d6cb3547780038f", "name": "exists", "property": "exists", "propertyType": "msg", "rules": [ { "t": "istype", "v": "number", "vt": "number" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 3210, "y": 480, "wires": [ [ "887a9038d6639660" ], [ "0993151366888a6b" ] ] }, { "id": "a270d561b0b64cf1", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "luminosity", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "[\t 'detector',\t 'sensor',\t 'probe'\t ]", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1440, "y": 1080, "wires": [ [ "046bf60c40a4df98" ] ] }, { "id": "046bf60c40a4df98", "type": "link call", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "", "links": [ "63d576c59c72d487" ], "linkType": "static", "timeout": "30", "x": 1680, "y": 1080, "wires": [ [ "13fd23967c40a92e", "1efc470e05455106" ] ] }, { "id": "990a132bdc19ba61", "type": "switch", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "scene auto", "property": "scene.path", "propertyType": "msg", "rules": [ { "t": "istype", "v": "string", "vt": "string" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 290, "y": 2300, "wires": [ [ "d23cdc7e80275f61" ], [ "a8f829fc8739cbb4" ] ] }, { "id": "d23cdc7e80275f61", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "from global scenes", "rules": [ { "t": "set", "p": "routine", "pt": "msg", "to": "scenes[msg.scene.type][msg.scene.path]", "tot": "global" }, { "t": "set", "p": "scene.type", "pt": "msg", "to": "routine.type", "tot": "msg" }, { "t": "set", "p": "scene.format", "pt": "msg", "to": "routine.format", "tot": "msg" }, { "t": "set", "p": "scene.on", "pt": "msg", "to": "routine.on", "tot": "msg" }, { "t": "set", "p": "scene.off", "pt": "msg", "to": "routine.off", "tot": "msg" }, { "t": "set", "p": "tmp", "pt": "msg", "to": "$split(msg.routine.path,'/')", "tot": "jsonata" }, { "t": "set", "p": "scene.bucket", "pt": "msg", "to": "tmp[0]", "tot": "msg" }, { "t": "set", "p": "scene.measurement", "pt": "msg", "to": "tmp[1]", "tot": "msg" }, { "t": "set", "p": "scene.field", "pt": "msg", "to": "tmp[2]", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 510, "y": 2240, "wires": [ [ "c85ce3c75b98194c" ] ] }, { "id": "bde274663e77041e", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "scene has daily key", "property": "scenes[msg.scene.type][msg.scene.path]", "propertyType": "global", "rules": [ { "t": "hask", "v": "daily", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 310, "y": 4640, "wires": [ [ "b51db40b65f89f75" ], [ "ecec645c51268d24" ] ] }, { "id": "73cc2886c2652521", "type": "change", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1880, "wires": [ [ "b6d241198242a6e5" ] ] }, { "id": "191e6f3cf830909c", "type": "change", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 1340, "wires": [ [ "99e1c9e8654a9f81" ] ] }, { "id": "5cc363dda9bce25f", "type": "change", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1400, "wires": [ [ "99e1c9e8654a9f81" ] ] }, { "id": "3086da9f511d035c", "type": "change", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 1100, "wires": [ [ "f9f49c8d382ee23d" ] ] }, { "id": "9185658a21e14bc0", "type": "change", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 1040, "wires": [ [ "f9f49c8d382ee23d" ] ] }, { "id": "3354f1abc3e1c2cb", "type": "change", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 800, "wires": [ [ "8218f7e7b47837c8" ] ] }, { "id": "8218f7e7b47837c8", "type": "change", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 740, "wires": [ [ "91841d3915124c8e" ] ] }, { "id": "73a1379dd26a21ce", "type": "change", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 500, "wires": [ [ "bd6f2717b2f30241" ] ] }, { "id": "5727bb6deb67bb8e", "type": "change", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "rsp", "rules": [ { "t": "set", "p": "response", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 440, "wires": [ [ "bd6f2717b2f30241" ] ] }, { "id": "ba453f0ad70a75cc", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "field", "property": "field", "propertyType": "msg", "rules": [ { "t": "neq", "v": "nycthemer", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 490, "y": 2900, "wires": [ [ "e1587fba40d7939d" ], [ "03700a180e6f8f5b" ] ] } ]