[ { "id": "52347795767acd3f", "type": "tab", "label": "A.Telegram", "disabled": false, "info": "", "env": [] }, { "id": "ab32af53a59cbfa9", "type": "group", "z": "52347795767acd3f", "name": "catch error", "style": { "fill": "#ff0000", "fill-opacity": "0.05", "label": true, "stroke": "#ff0000" }, "nodes": [ "cb4b8e74cf76ad20", "1493b3ec590211ef", "56268dd3950d582f" ], "x": 534, "y": 19, "w": 422, "h": 82 }, { "id": "6c5d9361dd313b9f", "type": "group", "z": "52347795767acd3f", "name": "", "style": { "fill": "#777777", "fill-opacity": "0.05", "label": true }, "nodes": [ "5b419a28f8338f2f", "d2959fd404d63e14", "a159d489843f4d84", "bdd2440c99f0d065", "93b32becb3f1dc05", "35fa81df547b4491" ], "x": 68, "y": 233, "w": 6094, "h": 494 }, { "id": "6a1e1fb203c6236a", "type": "group", "z": "52347795767acd3f", "name": "telegram - conversation", "style": { "fill": "#ff0000", "fill-opacity": "0.05", "label": true }, "nodes": [ "35ddaf63494d655b", "e5af41b779d62608", "94517b52fbc7c222", "90e4840756b8a410", "8c27c7e68eca1a64", "6697649d1c9b6c0e", "5ec32bd48911e852", "7dc93121ae6674e5", "534311e383278b30", "d69deeaa7e9d8299", "cf9ce352e1e22189", "51ac68fb3896f3c5", "03eee1773e4b2310", "e8ce95675101e8af", "c991e97927420e81", "d59ba3289c9140f5", "294f1ce97f6089bd", "01e78849a643e8a5", "2f22451fdc194049", "b03d810847d86c13", "930ec55bdd15ae80", "c98c8e1dd186a9e6", "a6c40e0c7109ccfc", "9ac1e60d77200847", "72129b12981918d3", "d14d8323f4b64b21", "bd19832c18d23672", "9d1cc9c17c4a70de", "c8bc6bc3f69bd415", "da845243f83992e3", "e73144651291e1f3", "e1cfda2f4b7b203d", "15ae149127236493", "7f180cad8bf1f211", "a99440b2cd2f03bf", "11628a7a4db100fe", "30946c7743bfbcc8", "0e7de263432880b9", "7d4b7dd3f0f26094", "5f97554e959fb27f", "91714762765d1df4", "f7c53c245cb82dbb", "2b9f5994b30122d2", "882c784fa50c695e", "cccf7ae8e3728235", "dc85e9205b9bc40a", "558e2007055f9c38", "3be41a89fb1c71f4", "cdf962c271de3805", "87eb4084ab2b6c4f", "4e3c3057b42e2a2a", "ce4d1a4c8f39d6ad", "55aa1e8e4e61d51f", "d9a8d6a331678098", "56a01bb3a1823ca6", "0c7e8c2914e9141c", "7c990a9e25fd7abf", "2eab37ce4e1d38c7", "5c38dd887299ff9c", "d0658792bccca939", "a4572ddd98280be9", "de28e8e397badc0d", "05436cd3824bb9cc", "c7adcee301e53907", "ecba03e31652a0a8", "0deb3214b824aa2f", "b1720ba6a2ac3c26", "c218bc6590a159a3", "ccba35f51ea02cde", "8c325fb9f9eedcc8" ], "x": 94, "y": 819, "w": 3822, "h": 922 }, { "id": "ca924b100cc8cff2", "type": "group", "z": "52347795767acd3f", "name": "telegram - sender", "style": { "label": true, "fill": "#ff0000", "fill-opacity": "0.05" }, "nodes": [ "758726f2b1f2072d", "0c86ad51105737f4", "3433733d6b9a8736" ], "x": 1334, "y": 19, "w": 652, "h": 82 }, { "id": "d2959fd404d63e14", "type": "group", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "telegram - chatbot - device", "style": { "fill": "#ffC000", "fill-opacity": "0.05", "label": true }, "nodes": [ "9af7b9c56907a138", "592fa749c393ef14", "f3cdc22dc1a6145b", "5c4f2123036c754e", "19134c8dcb4e84fd", "e34fb98383954858", "d0e2d7ea7c84203e", "68df08774aae3089" ], "x": 534, "y": 259, "w": 882, "h": 262 }, { "id": "a159d489843f4d84", "type": "group", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "telegram - chatbot - model", "style": { "fill": "#001f60", "fill-opacity": "0.05", "label": true }, "nodes": [ "addd40dc7fbf27c9", "5bea21ea2f447a5b", "ac45d4c7f6f1a547" ], "x": 94, "y": 259, "w": 342, "h": 82 }, { "id": "bdd2440c99f0d065", "type": "group", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "telegram - chatbot - metric", "style": { "fill": "#92d04f", "fill-opacity": "0.05", "label": true }, "nodes": [ "3a5d788b6c9b1490", "b203a4b79c347218", "af344ccaf295edf7", "2e3fc4b6e967c768", "db0cf67f4aecddf5", "e485f554c91b63f6", "647f561f3855b795", "5bec85a040561e90", "8d4968b4487ece04", "887cdd3998bb0a7b", "5cce3ddc85ae4b7f", "52e58ab14c13701d", "ba7a5c79cd8542ce", "cf344cfc63c703eb", "7102b05e3a7f621d", "8f85e38762803340" ], "x": 1514, "y": 259, "w": 2692, "h": 149.5 }, { "id": "93b32becb3f1dc05", "type": "group", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "telegram - chatbot - source - action system report", "style": { "fill": "#0070c0", "fill-opacity": "0.05", "label": true }, "nodes": [ "316ed209c87c228e", "6917e9365bf15cf3" ], "x": 1514, "y": 439, "w": 314, "h": 82 }, { "id": "35fa81df547b4491", "type": "group", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "room - ui - telegram", "style": { "fill": "#6f2fa0", "fill-opacity": "0.05", "label": true }, "nodes": [ "0691d9a37686f464", "3c6ee783748b235e", "761cb37547fe4dc2", "a033c6dbdefb80f9", "1d6b2ca73ae11560", "befe8bfd3d3446cc", "2936573edcac41e4", "6495af71a7195bb4", "bf793e9865c9e834", "5f4fe9067e1fd9a0", "05b5a24c1547eb9a", "b4a9884f6b553123", "5ab53f45b766d97b", "86f604b24a73308c", "25609df681da5c1b", "d2194c4dad790ec4", "12697008ac3ea99d", "97087ce25aae4515", "4edb12baad4c5bd0", "58e1c9e33b0a90f3", "1dec76a256793b0b", "30c0ca5c8f8631ea", "024254ee38afd638" ], "x": 4454, "y": 259, "w": 1682, "h": 442 }, { "id": "c28cd86afb368a68", "type": "comment", "z": "52347795767acd3f", "name": "Nestor - Telegram", "info": "chatid = 777414971", "x": 1150, "y": 60, "wires": [] }, { "id": "316ed209c87c228e", "type": "telegram command", "z": "52347795767acd3f", "g": "93b32becb3f1dc05", "name": "", "command": "Rapport", "description": "", "registercommand": false, "language": "", "scope": "default", "bot": "8c93df4a796cf540", "strict": false, "hasresponse": false, "useregex": false, "removeregexcommand": false, "outputs": 1, "x": 1590, "y": 480, "wires": [ [ "6917e9365bf15cf3" ] ] }, { "id": "35ddaf63494d655b", "type": "telegram command", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "command": "Nestor", "description": "", "registercommand": false, "language": "", "scope": "default", "bot": "8c93df4a796cf540", "strict": false, "hasresponse": true, "useregex": false, "removeregexcommand": false, "outputs": 2, "x": 170, "y": 860, "wires": [ [ "c8bc6bc3f69bd415" ], [ "6697649d1c9b6c0e" ] ] }, { "id": "e5af41b779d62608", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "start conversation", "rules": [ { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "Monsieur.", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 860, "wires": [ [ "05436cd3824bb9cc" ] ] }, { "id": "94517b52fbc7c222", "type": "link out", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "telegram - conversation", "mode": "link", "links": [ "ba0f26a893bbaac2", "3433733d6b9a8736" ], "x": 3875, "y": 920, "wires": [] }, { "id": "90e4840756b8a410", "type": "trigger", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "wait 10 s", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "10", "extend": false, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 2400, "y": 980, "wires": [ [ "8c27c7e68eca1a64" ] ] }, { "id": "8c27c7e68eca1a64", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "not ok", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "Je n'ai pas réussi.", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" }, { "t": "delete", "p": "bot", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2570, "y": 980, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "6697649d1c9b6c0e", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "bucket", "property": "metrics", "propertyType": "global", "rules": [ { "t": "hask", "v": "$lowercase(msg.payload.content)", "vt": "jsonata" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 330, "y": 980, "wires": [ [ "cf9ce352e1e22189" ], [ "5ec32bd48911e852" ] ] }, { "id": "5ec32bd48911e852", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "inconnu", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "Je ne connais pas cette pièce.", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" }, { "t": "delete", "p": "bot", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 500, "y": 980, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "7dc93121ae6674e5", "type": "function", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "intention", "func": "var opts = [[]];\nvar i = 0;\nif (msg.payload.light==true) {\n opts[0][i++] = {\n \"text\": \"lumière\",\n \"callback_data\": \"light\" \n }\n}\nif (msg.payload.shutter==true) {\n opts[0][i++] = {\n \"text\": \"volet\",\n \"callback_data\": \"shutter\" \n }\n}\nif (msg.payload.temperature==true) {\n opts[0][i++] = {\n \"text\": \"temperature\",\n \"callback_data\": \"temperature\" \n }\n}\nif (msg.payload.camera==true) {\n opts[0][i++] = {\n \"text\": \"photo\",\n \"callback_data\": \"camera\" \n }\n}\n\nmsg.payload.content = \"Que dois-je gérer ?\";\nmsg.payload.options = {reply_markup: JSON.stringify({\"inline_keyboard\":opts})};\nmsg.payload.messageId = 99;\nmsg.payload.sentMessageId = 99;\nmsg.payload.type = \"message\";\n\nreturn msg;", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2220, "y": 1100, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "534311e383278b30", "type": "telegram event", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "bot": "8c93df4a796cf540", "event": "callback_query", "autoanswer": false, "x": 200, "y": 1280, "wires": [ [ "03eee1773e4b2310" ] ] }, { "id": "d69deeaa7e9d8299", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has light", "property": "stack_bucket", "propertyType": "msg", "rules": [ { "t": "hask", "v": "light", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 700, "y": 1100, "wires": [ [ "51ac68fb3896f3c5" ], [ "c991e97927420e81" ] ] }, { "id": "cf9ce352e1e22189", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "reset payload", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "$lowercase(msg.payload.content)", "tot": "jsonata" }, { "t": "set", "p": "#:(onMemory)::query.bucket", "pt": "flow", "to": "bucket", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "jsonata" }, { "t": "set", "p": "stack_bucket", "pt": "msg", "to": "metrics[msg.bucket]", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 520, "y": 1100, "wires": [ [ "d69deeaa7e9d8299" ] ] }, { "id": "51ac68fb3896f3c5", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "light", "rules": [ { "t": "set", "p": "payload.light", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 890, "y": 1040, "wires": [ [ "c991e97927420e81" ] ] }, { "id": "03eee1773e4b2310", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "select action", "property": "payload.content", "propertyType": "msg", "rules": [ { "t": "eq", "v": "light", "vt": "str" }, { "t": "eq", "v": "temperature", "vt": "str" }, { "t": "eq", "v": "shutter", "vt": "str" }, { "t": "eq", "v": "camera", "vt": "str" }, { "t": "eq", "v": "switch on", "vt": "str" }, { "t": "eq", "v": "switch off", "vt": "str" }, { "t": "eq", "v": "open", "vt": "str" }, { "t": "eq", "v": "openwork", "vt": "str" }, { "t": "eq", "v": "close", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 10, "x": 410, "y": 1280, "wires": [ [ "294f1ce97f6089bd" ], [ "a4572ddd98280be9" ], [ "0e7de263432880b9" ], [ "a99440b2cd2f03bf" ], [ "2f22451fdc194049" ], [ "72129b12981918d3" ], [ "5f97554e959fb27f" ], [ "91714762765d1df4" ], [ "f7c53c245cb82dbb" ], [ "01e78849a643e8a5" ] ] }, { "id": "e8ce95675101e8af", "type": "function", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "light", "func": "var opts = {\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"éteindre\",\n \"callback_data\": \"switch off\" \n }, \n {\n \"text\": \"allumer\",\n \"callback_data\": \"switch on\" \n }]\n ]\n })\n};\n\nmsg.payload.content = \"Dois-je éteindre ou allumer la lumière ?\";\nmsg.payload.options = opts;\nmsg.payload.messageId = 99;\nmsg.payload.sentMessageId = 99;\nmsg.payload.type = \"message\";\n\nreturn [ msg ];\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2230, "y": 1160, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "c991e97927420e81", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has temperature", "property": "stack_bucket", "propertyType": "msg", "rules": [ { "t": "hask", "v": "temperature", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1100, "y": 1100, "wires": [ [ "d59ba3289c9140f5" ], [ "e1cfda2f4b7b203d" ] ] }, { "id": "d59ba3289c9140f5", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "temperature", "rules": [ { "t": "set", "p": "payload.temperature", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1310, "y": 1040, "wires": [ [ "e1cfda2f4b7b203d" ] ] }, { "id": "294f1ce97f6089bd", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "set measurement", "rules": [ { "t": "set", "p": "#:(onMemory)::query.measurement", "pt": "flow", "to": "payload.content", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 630, "y": 1160, "wires": [ [ "e8ce95675101e8af" ] ] }, { "id": "01e78849a643e8a5", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "unset measurement", "rules": [ { "t": "delete", "p": "#:(onMemory)::query.measurement", "pt": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 640, "y": 1700, "wires": [ [ "30946c7743bfbcc8" ] ] }, { "id": "2f22451fdc194049", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has measurement", "property": "#:(onMemory)::query.measurement", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 630, "y": 1400, "wires": [ [ "a6c40e0c7109ccfc" ] ] }, { "id": "b03d810847d86c13", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "'telegram/' & msg.bucket & '/cible/' & msg.field", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1690, "y": 1400, "wires": [ [ "0c7e8c2914e9141c", "d0658792bccca939" ] ] }, { "id": "930ec55bdd15ae80", "type": "link out", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "telegram - conversation - metric", "mode": "link", "links": [ "206c1fb4a48067df" ], "x": 1975, "y": 1460, "wires": [] }, { "id": "c98c8e1dd186a9e6", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "ok", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "Bien monsieur", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" }, { "t": "delete", "p": "bot", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2230, "y": 1400, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "a6c40e0c7109ccfc", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.bucket]light", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1400, "wires": [ [ "9ac1e60d77200847" ] ] }, { "id": "9ac1e60d77200847", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1030, "y": 1400, "wires": [ [ "b03d810847d86c13" ] ] }, { "id": "72129b12981918d3", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has measurement", "property": "#:(onMemory)::query.measurement", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 630, "y": 1460, "wires": [ [ "bd19832c18d23672" ] ] }, { "id": "d14d8323f4b64b21", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "'telegram/' & msg.bucket & '/cible/' & msg.field", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1690, "y": 1460, "wires": [ [ "0c7e8c2914e9141c", "d0658792bccca939" ] ] }, { "id": "bd19832c18d23672", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.bucket]light", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1460, "wires": [ [ "9d1cc9c17c4a70de" ] ] }, { "id": "9d1cc9c17c4a70de", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1030, "y": 1460, "wires": [ [ "d14d8323f4b64b21" ] ] }, { "id": "c8bc6bc3f69bd415", "type": "trigger", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "send then 1 s", "op1": "", "op2": "", "op1type": "pay", "op2type": "pay", "duration": "1", "extend": false, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 2, "x": 360, "y": 860, "wires": [ [ "e5af41b779d62608" ], [ "da845243f83992e3" ] ] }, { "id": "da845243f83992e3", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "start conversation", "rules": [ { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "De quelle pièce dois-je m'occuper ?", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 920, "wires": [ [ "05436cd3824bb9cc" ] ] }, { "id": "e73144651291e1f3", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "temperature", "rules": [ { "t": "set", "p": "tmp", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "tmp", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "'Il fait actuellement ' & msg.tmp & '°C monsieur'", "tot": "jsonata" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" }, { "t": "delete", "p": "bot", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2210, "y": 1220, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "e1cfda2f4b7b203d", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has camera", "property": "stack_bucket", "propertyType": "msg", "rules": [ { "t": "hask", "v": "camera", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1510, "y": 1100, "wires": [ [ "15ae149127236493" ], [ "d9a8d6a331678098" ] ] }, { "id": "15ae149127236493", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "camera", "rules": [ { "t": "set", "p": "payload.camera", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1700, "y": 1040, "wires": [ [ "d9a8d6a331678098" ] ] }, { "id": "7f180cad8bf1f211", "type": "http request", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "get snapshot", "method": "GET", "ret": "bin", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 810, "y": 1340, "wires": [ [ "11628a7a4db100fe" ] ] }, { "id": "a99440b2cd2f03bf", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "camera url", "rules": [ { "t": "set", "p": "tmp", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "url", "pt": "msg", "to": "metrics[msg.tmp]camera.url", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 610, "y": 1340, "wires": [ [ "7f180cad8bf1f211" ] ] }, { "id": "11628a7a4db100fe", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "photo", "rules": [ { "t": "set", "p": "tmp", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "tmp", "tot": "msg" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "photo", "tot": "str" }, { "t": "set", "p": "payload.caption", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload.caption", "pt": "msg", "to": "\"snapshot \" & msg.payload.caption", "tot": "jsonata" }, { "t": "delete", "p": "tmp", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2230, "y": 1340, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "30946c7743bfbcc8", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "message pas ok", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "json" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "Désole, je n'ai pas compris.", "tot": "str" }, { "t": "delete", "p": "#:(onMemory)::query", "pt": "flow" }, { "t": "delete", "p": "bot", "pt": "msg" }, { "t": "set", "p": "reset", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2200, "y": 1700, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "0e7de263432880b9", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "set measurement", "rules": [ { "t": "set", "p": "#:(onMemory)::query.measurement", "pt": "flow", "to": "payload.content", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 630, "y": 1260, "wires": [ [ "7d4b7dd3f0f26094" ] ] }, { "id": "7d4b7dd3f0f26094", "type": "function", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "shutter", "func": "var opts = {\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"ouvrir\",\n \"callback_data\": \"open\" \n }, \n {\n \"text\": \"ajourer\",\n \"callback_data\": \"openwork\" \n }, \n {\n \"text\": \"fermer\",\n \"callback_data\": \"close\" \n }]\n ]\n })\n};\n\nmsg.payload.content = \"Dans quelle position dois-je mettre les volets ?\";\nmsg.payload.options = opts;\nmsg.payload.messageId = 99;\nmsg.payload.sentMessageId = 99;\nmsg.payload.type = \"message\";\n\nreturn [ msg ];\n", "outputs": 1, "timeout": "", "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 2230, "y": 1280, "wires": [ [ "90e4840756b8a410", "05436cd3824bb9cc" ] ] }, { "id": "5f97554e959fb27f", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has measurement", "property": "#:(onMemory)::query.measurement", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 630, "y": 1520, "wires": [ [ "87eb4084ab2b6c4f" ] ] }, { "id": "91714762765d1df4", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has measurement", "property": "#:(onMemory)::query.measurement", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 630, "y": 1580, "wires": [ [ "3be41a89fb1c71f4" ] ] }, { "id": "f7c53c245cb82dbb", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has measurement", "property": "#:(onMemory)::query.measurement", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 630, "y": 1640, "wires": [ [ "5c38dd887299ff9c" ] ] }, { "id": "2b9f5994b30122d2", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "'telegram/' & msg.bucket & '/cible/' & msg.field", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "openwork", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1690, "y": 1580, "wires": [ [ "0c7e8c2914e9141c", "d0658792bccca939" ] ] }, { "id": "882c784fa50c695e", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "shutter", "property": "field", "propertyType": "msg", "rules": [ { "t": "eq", "v": "shutter", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1190, "y": 1580, "wires": [ [ "cccf7ae8e3728235" ] ] }, { "id": "cccf7ae8e3728235", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "openwork", "rules": [ { "t": "set", "p": "openwork", "pt": "msg", "to": "metrics[msg.bucket]shading.openwork", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1360, "y": 1580, "wires": [ [ "dc85e9205b9bc40a" ] ] }, { "id": "dc85e9205b9bc40a", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "exists", "property": "openwork", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "num" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1530, "y": 1580, "wires": [ [ "2b9f5994b30122d2" ] ] }, { "id": "558e2007055f9c38", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1030, "y": 1580, "wires": [ [ "882c784fa50c695e" ] ] }, { "id": "3be41a89fb1c71f4", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.bucket]aperture", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1580, "wires": [ [ "558e2007055f9c38" ] ] }, { "id": "cdf962c271de3805", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "'telegram/' & msg.bucket & '/cible/' & msg.field", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "99", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1690, "y": 1520, "wires": [ [ "0c7e8c2914e9141c", "d0658792bccca939" ] ] }, { "id": "87eb4084ab2b6c4f", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.bucket]aperture", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1520, "wires": [ [ "4e3c3057b42e2a2a" ] ] }, { "id": "4e3c3057b42e2a2a", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1030, "y": 1520, "wires": [ [ "ce4d1a4c8f39d6ad" ] ] }, { "id": "ce4d1a4c8f39d6ad", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "shutter", "property": "field", "propertyType": "msg", "rules": [ { "t": "eq", "v": "shutter", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1190, "y": 1520, "wires": [ [ "cdf962c271de3805" ] ] }, { "id": "55aa1e8e4e61d51f", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "'telegram/' & msg.bucket & '/cible/' & msg.field", "tot": "jsonata" }, { "t": "set", "p": "payload", "pt": "msg", "to": "0", "tot": "num" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1690, "y": 1640, "wires": [ [ "0c7e8c2914e9141c", "d0658792bccca939" ] ] }, { "id": "d9a8d6a331678098", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "has shutter", "property": "stack_bucket.aperture", "propertyType": "msg", "rules": [ { "t": "hask", "v": "shutter", "vt": "str" }, { "t": "else" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1890, "y": 1100, "wires": [ [ "56a01bb3a1823ca6" ], [ "7dc93121ae6674e5" ] ] }, { "id": "56a01bb3a1823ca6", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "shutter", "rules": [ { "t": "set", "p": "payload.shutter", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2050, "y": 1040, "wires": [ [ "7dc93121ae6674e5" ] ] }, { "id": "0c7e8c2914e9141c", "type": "trigger", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "send, wait 5 s", "op1": "", "op2": "", "op1type": "pay", "op2type": "nul", "duration": "5", "extend": false, "overrideDelay": false, "units": "s", "reset": "", "bytopic": "all", "topic": "topic", "outputs": 1, "x": 1880, "y": 1400, "wires": [ [ "c98c8e1dd186a9e6" ] ] }, { "id": "7c990a9e25fd7abf", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "shutter", "property": "field", "propertyType": "msg", "rules": [ { "t": "eq", "v": "shutter", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 1190, "y": 1640, "wires": [ [ "55aa1e8e4e61d51f" ] ] }, { "id": "2eab37ce4e1d38c7", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "field", "x": 1030, "y": 1640, "wires": [ [ "7c990a9e25fd7abf" ] ] }, { "id": "5c38dd887299ff9c", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics[msg.bucket]aperture", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 850, "y": 1640, "wires": [ [ "2eab37ce4e1d38c7" ] ] }, { "id": "d0658792bccca939", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "clean", "rules": [ { "t": "delete", "p": "bucket", "pt": "msg" }, { "t": "delete", "p": "measurement", "pt": "msg" }, { "t": "delete", "p": "field", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1850, "y": 1460, "wires": [ [ "930ec55bdd15ae80" ] ] }, { "id": "a4572ddd98280be9", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "bucket", "rules": [ { "t": "set", "p": "scene.bucket", "pt": "msg", "to": "#:(onMemory)::query.bucket", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1550, "y": 1220, "wires": [ [ "de28e8e397badc0d" ] ] }, { "id": "de28e8e397badc0d", "type": "link call", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "links": [ "ddd39f991efd9d31" ], "linkType": "static", "timeout": "30", "x": 1750, "y": 1220, "wires": [ [ "e73144651291e1f3" ] ] }, { "id": "cb4b8e74cf76ad20", "type": "catch", "z": "52347795767acd3f", "g": "ab32af53a59cbfa9", "name": "catch error", "scope": null, "uncaught": false, "x": 620, "y": 60, "wires": [ [ "1493b3ec590211ef" ] ] }, { "id": "1493b3ec590211ef", "type": "change", "z": "52347795767acd3f", "g": "ab32af53a59cbfa9", "name": "topic", "rules": [ { "t": "set", "p": "topic", "pt": "msg", "to": "telegram", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 790, "y": 60, "wires": [ [ "56268dd3950d582f" ] ] }, { "id": "56268dd3950d582f", "type": "link out", "z": "52347795767acd3f", "g": "ab32af53a59cbfa9", "name": "catch error", "mode": "link", "links": [ "a52f0e788cd4dca3" ], "x": 915, "y": 60, "wires": [] }, { "id": "5b419a28f8338f2f", "type": "comment", "z": "52347795767acd3f", "g": "6c5d9361dd313b9f", "name": "telegram / actif", "info": "", "x": 200, "y": 380, "wires": [] }, { "id": "9af7b9c56907a138", "type": "change", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "telegram / actif / boolean / true", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "field", "pt": "msg", "to": "actif", "tot": "str" }, { "t": "set", "p": "format", "pt": "msg", "to": "boolean", "tot": "str" }, { "t": "set", "p": "default", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 950, "y": 360, "wires": [ [ "5c4f2123036c754e" ] ] }, { "id": "592fa749c393ef14", "type": "link in", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "telegram - chatbot - device", "links": [ "546f190f3ec0c90d" ], "x": 575, "y": 300, "wires": [ [ "f3cdc22dc1a6145b" ] ] }, { "id": "f3cdc22dc1a6145b", "type": "switch", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "model", "property": "model", "propertyType": "msg", "rules": [ { "t": "eq", "v": "chatbot", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 710, "y": 300, "wires": [ [ "9af7b9c56907a138", "e34fb98383954858", "d0e2d7ea7c84203e", "68df08774aae3089" ] ] }, { "id": "5c4f2123036c754e", "type": "change", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "protocol", "rules": [ { "t": "set", "p": "protocol", "pt": "msg", "to": "telegram", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1240, "y": 300, "wires": [ [ "19134c8dcb4e84fd" ] ] }, { "id": "19134c8dcb4e84fd", "type": "link out", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "telegram - chatbot - device", "mode": "link", "links": [ "3e1b4213132404be" ], "x": 1375, "y": 300, "wires": [] }, { "id": "e34fb98383954858", "type": "change", "z": "52347795767acd3f", "d": true, "g": "d2959fd404d63e14", "name": "brand", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "jsonata" }, { "t": "set", "p": "field", "pt": "msg", "to": "actif", "tot": "jsonata" }, { "t": "set", "p": "brand", "pt": "msg", "to": "telegram", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 870, "y": 300, "wires": [ [ "5c4f2123036c754e" ] ] }, { "id": "addd40dc7fbf27c9", "type": "link in", "z": "52347795767acd3f", "g": "a159d489843f4d84", "name": "telegram - chatbot - model", "links": [ "9cb906bf8066d37e" ], "x": 135, "y": 300, "wires": [ [ "5bea21ea2f447a5b" ] ] }, { "id": "5bea21ea2f447a5b", "type": "change", "z": "52347795767acd3f", "g": "a159d489843f4d84", "name": "model", "rules": [ { "t": "set", "p": "brand", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "model", "pt": "msg", "to": "chatbot", "tot": "str" }, { "t": "set", "p": "protocol", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "field", "pt": "msg", "to": "actif", "tot": "str" }, { "t": "set", "p": "format", "pt": "msg", "to": "boolean", "tot": "str" }, { "t": "set", "p": "default", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 270, "y": 300, "wires": [ [ "ac45d4c7f6f1a547" ] ] }, { "id": "ac45d4c7f6f1a547", "type": "link out", "z": "52347795767acd3f", "g": "a159d489843f4d84", "name": "telegram - chatbot - model", "mode": "link", "links": [ "94aa726ce8973d2c" ], "x": 395, "y": 300, "wires": [] }, { "id": "d0e2d7ea7c84203e", "type": "change", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "telegram / message / text / ", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "field", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "format", "pt": "msg", "to": "text", "tot": "str" }, { "t": "set", "p": "default", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 940, "y": 420, "wires": [ [ "5c4f2123036c754e" ] ] }, { "id": "3a5d788b6c9b1490", "type": "link in", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "telegram - chatbot - metric", "links": [ "031a6afd8300356a", "094771ea30e6c0b6" ], "x": 1555, "y": 360, "wires": [ [ "8f85e38762803340" ] ] }, { "id": "b203a4b79c347218", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "measurement", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "eq", "v": "telegram", "vt": "str" }, { "t": "eq", "v": "notification", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 2, "x": 1900, "y": 360, "wires": [ [ "af344ccaf295edf7" ], [ "af344ccaf295edf7" ] ] }, { "id": "af344ccaf295edf7", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "field", "property": "field", "propertyType": "msg", "rules": [ { "t": "eq", "v": "photo", "vt": "str" }, { "t": "eq", "v": "message", "vt": "str" }, { "t": "eq", "v": "report", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 3, "x": 2090, "y": 360, "wires": [ [ "cf344cfc63c703eb" ], [ "7102b05e3a7f621d" ], [ "7102b05e3a7f621d" ] ] }, { "id": "2e3fc4b6e967c768", "type": "change", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "payload", "rules": [ { "t": "set", "p": "tmp", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "{}", "tot": "jsonata" }, { "t": "set", "p": "payload.content", "pt": "msg", "to": "tmp", "tot": "msg" }, { "t": "set", "p": "payload.chatId", "pt": "msg", "to": "devices[msg.bucket]telegram.message.id", "tot": "global" }, { "t": "set", "p": "payload.type", "pt": "msg", "to": "field", "tot": "msg" }, { "t": "delete", "p": "tmp", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3640, "y": 360, "wires": [ [ "5bec85a040561e90" ] ] }, { "id": "db0cf67f4aecddf5", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "mode master", "property": "metrics.system.mode.master", "propertyType": "global", "rules": [ { "t": "eq", "v": "about.automate", "vt": "global" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 2990, "y": 360, "wires": [ [ "e485f554c91b63f6" ] ] }, { "id": "e485f554c91b63f6", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "mode automate", "property": "metrics.system.mode.automate", "propertyType": "global", "rules": [ { "t": "eq", "v": "automatic", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3200, "y": 360, "wires": [ [ "647f561f3855b795" ] ] }, { "id": "647f561f3855b795", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "mode notification", "property": "metrics.system.mode.notification", "propertyType": "global", "rules": [ { "t": "neq", "v": "off", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3430, "y": 360, "wires": [ [ "2e3fc4b6e967c768" ] ] }, { "id": "5bec85a040561e90", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "not empty", "property": "payload.content", "propertyType": "msg", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3820, "y": 360, "wires": [ [ "8d4968b4487ece04", "887cdd3998bb0a7b" ] ] }, { "id": "758726f2b1f2072d", "type": "telegram sender", "z": "52347795767acd3f", "g": "ca924b100cc8cff2", "name": "", "bot": "8c93df4a796cf540", "haserroroutput": false, "outputs": 1, "x": 1550, "y": 60, "wires": [ [ "0c86ad51105737f4" ] ] }, { "id": "0c86ad51105737f4", "type": "debug", "z": "52347795767acd3f", "g": "ca924b100cc8cff2", "name": "telegram - sender - response", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1820, "y": 60, "wires": [] }, { "id": "8d4968b4487ece04", "type": "debug", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "telegram - chatbot - metric", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 4050, "y": 300, "wires": [] }, { "id": "6917e9365bf15cf3", "type": "link out", "z": "52347795767acd3f", "g": "93b32becb3f1dc05", "name": "telegram - chatbot - source - action system report", "mode": "link", "links": [ "34a350a168b2e745", "254eee2678120cf3" ], "x": 1715, "y": 480, "wires": [] }, { "id": "3433733d6b9a8736", "type": "link in", "z": "52347795767acd3f", "g": "ca924b100cc8cff2", "name": "telegram - sender", "links": [ "887cdd3998bb0a7b", "94517b52fbc7c222" ], "x": 1375, "y": 60, "wires": [ [ "758726f2b1f2072d" ] ] }, { "id": "887cdd3998bb0a7b", "type": "link out", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "telegram - chatbot - metric", "mode": "link", "links": [ "3433733d6b9a8736" ], "x": 3955, "y": 360, "wires": [] }, { "id": "05436cd3824bb9cc", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "from global", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2410, "y": 920, "wires": [ [ "c7adcee301e53907" ] ] }, { "id": "c7adcee301e53907", "type": "split", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "bucket", "x": 2590, "y": 920, "wires": [ [ "ecba03e31652a0a8" ] ] }, { "id": "ecba03e31652a0a8", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "actif", "property": "payload.telegram.actif", "propertyType": "msg", "rules": [ { "t": "true" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 2750, "y": 920, "wires": [ [ "0deb3214b824aa2f" ] ] }, { "id": "0deb3214b824aa2f", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "mode master", "property": "metrics.system.mode.master", "propertyType": "global", "rules": [ { "t": "eq", "v": "about.automate", "vt": "global" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 2930, "y": 920, "wires": [ [ "b1720ba6a2ac3c26" ] ] }, { "id": "b1720ba6a2ac3c26", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "mode automate", "property": "metrics.system.mode.automate", "propertyType": "global", "rules": [ { "t": "eq", "v": "automatic", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3140, "y": 920, "wires": [ [ "c218bc6590a159a3" ] ] }, { "id": "c218bc6590a159a3", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "mode notification", "property": "metrics.system.mode.notification", "propertyType": "global", "rules": [ { "t": "neq", "v": "off", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3370, "y": 920, "wires": [ [ "8c325fb9f9eedcc8" ] ] }, { "id": "ccba35f51ea02cde", "type": "switch", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "not empty", "property": "payload.content", "propertyType": "msg", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 3740, "y": 920, "wires": [ [ "94517b52fbc7c222" ] ] }, { "id": "8c325fb9f9eedcc8", "type": "change", "z": "52347795767acd3f", "g": "6a1e1fb203c6236a", "name": "chatid", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "old_payload", "tot": "msg" }, { "t": "set", "p": "payload.chatId", "pt": "msg", "to": "devices[msg.bucket]telegram.message.id", "tot": "global" }, { "t": "delete", "p": "old_payload", "pt": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 3570, "y": 920, "wires": [ [ "ccba35f51ea02cde" ] ] }, { "id": "68df08774aae3089", "type": "change", "z": "52347795767acd3f", "g": "d2959fd404d63e14", "name": "telegram / photo / text / ", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "str" }, { "t": "set", "p": "field", "pt": "msg", "to": "photo", "tot": "str" }, { "t": "set", "p": "format", "pt": "msg", "to": "text", "tot": "str" }, { "t": "set", "p": "default", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 920, "y": 480, "wires": [ [ "5c4f2123036c754e" ] ] }, { "id": "5cce3ddc85ae4b7f", "type": "change", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "from global", "rules": [ { "t": "set", "p": "old_payload", "pt": "msg", "to": "payload", "tot": "msg" }, { "t": "set", "p": "payload", "pt": "msg", "to": "metrics", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2450, "y": 360, "wires": [ [ "52e58ab14c13701d" ] ] }, { "id": "52e58ab14c13701d", "type": "split", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "buckets", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "bucket", "property": "payload", "x": 2640, "y": 360, "wires": [ [ "ba7a5c79cd8542ce" ] ] }, { "id": "ba7a5c79cd8542ce", "type": "switch", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "actif", "property": "payload.telegram.actif", "propertyType": "msg", "rules": [ { "t": "true" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 2810, "y": 360, "wires": [ [ "db0cf67f4aecddf5" ] ] }, { "id": "cf344cfc63c703eb", "type": "base64", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "", "action": "", "property": "payload", "x": 2260, "y": 300, "wires": [ [ "5cce3ddc85ae4b7f" ] ] }, { "id": "7102b05e3a7f621d", "type": "change", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "field", "rules": [ { "t": "set", "p": "field", "pt": "msg", "to": "message", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 2250, "y": 360, "wires": [ [ "5cce3ddc85ae4b7f" ] ] }, { "id": "0691d9a37686f464", "type": "switch", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "field", "property": "field", "propertyType": "msg", "rules": [ { "t": "eq", "v": "actif", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 5030, "y": 540, "wires": [ [ "6495af71a7195bb4", "4edb12baad4c5bd0" ] ] }, { "id": "3c6ee783748b235e", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "set metric", "rules": [ { "t": "set", "p": "measurement", "pt": "msg", "to": "telegram", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5880, "y": 540, "wires": [ [ "1d6b2ca73ae11560" ] ] }, { "id": "761cb37547fe4dc2", "type": "link in", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "room - ui - telegram - metric", "links": [ "b6323e1460f6f50c" ], "x": 4495, "y": 360, "wires": [ [ "befe8bfd3d3446cc" ] ] }, { "id": "a033c6dbdefb80f9", "type": "link in", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "room - ui - telegram - load", "links": [ "9e4bfee0db3051d4" ], "x": 4495, "y": 300, "wires": [ [ "58e1c9e33b0a90f3", "1dec76a256793b0b" ] ] }, { "id": "1d6b2ca73ae11560", "type": "link out", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "room - ui - alexa - metric", "mode": "link", "links": [ "2690f4e06626ebda" ], "x": 6015, "y": 540, "wires": [] }, { "id": "befe8bfd3d3446cc", "type": "switch", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "measurement", "property": "measurement", "propertyType": "msg", "rules": [ { "t": "eq", "v": "telegram", "vt": "str" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 4660, "y": 360, "wires": [ [ "bf793e9865c9e834", "024254ee38afd638" ] ] }, { "id": "2936573edcac41e4", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "reset", "rules": [], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5190, "y": 420, "wires": [ [ "6495af71a7195bb4", "97087ce25aae4515", "5f4fe9067e1fd9a0" ] ] }, { "id": "6495af71a7195bb4", "type": "ui-switch", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "actif", "label": "", "group": "cfbed463c3e70b05", "order": 2, "width": "1", "height": "1", "passthru": false, "topic": "actif", "topicType": "str", "style": "", "className": "", "onvalue": "true", "onvalueType": "bool", "onicon": "cog", "oncolor": "teal", "offvalue": "false", "offvalueType": "bool", "officon": "cog-off-outline", "offcolor": "grey", "x": 5530, "y": 540, "wires": [ [ "3c6ee783748b235e" ] ] }, { "id": "bf793e9865c9e834", "type": "delay", "z": "52347795767acd3f", "g": "35fa81df547b4491", "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": 4860, "y": 540, "wires": [ [ "0691d9a37686f464", "5ab53f45b766d97b" ] ] }, { "id": "5f4fe9067e1fd9a0", "type": "ui-text-input", "z": "52347795767acd3f", "g": "35fa81df547b4491", "group": "cfbed463c3e70b05", "name": "", "label": "Message", "order": 3, "width": "5", "height": "1", "topic": "topic", "topicType": "msg", "mode": "text", "delay": 300, "passthru": true, "sendOnDelay": false, "sendOnBlur": true, "sendOnEnter": true, "className": "", "x": 5360, "y": 600, "wires": [ [ "b4a9884f6b553123" ] ] }, { "id": "05b5a24c1547eb9a", "type": "ui-button", "z": "52347795767acd3f", "g": "35fa81df547b4491", "group": "cfbed463c3e70b05", "name": "send", "label": "", "order": 4, "width": "1", "height": "1", "emulateClick": false, "tooltip": "", "color": "", "bgcolor": "", "className": "", "icon": "send", "iconPosition": "left", "payload": "", "payloadType": "str", "topic": "message", "topicType": "str", "x": 5350, "y": 660, "wires": [ [ "12697008ac3ea99d" ] ] }, { "id": "b4a9884f6b553123", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "flow", "rules": [ { "t": "set", "p": "#:(onMemory)::telegram.content", "pt": "flow", "to": "payload", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5530, "y": 600, "wires": [ [] ] }, { "id": "5ab53f45b766d97b", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "empty", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5030, "y": 600, "wires": [ [ "5f4fe9067e1fd9a0" ] ] }, { "id": "86f604b24a73308c", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "payload", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "#:(onMemory)::telegram.content", "tot": "flow" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5700, "y": 660, "wires": [ [ "5ab53f45b766d97b", "25609df681da5c1b", "3c6ee783748b235e" ] ] }, { "id": "25609df681da5c1b", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "set notification metric", "rules": [ { "t": "set", "p": "bucket", "pt": "msg", "to": "system", "tot": "str" }, { "t": "set", "p": "measurement", "pt": "msg", "to": "notification", "tot": "str" }, { "t": "set", "p": "field", "pt": "msg", "to": "message", "tot": "str" }, { "t": "set", "p": "payload", "pt": "msg", "to": "Message telegram envoyé", "tot": "str" }, { "t": "set", "p": "repeat", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5920, "y": 660, "wires": [ [ "d2194c4dad790ec4" ] ] }, { "id": "d2194c4dad790ec4", "type": "link out", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "telegram - ui - notification", "mode": "link", "links": [ "206c1fb4a48067df" ], "x": 6095, "y": 660, "wires": [] }, { "id": "12697008ac3ea99d", "type": "switch", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "flow", "property": "#:(onMemory)::telegram.content", "propertyType": "flow", "rules": [ { "t": "nempty" } ], "checkall": "false", "repair": false, "outputs": 1, "x": 5530, "y": 660, "wires": [ [ "86f604b24a73308c" ] ] }, { "id": "97087ce25aae4515", "type": "ui-text", "z": "52347795767acd3f", "g": "35fa81df547b4491", "group": "cfbed463c3e70b05", "order": 1, "width": "5", "height": "1", "name": "actif (txt)", "label": "", "format": "{{msg.payload}}", "layout": "row-right", "style": false, "font": "", "fontSize": 16, "color": "#717171", "className": "", "x": 5360, "y": 540, "wires": [] }, { "id": "4edb12baad4c5bd0", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "format", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "msg.payload?\"Gestion d'assistant active\":\"Gestion d'assistant inactive\"", "tot": "jsonata" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5190, "y": 540, "wires": [ [ "97087ce25aae4515" ] ] }, { "id": "58e1c9e33b0a90f3", "type": "delay", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "50 ms", "pauseType": "delay", "timeout": "50", "timeoutUnits": "milliseconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 4630, "y": 420, "wires": [ [ "2936573edcac41e4" ] ] }, { "id": "8f85e38762803340", "type": "gate", "z": "52347795767acd3f", "g": "bdd2440c99f0d065", "name": "gate loop", "controlTopic": "gate loop", "defaultState": "closed", "openCmd": "open", "closeCmd": "close", "toggleCmd": "toggle", "defaultCmd": "default", "statusCmd": "status", "persist": false, "storeName": "default", "x": 1700, "y": 360, "wires": [ [ "b203a4b79c347218" ] ] }, { "id": "1dec76a256793b0b", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "group", "rules": [ { "t": "set", "p": "group", "pt": "msg", "to": "Telegram", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 5010, "y": 300, "wires": [ [ "30c0ca5c8f8631ea" ] ] }, { "id": "30c0ca5c8f8631ea", "type": "link out", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "room - ui - telegram - control", "mode": "link", "links": [ "4afaf74fbb2e3c7f" ], "x": 5135, "y": 300, "wires": [] }, { "id": "024254ee38afd638", "type": "change", "z": "52347795767acd3f", "g": "35fa81df547b4491", "name": "control", "rules": [ { "t": "set", "p": "control", "pt": "msg", "to": "show", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 4850, "y": 360, "wires": [ [ "1dec76a256793b0b" ] ] } ]