-
Notifications
You must be signed in to change notification settings - Fork 70
/
flow
1 lines (1 loc) · 23.9 KB
/
flow
1
[{"id":"1d7f96d0.a5ef29","type":"subflow","name":"Network Map (4)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"16f0a6aa.365fd9","type":"mqtt in","z":"1d7f96d0.a5ef29","name":"zigbee2mqtt/out","topic":"zigbee2mqtt/bridge/networkmap/graphviz","qos":"2","broker":"cae262ab.45512","x":120,"y":140,"wires":[["fe591242.503dd"]]},{"id":"acba4c61.f1022","type":"http in","z":"1d7f96d0.a5ef29","name":"","url":"/adminpanelapi/networkmap/graphviz","method":"get","upload":false,"swaggerDoc":"","x":200,"y":200,"wires":[["f57c1c5c.db0c4"]]},{"id":"77ae799c.51ee38","type":"http response","z":"1d7f96d0.a5ef29","name":"","x":610,"y":200,"wires":[]},{"id":"f57c1c5c.db0c4","type":"function","z":"1d7f96d0.a5ef29","name":"get from flow","func":"var networkmap = flow.get('networkmap');\n\nmsg.payload = networkmap;\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":200,"wires":[["77ae799c.51ee38"]]},{"id":"7e78e0f8.3ee19","type":"inject","z":"1d7f96d0.a5ef29","name":"","topic":"","payload":"graphviz","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"300","x":120,"y":80,"wires":[["9a6b1034.fada4"]]},{"id":"fe591242.503dd","type":"function","z":"1d7f96d0.a5ef29","name":"store in flow","func":"flow.set('networkmap',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":290,"y":140,"wires":[[]]},{"id":"9a6b1034.fada4","type":"mqtt out","z":"1d7f96d0.a5ef29","name":"zigbee2mqtt/in","topic":"zigbee2mqtt/bridge/networkmap","qos":"","retain":"","broker":"cae262ab.45512","x":280,"y":80,"wires":[]},{"id":"85c669c4.62eca8","type":"http in","z":"1d7f96d0.a5ef29","name":"","url":"/adminpanelapi/networkmap/viz/:engine","method":"get","upload":false,"swaggerDoc":"","x":210,"y":260,"wires":[["ca7e5a95.b39b78"]]},{"id":"769c032.82029fc","type":"http response","z":"1d7f96d0.a5ef29","name":"","statusCode":"","headers":{},"x":810,"y":260,"wires":[]},{"id":"87a8d60a.86d478","type":"function","z":"1d7f96d0.a5ef29","name":"generate viz html","func":"var html = `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title>NetworkMap</title>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/viz.js\"></script>\n <script src=\"https://cdnjs.cloudflare.com/ajax/libs/viz.js/2.1.2/full.render.js\"></script>\n <script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/svg-pan-zoom.min.js'></script>\n <style>\n svg {\n width: 100% !important;\n height: 100% !important;\n min-width: 100% !important;\n min-height: 80% !important;\n }\n </style>\n </head>\n <body>\n <div id=\"output\"></div>\n \n <script>\n var graphData = '${(flow.get('networkmap')).replace(/(\\r\\n|\\n|\\r)/gm,\"\")}';\n var vizOptions = { format: 'svg', engine: '${msg.engine}'}\n var graph = document.querySelector(\"#output\");\n var svg = graph.querySelector(\"svg\");\n if (svg) {\n graph.removeChild(svg);\n } \n\n var viz = new Viz();\n\n viz.renderSVGElement(graphData, vizOptions)\n .then(function(svg) {\n svg.id = \"svg_output\";\n graph.appendChild(svg); \n \n panZoom = svgPanZoom(svg, {\n zoomEnabled: true,\n controlIconsEnabled: true,\n contain: true,\n center: true,\n minZoom: 0.1\n });\n\n svg.addEventListener('paneresize', function(e) {\n panZoom.resize();\n }, false);\n window.addEventListener('resize', function(e) {\n panZoom.resize();\n });\n })\n .catch(error => {\n // Create a new Viz instance (@see Caveats page for more info)\n viz = new Viz();\n \n // Possibly display the error\n console.error(error);\n });\n </script>\n </body>\n</html>\n`\n\nmsg.payload = html;\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":260,"wires":[["769c032.82029fc"]]},{"id":"ca7e5a95.b39b78","type":"function","z":"1d7f96d0.a5ef29","name":"set engine","func":"var availableEngines = ['circo', 'dot', 'fdp', 'neato', 'osage', 'twopi']\nif(availableEngines.includes(msg.req.params.engine)) { msg.engine = msg.req.params.engine }\nelse { msg.engine = 'dot' }\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":260,"wires":[["87a8d60a.86d478"]]},{"id":"c2287cf1.f1006","type":"subflow","name":"Pairing Notifications (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"307ac2fc.2856ae","type":"mqtt in","z":"c2287cf1.f1006","name":"zigbee2mqtt/logging","topic":"zigbee2mqtt/bridge/log","qos":"2","broker":"","x":290,"y":140,"wires":[["45e00180.83e83"]]},{"id":"45e00180.83e83","type":"json","z":"c2287cf1.f1006","name":"","property":"payload","action":"","pretty":false,"x":450,"y":140,"wires":[["dc358e29.225bb","764d802.91a968","b08008c5.204708"]]},{"id":"8daaa3f0.d30ab","type":"ui_toast","z":"c2287cf1.f1006","position":"top right","displayTime":"30","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":950,"y":80,"wires":[]},{"id":"dc358e29.225bb","type":"function","z":"c2287cf1.f1006","name":"Notification","func":"if(msg.payload.type == \"pairing\" && msg.payload.message == \"connecting with device\") {\n\nmsg.payload = (\"A device is attempting to pair...\");\n\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":750,"y":80,"wires":[["8daaa3f0.d30ab"]]},{"id":"25f76ee9.aae022","type":"comment","z":"c2287cf1.f1006","name":"Notification","info":"","x":110,"y":140,"wires":[]},{"id":"b43fd89c.464988","type":"comment","z":"c2287cf1.f1006","name":"Pairing","info":"","x":590,"y":80,"wires":[]},{"id":"b3978445.0b5e68","type":"ui_toast","z":"c2287cf1.f1006","position":"top right","displayTime":"10","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":950,"y":200,"wires":[]},{"id":"764d802.91a968","type":"function","z":"c2287cf1.f1006","name":"Notification","func":"if(msg.payload.type == \"device_connected\") {\n\nmsg.payload = (\"Device paired successfully: \" + msg.payload.message);\n\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":750,"y":200,"wires":[["b3978445.0b5e68"]]},{"id":"6997afbb.5fbb5","type":"comment","z":"c2287cf1.f1006","name":"Paired","info":"","x":590,"y":200,"wires":[]},{"id":"bb7fadab.5e5b3","type":"ui_toast","z":"c2287cf1.f1006","position":"top right","displayTime":"30","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":1030,"y":140,"wires":[]},{"id":"b08008c5.204708","type":"function","z":"c2287cf1.f1006","name":"Notification","func":"if(msg.payload.type == \"pairing\" && msg.payload.message == \"device incoming\") {\n\nmsg.payload = (\"A device is incoming or repairing...\");\n\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":830,"y":140,"wires":[["bb7fadab.5e5b3"]]},{"id":"20b50057.748cd","type":"comment","z":"c2287cf1.f1006","name":"Incoming or Repairing","info":"","x":640,"y":140,"wires":[]},{"id":"ef334060.da584","type":"subflow","name":"Devices (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"7e8b83dd.fefb2c","type":"mqtt in","z":"ef334060.da584","name":"zigbee2mqtt/out devices","topic":"zigbee2mqtt/bridge/log","qos":"2","broker":"","x":350,"y":140,"wires":[["493b6023.cb968"]]},{"id":"9e679d81.13fa7","type":"ui_template","z":"ef334060.da584","group":"25691028.52c6a","name":"","order":0,"width":"12","height":"12","format":"<table>\n<tr>\n <td><B><U>Name:</U></B></td>\n <td><B><U>ieeeAddr:</U></B></td>\n <td><B><U>Model:</U></B></td>\n <td><B><U>Type:</U></B></td>\n</tr>\n <tr ng-repeat=\"obj in msg.payload.message\">\n <td>{{ obj.friendly_name }}</td>\n <td>{{ obj.ieeeAddr }}</td>\n <td>{{ obj.model }}</td>\n <td>{{ obj.type }}</td>\n </tr>\n\n</table>\n\n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":660,"y":140,"wires":[[]]},{"id":"99faecf2.930b","type":"mqtt out","z":"ef334060.da584","name":"zigbee2mqtt/in devices","topic":"zigbee2mqtt/bridge/config/devices","qos":"","retain":"","broker":"","x":580,"y":60,"wires":[]},{"id":"3470fa68.a6a0f6","type":"inject","z":"ef334060.da584","name":"Request Device List","topic":"","payload":"","payloadType":"date","repeat":"4","crontab":"","once":true,"onceDelay":0.1,"x":360,"y":60,"wires":[["99faecf2.930b"]]},{"id":"9db58260.e1cef","type":"comment","z":"ef334060.da584","name":"Request Device List","info":"","x":130,"y":60,"wires":[]},{"id":"c504a6d9.be0f88","type":"comment","z":"ef334060.da584","name":"Receive Device List","info":"","x":130,"y":140,"wires":[]},{"id":"493b6023.cb968","type":"json","z":"ef334060.da584","name":"","property":"payload","action":"","pretty":false,"x":530,"y":140,"wires":[["9e679d81.13fa7","ec8f578e.d813d8","5fc28354.efa61c"]]},{"id":"62d673de.710fdc","type":"http in","z":"ef334060.da584","name":"","url":"/adminpanelapi/devicelist","method":"get","upload":false,"swaggerDoc":"","x":530,"y":220,"wires":[["e07b6d25.d3f88"]]},{"id":"ec8f578e.d813d8","type":"function","z":"ef334060.da584","name":"Store Data","func":"flow.set('devicelist',msg.payload);","outputs":1,"noerr":0,"x":310,"y":220,"wires":[[]]},{"id":"9e2e3a21.508488","type":"http response","z":"ef334060.da584","name":"","x":870,"y":220,"wires":[]},{"id":"e07b6d25.d3f88","type":"function","z":"ef334060.da584","name":"Get Data","func":"var devicelist = flow.get('devicelist');\nmsg.payload = devicelist;\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":220,"wires":[["9e2e3a21.508488"]]},{"id":"159e20d8.80f35f","type":"comment","z":"ef334060.da584","name":"HTTP JSON API","info":"","x":120,"y":220,"wires":[]},{"id":"5fc28354.efa61c","type":"function","z":"ef334060.da584","name":"Store Globally","func":"global.set('zigbee2mqttdevicelist',msg.payload.message);\nreturn msg;","outputs":1,"noerr":0,"x":890,"y":120,"wires":[[]]},{"id":"25691028.52c6a","type":"ui_group","z":"ef334060.da584","name":"Devices","tab":"8a847acd.0763c8","order":1,"disp":true,"width":"12","collapse":false},{"id":"745da55.b69b05c","type":"subflow","name":"Status (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"279644dc.6dee7c","type":"mqtt in","z":"745da55.b69b05c","name":"zigbee2mqtt/bridge state","topic":"zigbee2mqtt/bridge/state","qos":"2","broker":"","x":270,"y":80,"wires":[["73aeae18.80fcc"]]},{"id":"73aeae18.80fcc","type":"function","z":"745da55.b69b05c","name":"Format Data","func":"flow.set('bridgestate',msg.payload);\nvar bridgestate = flow.get('bridgestate');\nmsg.payload = bridgestate;\nreturn msg;","outputs":1,"noerr":0,"x":470,"y":80,"wires":[["dd378351.d3647"]]},{"id":"a34a71ef.4217d","type":"ui_template","z":"745da55.b69b05c","group":"40573a59.6ec0c4","name":"","order":0,"width":"6","height":"2","format":"<style>\n {{msg.style}}\n</style>\n\n<table>\n <tr>\n <td>Bridge</td>\n <td>{{msg.payload.bridgestate}}</td>\n </tr>\n <tr>\n <td>Devices</td>\n <td>{{msg.payload.numberofdevices}}</td>\n </tr>\n</table>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":660,"y":140,"wires":[[]]},{"id":"200af5e2.bc798a","type":"function","z":"745da55.b69b05c","name":"Format Data","func":"var bridgestate = flow.get('bridgestate');\nvar devicelist = global.get('zigbee2mqttdevicelist');\nmsg.payload = {}\nmsg.payload.bridgestate = bridgestate;\nmsg.payload.numberofdevices = devicelist.length;\n\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":140,"wires":[["a34a71ef.4217d"]]},{"id":"55e501ad.f5a31","type":"inject","z":"745da55.b69b05c","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":true,"onceDelay":0.1,"x":350,"y":140,"wires":[["200af5e2.bc798a"]]},{"id":"dd378351.d3647","type":"debug","z":"745da55.b69b05c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":610,"y":80,"wires":[]},{"id":"4cc29788.d3dfb8","type":"comment","z":"745da55.b69b05c","name":"Get state","info":"","x":80,"y":80,"wires":[]},{"id":"9a06de18.4cfd6","type":"comment","z":"745da55.b69b05c","name":"Update Web UI on Interval","info":"","x":130,"y":140,"wires":[]},{"id":"b6701cc1.b20c1","type":"http in","z":"745da55.b69b05c","name":"","url":"/adminpanelapi/state","method":"get","upload":false,"swaggerDoc":"","x":270,"y":220,"wires":[["eaa0f59a.9ea2e8"]]},{"id":"91945b7c.338b18","type":"http response","z":"745da55.b69b05c","name":"","x":590,"y":220,"wires":[]},{"id":"eaa0f59a.9ea2e8","type":"function","z":"745da55.b69b05c","name":"Get Data","func":"var bridgestate = flow.get('bridgestate');\nmsg.payload = bridgestate;\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":220,"wires":[["91945b7c.338b18"]]},{"id":"911973d4.caa7b","type":"comment","z":"745da55.b69b05c","name":"HTTP API","info":"","x":80,"y":220,"wires":[]},{"id":"40573a59.6ec0c4","type":"ui_group","z":"","name":"Status","tab":"8a847acd.0763c8","order":2,"disp":true,"width":"6","collapse":false},{"id":"4b20a347.6179ec","type":"subflow","name":"Logging Level (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"e536b93d.38ce58","type":"ui_dropdown","z":"4b20a347.6179ec","name":"","label":"","place":"Select option","group":"4cb35853.cdcde8","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"Info","value":"info","type":"str"},{"label":"Debug","value":"debug","type":"str"},{"label":"Warn","value":"warn","type":"str"},{"label":"Error","value":"error","type":"str"}],"payload":"","topic":"","x":120,"y":60,"wires":[["7557b403.7b31cc"]]},{"id":"7557b403.7b31cc","type":"mqtt out","z":"4b20a347.6179ec","name":"zigbee2mqtt/in Logging Level","topic":"zigbee2mqtt/bridge/config/log_level","qos":"","retain":"","broker":"","x":380,"y":60,"wires":[]},{"id":"4cb35853.cdcde8","type":"ui_group","z":"4b20a347.6179ec","name":"Logging Level","tab":"8a847acd.0763c8","order":4,"disp":true,"width":"6","collapse":false},{"id":"321dbafd.bfadd6","type":"subflow","name":"Remove Device (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"3d54715b.2d141e","type":"ui_text_input","z":"321dbafd.bfadd6","name":"","label":"Device Name","group":"bbb3596e.f2c6a8","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"5","topic":"","x":300,"y":60,"wires":[["7bbae970.739f08"]]},{"id":"77e98a80.5cecc4","type":"mqtt out","z":"321dbafd.bfadd6","name":"zigbee2mqtt/in Remove","topic":"zigbee2mqtt/bridge/config/remove","qos":"","retain":"","broker":"","x":1190,"y":60,"wires":[]},{"id":"bba4a9e2.774a58","type":"function","z":"321dbafd.bfadd6","name":"Format Data","func":"flow.set('remove',msg.payload.remove);","outputs":1,"noerr":0,"x":650,"y":60,"wires":[[]]},{"id":"7bbae970.739f08","type":"change","z":"321dbafd.bfadd6","name":"change msg old","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.remove","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":60,"wires":[["bba4a9e2.774a58"]]},{"id":"23f4c1c8.b1cdee","type":"function","z":"321dbafd.bfadd6","name":"Format Data","func":"var remove = flow.get('remove');\nif (typeof remove !== 'undefined' && remove !== null && remove !== \"\"){\nmsg.payload = remove;\n\nreturn msg;\n}","outputs":1,"noerr":0,"x":970,"y":60,"wires":[["77e98a80.5cecc4"]]},{"id":"2fb6b0f0.c1b22","type":"ui_button","z":"321dbafd.bfadd6","name":"","group":"bbb3596e.f2c6a8","order":5,"width":0,"height":0,"passthru":false,"label":"Remove","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":820,"y":60,"wires":[["23f4c1c8.b1cdee","33ef226e.e110ce"]]},{"id":"4475f491.2a912c","type":"comment","z":"321dbafd.bfadd6","name":"Remove Device","info":"","x":120,"y":60,"wires":[]},{"id":"ff765b29.6adee8","type":"mqtt in","z":"321dbafd.bfadd6","name":"zigbee2mqtt/logging","topic":"zigbee2mqtt/bridge/log","qos":"2","broker":"","x":290,"y":120,"wires":[["745b519f.3cebe"]]},{"id":"745b519f.3cebe","type":"json","z":"321dbafd.bfadd6","name":"","property":"payload","action":"","pretty":false,"x":450,"y":120,"wires":[["7ddf8dc.b520d74"]]},{"id":"1e58e32b.ccff3d","type":"ui_toast","z":"321dbafd.bfadd6","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":790,"y":120,"wires":[]},{"id":"7ddf8dc.b520d74","type":"function","z":"321dbafd.bfadd6","name":"Notification","func":"if(msg.payload.type == 'device_removed') {\nvar remove = flow.get('remove');\nif (typeof remove !== 'undefined' && remove !== null && remove !== \"\"){\nmsg.payload = (\"Deviced removed: \" + msg.payload.message);\n\n// Reset field\n//remove = \"\";\n//flow.set('remove',msg.payload.message);\n\nreturn msg;\n}\n}\n\n","outputs":1,"noerr":0,"x":590,"y":120,"wires":[["1e58e32b.ccff3d"]]},{"id":"f7da77dc.c6e758","type":"comment","z":"321dbafd.bfadd6","name":"Notification","info":"","x":110,"y":120,"wires":[]},{"id":"f33f2806.7e7f48","type":"ui_toast","z":"321dbafd.bfadd6","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":1210,"y":120,"wires":[]},{"id":"33ef226e.e110ce","type":"function","z":"321dbafd.bfadd6","name":"Notification","func":"var remove = flow.get('remove');\nif (typeof remove === 'undefined' || remove === null || remove === \"\"){\nmsg.payload = \"Enter a device to remove\";\n\nreturn msg;\n}","outputs":1,"noerr":0,"x":1010,"y":120,"wires":[["f33f2806.7e7f48"]]},{"id":"bbb3596e.f2c6a8","type":"ui_group","z":"321dbafd.bfadd6","name":"Remove Device","tab":"8a847acd.0763c8","order":5,"disp":true,"width":"6","collapse":false},{"id":"8bff0e3.fceb9f","type":"subflow","name":"Permit Join (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"17f72daf.369812","type":"ui_dropdown","z":"8bff0e3.fceb9f","name":"","label":"","place":"Select option","group":"7b37feaf.b63ae","order":1,"width":0,"height":0,"passthru":true,"options":[{"label":"Allow","value":"true","type":"str"},{"label":"Deny","value":"false","type":"str"}],"payload":"","topic":"","x":90,"y":40,"wires":[["32c724f.65b28dc","2c5e4cc7.f1b534"]]},{"id":"32c724f.65b28dc","type":"mqtt out","z":"8bff0e3.fceb9f","name":"zigbee2mqtt/in Join","topic":"zigbee2mqtt/bridge/config/permit_join","qos":"","retain":"","broker":"cae262ab.45512","x":270,"y":40,"wires":[]},{"id":"4cfd10b0.ff8d6","type":"ui_toast","z":"8bff0e3.fceb9f","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":450,"y":100,"wires":[]},{"id":"2c5e4cc7.f1b534","type":"function","z":"8bff0e3.fceb9f","name":"Notification","func":"if (typeof msg.payload !== 'undefined' && msg.payload !== null && msg.payload !== \"\"){\nif (msg.payload == \"false\"){\n msg.payload = \"Permit join: Deny\";\n}\nif (msg.payload == \"true\"){\n msg.payload = \"Permit join: Allow\";\n}\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":250,"y":100,"wires":[["4cfd10b0.ff8d6"]]},{"id":"7b37feaf.b63ae","type":"ui_group","z":"","name":"Permit Join","tab":"8a847acd.0763c8","order":3,"disp":true,"width":"6","collapse":false},{"id":"cae262ab.45512","type":"mqtt-broker","z":"","name":"","broker":"192.168.0.5","port":"8883","tls":"9895f781.42a5e8","clientid":"","usetls":true,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9895f781.42a5e8","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"m2mqtt_srv.crt","keyname":"m2mqtt_srv.key","caname":"m2mqtt_ca.crt","servername":"","verifyservercert":false},{"id":"e084a6a.4631f58","type":"subflow","name":"Rename Device (5)","info":"","category":"Zigbee2MQTT Admin Panel","in":[],"out":[]},{"id":"b8f2f698.57e568","type":"ui_text_input","z":"e084a6a.4631f58","name":"","label":"Old Name","group":"241ead91.463d32","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"5","topic":"","x":120,"y":140,"wires":[["d7eb0922.b84f08"]]},{"id":"94d90d29.f3402","type":"ui_text_input","z":"e084a6a.4631f58","name":"","label":"New Name","group":"241ead91.463d32","order":4,"width":0,"height":0,"passthru":true,"mode":"text","delay":"5","topic":"","x":130,"y":200,"wires":[["affaacf8.e5f47"]]},{"id":"42f80cde.64caa4","type":"mqtt out","z":"e084a6a.4631f58","name":"zigbee2mqtt/in Rename","topic":"zigbee2mqtt/bridge/config/rename","qos":"","retain":"","broker":"","x":1010,"y":140,"wires":[]},{"id":"45b3ba5.f047644","type":"function","z":"e084a6a.4631f58","name":"Format Data","func":"flow.set('oldname',msg.payload.old);","outputs":1,"noerr":0,"x":470,"y":140,"wires":[[]]},{"id":"d7eb0922.b84f08","type":"change","z":"e084a6a.4631f58","name":"change msg old","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.old","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":140,"wires":[["45b3ba5.f047644"]]},{"id":"affaacf8.e5f47","type":"change","z":"e084a6a.4631f58","name":"change msg new","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.new","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":200,"wires":[["f95d60ee.d6ca"]]},{"id":"21cf98b4.9a32f8","type":"function","z":"e084a6a.4631f58","name":"Format Data","func":"var oldname = flow.get('oldname');\nvar newname = flow.get('newname');\n\nif (typeof oldname !== 'undefined' && oldname !== null && oldname !== \"\" && typeof newname !== 'undefined' && newname !== null && newname !== \"\"){\nmsg.payload = {\"old\": oldname, \"new\": newname}\n\n// Reset fields\noldname = \"\";\nnewname = \"\";\nflow.set('oldname',msg.payload.old);\nflow.set('newname',msg.payload.new);\n\nreturn msg;\n}","outputs":1,"noerr":0,"x":790,"y":140,"wires":[["42f80cde.64caa4"]]},{"id":"f95d60ee.d6ca","type":"function","z":"e084a6a.4631f58","name":"Format Data","func":"flow.set('newname',msg.payload.new);","outputs":1,"noerr":0,"x":490,"y":200,"wires":[[]]},{"id":"f3b62056.55b2d","type":"ui_button","z":"e084a6a.4631f58","name":"","group":"241ead91.463d32","order":5,"width":0,"height":0,"passthru":false,"label":"Rename","color":"","bgcolor":"","icon":"","payload":"","payloadType":"date","topic":"","x":640,"y":140,"wires":[["21cf98b4.9a32f8","413a9336.12cf2c"]]},{"id":"2826da46.731886","type":"ui_toast","z":"e084a6a.4631f58","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":850,"y":200,"wires":[]},{"id":"413a9336.12cf2c","type":"function","z":"e084a6a.4631f58","name":"Notification","func":"var oldname = flow.get('oldname');\nvar newname = flow.get('newname');\n\nif (typeof oldname !== 'undefined' && oldname !== null && oldname !== \"\" && typeof newname !== 'undefined' && newname !== null && newname !== \"\"){\nmsg.payload = (\"Rename Device: \" + oldname + \" to \" + newname);\nreturn msg;\n} else {\nmsg.payload = \"Enter device to rename\";\nreturn msg;\n}\n","outputs":1,"noerr":0,"x":670,"y":200,"wires":[["2826da46.731886"]]},{"id":"241ead91.463d32","type":"ui_group","z":"","name":"Rename Device","tab":"8a847acd.0763c8","order":6,"disp":true,"width":"6","collapse":false},{"id":"8a847acd.0763c8","type":"ui_tab","z":"","name":"Zigbee2MQTT Admin Panel","icon":"dashboard"},{"id":"d2be8f77.7326a","type":"subflow:e084a6a.4631f58","z":"7fbc8cf2.96adb4","name":"","x":120,"y":120,"wires":[]},{"id":"12b79f03.54ddc1","type":"subflow:8bff0e3.fceb9f","z":"7fbc8cf2.96adb4","name":"","x":100,"y":80,"wires":[]},{"id":"bbc5a6f7.dde758","type":"subflow:321dbafd.bfadd6","z":"7fbc8cf2.96adb4","name":"","x":120,"y":160,"wires":[]},{"id":"2a059d07.c5db22","type":"comment","z":"7fbc8cf2.96adb4","name":"Function","info":"","x":100,"y":40,"wires":[]},{"id":"c6a120ae.fc064","type":"subflow:4b20a347.6179ec","z":"7fbc8cf2.96adb4","name":"","x":110,"y":200,"wires":[]},{"id":"9748fef8.41217","type":"subflow:745da55.b69b05c","z":"7fbc8cf2.96adb4","name":"","x":90,"y":240,"wires":[]},{"id":"b8612dd3.59558","type":"subflow:ef334060.da584","z":"7fbc8cf2.96adb4","name":"","x":90,"y":280,"wires":[]},{"id":"48f768d0.746138","type":"comment","z":"7fbc8cf2.96adb4","name":"Other","info":"","x":350,"y":40,"wires":[]},{"id":"ea0eb635.470828","type":"subflow:c2287cf1.f1006","z":"7fbc8cf2.96adb4","name":"","x":390,"y":80,"wires":[]},{"id":"1651116a.3aec8f","type":"subflow:1d7f96d0.a5ef29","z":"7fbc8cf2.96adb4","name":"","x":370,"y":140,"wires":[]}]