[ { "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" ], "x": 68, "y": 1253, "w": 1064, "h": 434 }, { "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": 914, "h": 1034 }, { "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" ], "x": 68, "y": 1733, "w": 2244, "h": 1574 }, { "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": 3353, "w": 2604, "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", "6a5bccc5dc98def6", "ce0256824b38971d", "e5ceb5335c3b0d43", "577298e83998f6d7", "af147f11a3d4d652", "afcaa4289efc76f2" ], "x": 94, "y": 1279, "w": 1012, "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" ], "x": 94, "y": 979, "w": 862, "h": 202 }, { "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" ], "x": 94, "y": 739, "w": 862, "h": 202 }, { "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" ], "x": 94, "y": 499, "w": 862, "h": 202 }, { "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" ], "x": 94, "y": 304, "w": 862, "h": 157 }, { "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": 94, "y": 1759, "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", "05c9b85a23efbccc", "fd82a7784afa6f4a", "ef90ce5768d66b55", "95a6c692d6ecaad8", "caa4b983330ad4e6", "6082f1de36935071", "cfb9a97db2d82096", "3b472a6e4d9e2543", "4001a1d34ab2ef95", "32eced70dca88722", "f4db36e02df945e3", "c0f921b709110e17", "c4cf4dd2f0bcbec8", "acbe74d8b6fde42c", "e7aa2f657391f94a", "98e7ea281617b342" ], "x": 94, "y": 1939, "w": 1512, "h": 502 }, { "id": "3c8f18d59bc57893", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search humidity", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "813c2880aaaad0c7", "934cfb1692390b27", "6ddb281f50d850d9", "5089fe68c49d4d99", "fe7aea286ecc9d35", "4dbef5cc267442d3", "c170fd80b6a5f6f2", "bef84cb5efd8c2ca", "49927aaaafcc60ec", "928c3fc0fa3c5d18", "cc102f3a82a49a8e", "e8e85fb225317e53", "af339e4a7646bf50" ], "x": 94, "y": 2479, "w": 1492, "h": 262 }, { "id": "0c4ddf3cde7a1e48", "type": "group", "z": "bcb4426f5301b9f2", "g": "86745759c5123379", "name": "search luminosity", "style": { "fill": "#92d04f", "fill-opacity": "0.1", "label": true, "stroke": "#92d04f" }, "nodes": [ "110233fb067271ea", "c62663d1c462b0e5", "c2b96b7cbbd08748", "80574552b8ba0d39", "13fd23967c40a92e", "2d639fb6848e28d7", "2b830fa657ca6d98", "1efc470e05455106", "aa96d5f77fcf68e5", "4507643d8c985d72", "e02edcf844fea90c", "ee411219c4f7a44b", "29d4eb12e680548a" ], "x": 94, "y": 2779, "w": 1512, "h": 262 }, { "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": 94, "y": 3079, "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" ], "x": 94, "y": 3379, "w": 702, "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", "09bfbc7cb6a01b25", "551ef31b794502a7", "2910033beb566769", "d443f248bce0dea7", "5c82e25e697c0d09", "c1a22098f4c6b607", "f01348b36d2a9638", "48d872c1b6b9f14e", "d23ac11c26d59e4c", "a69fbd6551e4fdc3", "caaebc71902e0463" ], "x": 94, "y": 3559, "w": 2552, "h": 382 }, { "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": 3979, "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": 4219, "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": 4459, "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": 4699, "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" ], "x": 94, "y": 4939, "w": 2512, "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": [ "d7babb57491ff7a8", "7bfba4bb76a09e45", "37f065b203f116d2", "04fda8ed412120ca", "cbe63d29435cb7ce", "bfe242eadca39791", "9dd47ae7d0e90c33", "7953d461e902f8ac", "364bfd0f8218efb1", "834ce9850cdb0a72", "8a154930c7214f18", "23ef9aaffb31c21d" ], "x": 94, "y": 5359, "w": 1572, "h": 202 }, { "id": "307791bd329226f2", "type": "group", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "routine night", "style": { "stroke": "#92d04f", "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "7017965f91bd177c", "56d6ee950d3d34c2", "eadfca81c8de4eb0", "dfec2e7efb555d4d", "ce2126235b863201", "e09b198994376110" ], "x": 94, "y": 5599, "w": 652, "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": [ "5cf04b3c11f23176", "096892189e1be538", "ecec645c51268d24", "b51db40b65f89f75", "0edba4106bc26051", "c63c05889184c3bc", "e19c1916670880d7" ], "x": 94, "y": 5779, "w": 952, "h": 142 }, { "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": 1560, "wires": [ [ "b6d241198242a6e5" ], [ "6a5bccc5dc98def6" ] ] }, { "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": 1380, "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": 1380, "wires": [ [ "b6d241198242a6e5" ], [ "6a5bccc5dc98def6" ] ] }, { "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": 1500, "wires": [ [ "b6d241198242a6e5" ], [ "6a5bccc5dc98def6" ] ] }, { "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": 1440, "wires": [ [ "b6d241198242a6e5" ], [ "6a5bccc5dc98def6" ] ] }, { "id": "6a5bccc5dc98def6", "type": "debug", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "cleanup measurement - invalid", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 930, "y": 1320, "wires": [] }, { "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": 1320, "wires": [ [ "b6d241198242a6e5" ], [ "6a5bccc5dc98def6" ] ] }, { "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": 1320, "wires": [ [ "f54479dc5f66620e" ] ] }, { "id": "b6d241198242a6e5", "type": "link out", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "cleanup measurement", "mode": "return", "links": [], "x": 815, "y": 1620, "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": 1560, "wires": [ [ "71e189afd8659a2d" ], [ "af147f11a3d4d652" ], [ "ce0256824b38971d" ], [ "e5ceb5335c3b0d43" ], [ "afcaa4289efc76f2" ], [ "b6d241198242a6e5" ] ] }, { "id": "7662aba4a1cc9dd0", "type": "link in", "z": "bcb4426f5301b9f2", "g": "29b883f9654391c8", "name": "cleanup measurement", "links": [], "x": 135, "y": 1560, "wires": [ [ "0e0adba49a29f70f" ] ] }, { "id": "99e1c9e8654a9f81", "type": "link out", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert to dimmer", "mode": "return", "links": [], "x": 915, "y": 1080, "wires": [] }, { "id": "4f02d67d81a83e86", "type": "link in", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert to dimmer", "links": [], "x": 135, "y": 1080, "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": 1140, "wires": [ [ "99e1c9e8654a9f81" ] ] }, { "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": 1080, "wires": [ [ "99e1c9e8654a9f81" ] ] }, { "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": 1020, "wires": [ [ "99e1c9e8654a9f81" ] ] }, { "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" } ], "checkall": "false", "repair": false, "outputs": 5, "x": 590, "y": 1080, "wires": [ [ "6f7e7a5d7ebd031d" ], [ "e7ac1f9f3c8ae78c" ], [ "ba9d70c1045cb088" ], [ "6f7e7a5d7ebd031d" ], [ "e7ac1f9f3c8ae78c" ] ] }, { "id": "5070cadd19aa3954", "type": "json", "z": "bcb4426f5301b9f2", "g": "1efacea0cfc080e2", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 1080, "wires": [ [ "d40b223a978b9a1e" ] ] }, { "id": "f9f49c8d382ee23d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert to percent", "mode": "return", "links": [], "x": 915, "y": 840, "wires": [] }, { "id": "bc396dcc308c42ee", "type": "link in", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert to percent", "links": [], "x": 135, "y": 840, "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": 900, "wires": [ [ "f9f49c8d382ee23d" ] ] }, { "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": 840, "wires": [ [ "f9f49c8d382ee23d" ] ] }, { "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": 780, "wires": [ [ "f9f49c8d382ee23d" ] ] }, { "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" } ], "checkall": "false", "repair": false, "outputs": 5, "x": 590, "y": 840, "wires": [ [ "6ec40cadb83543dd" ], [ "73a136cc319902eb" ], [ "d84b5b147f5fa7a4" ], [ "6ec40cadb83543dd" ], [ "73a136cc319902eb" ] ] }, { "id": "0414c3f0d95341ac", "type": "json", "z": "bcb4426f5301b9f2", "g": "414cdce0186b98d1", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 840, "wires": [ [ "b6f0d1b534279a98" ] ] }, { "id": "91841d3915124c8e", "type": "link out", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert to number", "mode": "return", "links": [], "x": 915, "y": 600, "wires": [] }, { "id": "e112327c4a55aa35", "type": "link in", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert to number", "links": [], "x": 135, "y": 600, "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": 660, "wires": [ [ "91841d3915124c8e" ] ] }, { "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": 600, "wires": [ [ "91841d3915124c8e" ] ] }, { "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": 540, "wires": [ [ "91841d3915124c8e" ] ] }, { "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" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 590, "y": 600, "wires": [ [ "4b32e84f6c624568" ], [ "31b42964ff3deb4f" ], [ "c2532fc6bfffd154" ] ] }, { "id": "c213314798c4a9be", "type": "json", "z": "bcb4426f5301b9f2", "g": "e9594aa2f7507ac5", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 330, "y": 600, "wires": [ [ "2e643b1746a93b44" ] ] }, { "id": "bd6f2717b2f30241", "type": "link out", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert to boolean", "mode": "return", "links": [], "x": 915, "y": 420, "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": 420, "wires": [ [ "bd6f2717b2f30241" ] ] }, { "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": 360, "wires": [ [ "bd6f2717b2f30241" ] ] }, { "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" } ], "checkall": "false", "repair": false, "outputs": 4, "x": 590, "y": 360, "wires": [ [ "45647475dad51f30" ], [ "825837a029db8ec5" ], [ "45647475dad51f30" ], [ "825837a029db8ec5" ] ] }, { "id": "b75da43db9ea9e7e", "type": "json", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert payload to json", "property": "payload", "action": "obj", "pretty": false, "x": 310, "y": 360, "wires": [ [ "ef13c93a34fcab87" ] ] }, { "id": "a72b20551a3b1f8c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "4c2fd374879bcc62", "name": "convert to boolean", "links": [], "x": 135, "y": 360, "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": 135, "y": 1860, "wires": [ [ "76d1c023d5b35ff4" ] ] }, { "id": "e37a5575a3f29d39", "type": "link out", "z": "bcb4426f5301b9f2", "g": "72f51982c4844cb9", "name": "get search", "mode": "return", "links": [], "x": 935, "y": 1860, "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": 280, "y": 1860, "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": 470, "y": 1860, "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": 650, "y": 1800, "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": 810, "y": 1800, "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": 810, "y": 1860, "wires": [ [ "e37a5575a3f29d39" ] ] }, { "id": "ddd39f991efd9d31", "type": "link in", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "search temperature", "links": [], "x": 135, "y": 2400, "wires": [ [ "f4db36e02df945e3" ] ] }, { "id": "05c9b85a23efbccc", "type": "switch", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "select field", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "hask", "v": "probe", "vt": "str" }, { "t": "hask", "v": "sensor", "vt": "str" }, { "t": "hask", "v": "air conditioner", "vt": "str" }, { "t": "hask", "v": "door", "vt": "str" }, { "t": "hask", "v": "detector", "vt": "str" }, { "t": "hask", "v": "left bay", "vt": "str" }, { "t": "hask", "v": "right bay", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 8, "x": 910, "y": 2340, "wires": [ [ "fd82a7784afa6f4a" ], [ "ef90ce5768d66b55" ], [ "98e7ea281617b342" ], [ "95a6c692d6ecaad8" ], [ "4001a1d34ab2ef95" ], [ "c4cf4dd2f0bcbec8" ], [ "acbe74d8b6fde42c" ], [ "6082f1de36935071" ] ] }, { "id": "fd82a7784afa6f4a", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "probe", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.probe", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 1980, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "ef90ce5768d66b55", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "sensor", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.sensor", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2040, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "95a6c692d6ecaad8", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "door", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.door", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2160, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "caa4b983330ad4e6", "type": "link out", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "search temperature", "mode": "return", "links": [], "x": 1395, "y": 2400, "wires": [] }, { "id": "6082f1de36935071", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 2400, "wires": [ [ "3b472a6e4d9e2543", "caa4b983330ad4e6" ] ] }, { "id": "cfb9a97db2d82096", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 2340, "wires": [ [ "3b472a6e4d9e2543", "caa4b983330ad4e6" ] ] }, { "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": 1470, "y": 2340, "wires": [] }, { "id": "4001a1d34ab2ef95", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "detector", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.detector", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2220, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "32eced70dca88722", "type": "link call", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 570, "y": 2400, "wires": [ [ "c0f921b709110e17" ] ] }, { "id": "f4db36e02df945e3", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "temperature", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 2400, "wires": [ [ "32eced70dca88722" ] ] }, { "id": "c0f921b709110e17", "type": "switch", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "rsp", "property": "search.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 730, "y": 2400, "wires": [ [ "05c9b85a23efbccc" ], [ "6082f1de36935071" ] ] }, { "id": "c4cf4dd2f0bcbec8", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "left bay", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement['left bay']", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2280, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "acbe74d8b6fde42c", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "right bay", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement['right bay']", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2340, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "e7aa2f657391f94a", "type": "comment", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "select field by preference order", "info": "", "x": 650, "y": 2340, "wires": [] }, { "id": "98e7ea281617b342", "type": "change", "z": "bcb4426f5301b9f2", "g": "4014b042aee9da95", "name": "ac", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement['air conditioner']", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2100, "wires": [ [ "cfb9a97db2d82096" ] ] }, { "id": "813c2880aaaad0c7", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "select field", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "hask", "v": "probe", "vt": "str" }, { "t": "hask", "v": "sensor", "vt": "str" }, { "t": "hask", "v": "detector", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 4, "x": 910, "y": 2640, "wires": [ [ "934cfb1692390b27" ], [ "6ddb281f50d850d9" ], [ "5089fe68c49d4d99" ], [ "4dbef5cc267442d3" ] ] }, { "id": "934cfb1692390b27", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "probe", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.probe", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2520, "wires": [ [ "c170fd80b6a5f6f2" ] ] }, { "id": "6ddb281f50d850d9", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "sensor", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.sensor", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2580, "wires": [ [ "c170fd80b6a5f6f2" ] ] }, { "id": "5089fe68c49d4d99", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "detector", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.detector", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2640, "wires": [ [ "c170fd80b6a5f6f2" ] ] }, { "id": "fe7aea286ecc9d35", "type": "link out", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "search humidity", "mode": "return", "links": [], "x": 1395, "y": 2700, "wires": [] }, { "id": "4dbef5cc267442d3", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 2700, "wires": [ [ "bef84cb5efd8c2ca" ] ] }, { "id": "c170fd80b6a5f6f2", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 2640, "wires": [ [ "bef84cb5efd8c2ca", "fe7aea286ecc9d35" ] ] }, { "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": 1460, "y": 2640, "wires": [] }, { "id": "49927aaaafcc60ec", "type": "link in", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "search humidity", "links": [], "x": 135, "y": 2700, "wires": [ [ "928c3fc0fa3c5d18" ] ] }, { "id": "928c3fc0fa3c5d18", "type": "change", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "humidity", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 2700, "wires": [ [ "cc102f3a82a49a8e" ] ] }, { "id": "cc102f3a82a49a8e", "type": "link call", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 570, "y": 2700, "wires": [ [ "e8e85fb225317e53" ] ] }, { "id": "e8e85fb225317e53", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "rsp", "property": "search.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 730, "y": 2700, "wires": [ [ "813c2880aaaad0c7" ], [ "4dbef5cc267442d3" ] ] }, { "id": "af339e4a7646bf50", "type": "comment", "z": "bcb4426f5301b9f2", "g": "3c8f18d59bc57893", "name": "select field by preference order", "info": "", "x": 650, "y": 2640, "wires": [] }, { "id": "110233fb067271ea", "type": "switch", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "select field", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "hask", "v": "probe", "vt": "str" }, { "t": "hask", "v": "sensor", "vt": "str" }, { "t": "hask", "v": "detector", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 4, "x": 910, "y": 2940, "wires": [ [ "c62663d1c462b0e5" ], [ "c2b96b7cbbd08748" ], [ "80574552b8ba0d39" ], [ "2d639fb6848e28d7" ] ] }, { "id": "c62663d1c462b0e5", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "probe", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.probe", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2820, "wires": [ [ "2b830fa657ca6d98" ] ] }, { "id": "c2b96b7cbbd08748", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "sensor", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.sensor", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1090, "y": 2880, "wires": [ [ "2b830fa657ca6d98" ] ] }, { "id": "80574552b8ba0d39", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "detector", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "measurement.detector", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 2940, "wires": [ [ "2b830fa657ca6d98" ] ] }, { "id": "13fd23967c40a92e", "type": "link out", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "search luminosity", "mode": "return", "links": [], "x": 1395, "y": 3000, "wires": [] }, { "id": "2d639fb6848e28d7", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "rsp -1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':-1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 3000, "wires": [ [ "1efc470e05455106" ] ] }, { "id": "2b830fa657ca6d98", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "rsp 1", "rules": [ { "t": "set", "p": "search", "pt": "msg", "to": "{'response':1}", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1270, "y": 2940, "wires": [ [ "1efc470e05455106", "13fd23967c40a92e" ] ] }, { "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": 1470, "y": 2940, "wires": [] }, { "id": "aa96d5f77fcf68e5", "type": "link in", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "search luminosity", "links": [], "x": 135, "y": 3000, "wires": [ [ "4507643d8c985d72" ] ] }, { "id": "4507643d8c985d72", "type": "change", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "check measurement", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "luminosity", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 320, "y": 3000, "wires": [ [ "e02edcf844fea90c" ] ] }, { "id": "e02edcf844fea90c", "type": "link call", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 570, "y": 3000, "wires": [ [ "ee411219c4f7a44b" ] ] }, { "id": "ee411219c4f7a44b", "type": "switch", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "rsp", "property": "search.response", "propertyType": "msg", "rules": [ { "t": "eq", "v": "1", "vt": "num" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 730, "y": 3000, "wires": [ [ "110233fb067271ea" ], [ "2d639fb6848e28d7" ] ] }, { "id": "29d4eb12e680548a", "type": "comment", "z": "bcb4426f5301b9f2", "g": "0c4ddf3cde7a1e48", "name": "select field by preference order", "info": "", "x": 650, "y": 2940, "wires": [] }, { "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": 920, "y": 3180, "wires": [ [ "a064a6c08fd2f40e" ] ] }, { "id": "c421ec88d5d06d7d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "search motion", "mode": "return", "links": [], "x": 2095, "y": 3240, "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": 1970, "y": 3240, "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": 1970, "y": 3180, "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": 2160, "y": 3180, "wires": [] }, { "id": "12b1109de2f09cfc", "type": "link in", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "search motion", "links": [], "x": 135, "y": 3240, "wires": [ [ "0845a36d7c0aef49" ] ] }, { "id": "a064a6c08fd2f40e", "type": "split", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1110, "y": 3180, "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": 1810, "y": 3180, "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": 1470, "y": 3180, "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": 1640, "y": 3120, "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": 1290, "y": 3180, "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": 320, "y": 3240, "wires": [ [ "333d8ba06abef807" ] ] }, { "id": "333d8ba06abef807", "type": "link call", "z": "bcb4426f5301b9f2", "g": "aadbfea0ba5c45ac", "name": "", "links": [ "2e0a9a817ddbf587" ], "linkType": "static", "timeout": "30", "x": 570, "y": 3240, "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": 730, "y": 3240, "wires": [ [ "2056847a88301b2a" ], [ "fc6bb2e0b3eb77b2" ] ] }, { "id": "e520201563045cb4", "type": "link in", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "get routine", "links": [], "x": 135, "y": 3480, "wires": [ [ "a8f829fc8739cbb4" ] ] }, { "id": "a8f829fc8739cbb4", "type": "change", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "from global", "rules": [ { "t": "set", "p": "routine", "pt": "msg", "to": "metrics[msg.scene.bucket][msg.scene.type]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 290, "y": 3480, "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": 470, "y": 3480, "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": 630, "y": 3480, "wires": [ [ "e3a3ecfeaece1f56" ] ] }, { "id": "e3a3ecfeaece1f56", "type": "link out", "z": "bcb4426f5301b9f2", "g": "045e623bc9372013", "name": "get routine", "mode": "return", "links": [], "x": 755, "y": 3420, "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": 630, "y": 3420, "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.obscurtie", "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": 470, "y": 3420, "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": 3780, "wires": [ [ "09bfbc7cb6a01b25" ], [ "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": 1510, "y": 3660, "wires": [ [ "e3a35f2dd6b2effb" ], [ "551ef31b794502a7" ] ] }, { "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": 1750, "y": 3600, "wires": [ [ "551ef31b794502a7" ], [ "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": 3840, "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": 2190, "y": 3720, "wires": [ [ "2910033beb566769" ], [ "d443f248bce0dea7" ] ] }, { "id": "09bfbc7cb6a01b25", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "system bucket", "property": "scene.bucket", "propertyType": "msg", "rules": [ { "t": "neq", "v": "system", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1280, "y": 3720, "wires": [ [ "62542a01ce24c466" ], [ "551ef31b794502a7" ] ] }, { "id": "551ef31b794502a7", "type": "switch", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "system bucket", "property": "scene.bucket", "propertyType": "msg", "rules": [ { "t": "neq", "v": "system", "vt": "str" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 2000, "y": 3780, "wires": [ [ "d6ab2dddb189d358" ], [ "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": 2350, "y": 3780, "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": 2350, "y": 3840, "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": 2530, "y": 3840, "wires": [] }, { "id": "c1a22098f4c6b607", "type": "link in", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "routine mode", "links": [], "x": 135, "y": 3900, "wires": [ [ "caaebc71902e0463" ] ] }, { "id": "f01348b36d2a9638", "type": "link out", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "routine mode", "mode": "return", "links": [], "x": 2475, "y": 3900, "wires": [] }, { "id": "48d872c1b6b9f14e", "type": "link call", "z": "bcb4426f5301b9f2", "g": "3e3cab934a02705f", "name": "", "links": [ "e520201563045cb4" ], "linkType": "static", "timeout": "30", "x": 470, "y": 3900, "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": 3900, "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": 2350, "y": 3900, "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": 3900, "wires": [ [ "48d872c1b6b9f14e" ] ] }, { "id": "0ecfc7dac3dc83c0", "type": "link out", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "routine motion", "mode": "return", "links": [], "x": 1915, "y": 4140, "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": 4080, "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": 4020, "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": 4020, "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": 4080, "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": 4020, "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", "x": 1010, "y": 4080, "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": 4080, "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": 4140, "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": 4080, "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": 4140, "wires": [ [ "a161c5ca3d8a7cbd" ] ] }, { "id": "6d71d5859b10c11e", "type": "link in", "z": "bcb4426f5301b9f2", "g": "64c6321bb60023c8", "name": "routine motion", "links": [], "x": 135, "y": 4080, "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": 4320, "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": 4260, "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": 4260, "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": 4320, "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": 4260, "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", "x": 1430, "y": 4260, "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": 4320, "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": 4380, "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": 4320, "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": 4380, "wires": [ [ "4d9991942988ca8c" ] ] }, { "id": "cae336906ea60890", "type": "link in", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "routine retention", "links": [], "x": 135, "y": 4320, "wires": [ [ "4a635ad2a4ed1736" ] ] }, { "id": "393ec8decef297e9", "type": "link out", "z": "bcb4426f5301b9f2", "g": "25501926b0199872", "name": "routine retention", "mode": "return", "links": [], "x": 2335, "y": 4380, "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": 4320, "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": 4260, "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": 4560, "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": 4500, "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": 4500, "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", "x": 1050, "y": 4560, "wires": [ [ "71ecc4394b7cd05d" ] ] }, { "id": "71ecc4394b7cd05d", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "field <= reglage", "property": "payload", "propertyType": "msg", "rules": [ { "t": "lte", "v": "metrics[msg.scene.bucket][msg.scene.type]darkness", "vt": "global" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1280, "y": 4560, "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": 4560, "wires": [ [ "f7baae7f1933153b" ] ] }, { "id": "466c44b0fc1258a7", "type": "link out", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "routine darkness", "mode": "return", "links": [], "x": 2015, "y": 4620, "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": 4500, "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": 4620, "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": 4560, "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": 4620, "wires": [ [ "f7baae7f1933153b" ] ] }, { "id": "3abf64e6a345da67", "type": "link in", "z": "bcb4426f5301b9f2", "g": "b34b57138cb1f0b8", "name": "routine darkness", "links": [], "x": 135, "y": 4560, "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": 4800, "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": 4740, "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": 4740, "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", "x": 1060, "y": 4800, "wires": [ [ "7fa7e12c70c95e89" ] ] }, { "id": "7fa7e12c70c95e89", "type": "switch", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "field >= reglage", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gte", "v": "metrics[msg.scene.bucket][msg.scene.type]['luminosite']", "vt": "global" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1290, "y": 4800, "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": 4800, "wires": [ [ "72d6ed833a034f7d" ] ] }, { "id": "a657a100c0565a83", "type": "link out", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "routine luminosity", "mode": "return", "links": [], "x": 2025, "y": 4860, "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": 4740, "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": 4860, "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": 4800, "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": 4860, "wires": [ [ "72d6ed833a034f7d" ] ] }, { "id": "89bf9e5c676a419c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "b69787e8c4f19d69", "name": "routine luminosity", "links": [], "x": 135, "y": 4800, "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": 1620, "y": 5040, "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": 1790, "y": 5040, "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": 1790, "y": 5100, "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": 2060, "y": 5160, "wires": [ [ "00f7d91e9a6c7617" ], [ "56ad085f1663d4c0" ] ] }, { "id": "38e608120e43ab47", "type": "link out", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine luminosite", "mode": "return", "links": [], "x": 2435, "y": 5280, "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": 1190, "y": 5040, "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": 1800, "y": 4980, "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": 790, "y": 5040, "wires": [ [ "a91140dc661eacbf" ], [ "a91140dc661eacbf" ], [ "9817b8c4d33159f8" ], [ "fd900a26e130d2ff" ] ] }, { "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": 1800, "y": 5220, "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": 990, "y": 5040, "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": 560, "y": 5100, "wires": [ [ "03700a180e6f8f5b" ] ] }, { "id": "3543fc558bdce918", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "system bucket", "property": "bucket", "propertyType": "msg", "rules": [ { "t": "neq", "v": "system", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 300, "y": 5040, "wires": [ [ "03700a180e6f8f5b" ], [ "e1587fba40d7939d" ] ] }, { "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": 2490, "y": 5220, "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": 2310, "y": 5160, "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": 2310, "y": 5220, "wires": [ [ "621c0f611ba16957", "38e608120e43ab47" ] ] }, { "id": "a8bcb0395fa8accc", "type": "switch", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "has dimmer reglage", "property": "routine", "propertyType": "msg", "rules": [ { "t": "hask", "v": "high", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1400, "y": 5100, "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": 1800, "y": 5160, "wires": [ [ "d8a3424e6a6f2827" ] ] }, { "id": "587236e6160da46c", "type": "link in", "z": "bcb4426f5301b9f2", "g": "f988b45c3d4a17ef", "name": "routine value", "links": [], "x": 135, "y": 5040, "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": 2310, "y": 5280, "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": 1030, "y": 5100, "wires": [] }, { "id": "d7babb57491ff7a8", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "timer from routine", "rules": [ { "t": "set", "p": "delay", "pt": "msg", "to": "routine.timer", "tot": "msg" }, { "t": "set", "p": "delay", "pt": "msg", "to": "msg.delay * 60000", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "scene.off", "tot": "msg" }, { "t": "set", "p": "timer", "pt": "msg", "to": "msg.scene.type & '/' & msg.scene.bucket & '/' & msg.scene.measurement & '/' & msg.scene.field", "tot": "jsonata" }, { "t": "set", "p": "timers[msg.timer]", "pt": "global", "to": "$millis() + msg.delay", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1010, "y": 5400, "wires": [ [ "7bfba4bb76a09e45" ] ] }, { "id": "7bfba4bb76a09e45", "type": "trigger", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "timer", "op1": "", "op2": "", "op1type": "nul", "op2type": "payl", "duration": "250", "extend": true, "overrideDelay": true, "units": "ms", "reset": "", "bytopic": "topic", "topic": "timer", "outputs": 1, "x": 1210, "y": 5400, "wires": [ [ "364bfd0f8218efb1" ] ] }, { "id": "37f065b203f116d2", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer", "mode": "return", "links": [], "x": 1495, "y": 5520, "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": 5460, "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" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 280, "y": 5460, "wires": [ [ "04fda8ed412120ca" ] ] }, { "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": 5460, "wires": [ [ "d7babb57491ff7a8" ], [ "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": 1550, "y": 5460, "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": 1370, "y": 5460, "wires": [ [ "9dd47ae7d0e90c33", "37f065b203f116d2", "23ef9aaffb31c21d" ] ] }, { "id": "364bfd0f8218efb1", "type": "change", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "rsp 1", "rules": [ { "t": "set", "p": "routine.response", "pt": "msg", "to": "1", "tot": "num" }, { "t": "delete", "p": "timers[msg.timer]", "pt": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1370, "y": 5400, "wires": [ [ "37f065b203f116d2", "9dd47ae7d0e90c33", "23ef9aaffb31c21d" ] ] }, { "id": "834ce9850cdb0a72", "type": "link in", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer", "links": [], "x": 135, "y": 5520, "wires": [ [ "cbe63d29435cb7ce", "8a154930c7214f18" ] ] }, { "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": 1370, "y": 5520, "wires": [ [ "37f065b203f116d2", "9dd47ae7d0e90c33", "23ef9aaffb31c21d" ] ] }, { "id": "23ef9aaffb31c21d", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9f00d3d0bf810df6", "name": "routine timer out", "mode": "link", "links": [ "96f83c7e2e8a15cc" ], "x": 1495, "y": 5400, "wires": [] }, { "id": "7017965f91bd177c", "type": "switch", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "night actif", "property": "routine.night", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 280, "y": 5700, "wires": [ [ "ce2126235b863201" ], [ "e09b198994376110" ] ] }, { "id": "56d6ee950d3d34c2", "type": "link out", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine night", "mode": "return", "links": [], "x": 575, "y": 5700, "wires": [] }, { "id": "eadfca81c8de4eb0", "type": "debug", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine night", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 630, "y": 5640, "wires": [] }, { "id": "dfec2e7efb555d4d", "type": "link in", "z": "bcb4426f5301b9f2", "g": "307791bd329226f2", "name": "routine night", "links": [], "x": 135, "y": 5700, "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": 450, "y": 5640, "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": 450, "y": 5700, "wires": [ [ "56d6ee950d3d34c2", "eadfca81c8de4eb0" ] ] }, { "id": "5cf04b3c11f23176", "type": "switch", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "daily present", "property": "metrics[msg.scene.bucket][msg.scene.type]", "propertyType": "global", "rules": [ { "t": "hask", "v": "daily", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 290, "y": 5880, "wires": [ [ "b51db40b65f89f75" ], [ "ecec645c51268d24" ] ] }, { "id": "096892189e1be538", "type": "link out", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "routine daily", "mode": "return", "links": [], "x": 595, "y": 5880, "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": 470, "y": 5880, "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": 470, "y": 5820, "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": 650, "y": 5820, "wires": [] }, { "id": "c63c05889184c3bc", "type": "link in", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "routine daily", "links": [], "x": 135, "y": 5880, "wires": [ [ "5cf04b3c11f23176" ] ] }, { "id": "e19c1916670880d7", "type": "comment", "z": "bcb4426f5301b9f2", "g": "9b5a799c5df750d4", "name": "rsp : 1 if done, -1 if not done, 0 if not present", "info": "", "x": 850, "y": 5880, "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": 1120, "y": 3420, "wires": [] }, { "id": "e667a9372137a0e2", "type": "comment", "z": "bcb4426f5301b9f2", "g": "45b2c91cc17508eb", "name": "scene must call \"routine mode\" first", "info": "", "x": 960, "y": 3480, "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": [] } ]