Zigbee2mqtt admin (improved and reordered)
This is a complete dashboard for controlling zigbee2mqtt and it is just a new version of this dashboard.
- Restructured all nodes (no overlap)
- Fixed some json parsing
- Disable auto refresh (this makes my logs go crazy)
- Refresh devices on demand
- Single output that needs to be connected to you mqtt server.
In the top right of this flow there is a single link out
that you need to connect to a link in
which is connected to mqtt out
Be sure to install the following packages before using:
- node-red-dashboard for the actual dashboard
- node-red-node-ui-list for the "list" support in the dashboard.
[{"id":"41fdb4e0.4b258c","type":"tab","label":"Z2M Admin","disabled":false,"info":""},{"id":"f5275f69.23b2d","type":"function","z":"41fdb4e0.4b258c","name":"Format Data","func":"var groupname = flow.get('groupname');\nvar device = flow.get('device');\n\nif (typeof groupname !== undefined && typeof device !== undefined) {\n var action = \"Adding \";\n var what = \" to group \";\n if(msg.payload == \"remove\") {\n action = \"Removing \";\n what = \" from group \";\n }\nvar msg1 = { payload: device, topic: \"zigbee2mqtt/bridge/group/\" + groupname + \"/\" + msg.payload};\nvar msg2 = { payload: action + \" \" + device + what + groupname };\n\nreturn [msg1, msg2];\n}","outputs":2,"noerr":0,"x":790,"y":1760,"wires":[["1c0a7d00.95fb23"],["86d537b.43baac8"]]},{"id":"4f805456.8bc9e4","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"fc7fb74b.bfd778","order":9,"width":"3","height":"1","passthru":false,"label":"Add to group","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Add","payloadType":"str","topic":"","x":130,"y":1740,"wires":[["ab636a61.91a49"]]},{"id":"86d537b.43baac8","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":970,"y":1780,"wires":[]},{"id":"7ed509e2.18189","type":"comment","z":"41fdb4e0.4b258c","name":"Group management","info":"","x":130,"y":1320,"wires":[]},{"id":"b690b2b3.713848","type":"function","z":"41fdb4e0.4b258c","name":"Format Data","func":"var srcdev = flow.get('device');\nvar bindtarget = flow.get('bindtarget');\n\nif (typeof srcdev !== undefined && typeof bindtarget !== undefined) {\n msg1 = { 'payload': bindtarget, 'topic': 'zigbee2mqtt/bridge/' + msg.payload + '/' + srcdev};\n msg2 = { 'payload': msg.payload + ' ' + srcdev + ' to target ' + bindtarget };\n\n return [msg1, msg2];\n}","outputs":2,"noerr":0,"x":790,"y":2100,"wires":[["c338544c.714d"],["7ea2f5d3.20d44c"]]},{"id":"ce4d745d.0750a","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"fc7fb74b.bfd778","order":13,"width":"3","height":"1","passthru":false,"label":"Bind device","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Bind","payloadType":"str","topic":"","x":130,"y":2080,"wires":[["2d9d9926.f54d26"]]},{"id":"f5f7a118.fa2078","type":"mqtt in","z":"41fdb4e0.4b258c","name":"","topic":"zigbee2mqtt/#","qos":"2","datatype":"utf8","broker":"aa5944c2.55c4b8","x":120,"y":100,"wires":[["4027404b.fdb2c"]]},{"id":"d7af9583.d70b6","type":"switch","z":"41fdb4e0.4b258c","name":"log type","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"devices","vt":"str"},{"t":"eq","v":"groups","vt":"str"},{"t":"eq","v":"zigbee_publish_error","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":500,"y":500,"wires":[["4fa37390.262b2c"],["11f61558.7117a3"],["c9ad14d7.25efe"],["a98cc9fd.3050e"]]},{"id":"67905cdd.90a28c","type":"json","z":"41fdb4e0.4b258c","name":"","property":"payload","action":"","pretty":false,"x":290,"y":500,"wires":[["d7af9583.d70b6"]]},{"id":"4fa37390.262b2c","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M LOG DEVICELIST","links":["535550d7.f0f13","fd242a1.1c20358"],"x":675,"y":420,"wires":[]},{"id":"5a6561ed.4874a","type":"function","z":"41fdb4e0.4b258c","name":"Reformat for list","func":"const imgBase = 'https://www.zigbee2mqtt.io/images/devices/'\n\nnewPayload = msg.payload.message\n .filter(d => d.type !== 'Coordinator')\n .map(d => {\n return {\n title: d.friendly_name,\n description: `${d.model} (${d.ieeeAddr})`,\n icon: `${imgBase}${d.model.replace(new RegExp('/', 'g'), '-')}.jpg`\n }\n })\n .sort((a, b) => (a.title > b.title) ? 1 : (a.title === b.title) ? ((a.title > b.title) ? 1 : -1) : -1)\n\nmsg.payload=newPayload;\nreturn msg;\n","outputs":1,"noerr":0,"x":180,"y":800,"wires":[["e1809c57.4081a8"]]},{"id":"535550d7.f0f13","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M DEV LIST INPUT","links":["4fa37390.262b2c"],"x":55,"y":780,"wires":[["5a6561ed.4874a","659677d1.4cdad"]]},{"id":"e1809c57.4081a8","type":"ui_list","z":"41fdb4e0.4b258c","group":"85a3098.e2ae378","name":"Devices","order":1,"width":"6","height":"11","lineType":"three","actionType":"click","allowHTML":true,"outputs":1,"x":360,"y":800,"wires":[["e3c60cf1.53055"]]},{"id":"e3c60cf1.53055","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"device","pt":"flow","to":"payload.title","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":800,"wires":[["c6d12036.581398","b711e16b.68ace8","a620fe13.ee9468"]]},{"id":"195beec1.da8d31","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M GENERIC MQTT OUT","links":["1c0a7d00.95fb23","458d2db0.4f1c14","60280214.c7cba4","9e63ab1b.3a9d98","c338544c.714d","31060d6e.f0e2c2","b88c6d7c.ac159","57bd2c36.530b44"],"x":55,"y":160,"wires":[["f3fa5edb.ba19f"]]},{"id":"1c0a7d00.95fb23","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M GROUP BIND OUT","links":["195beec1.da8d31"],"x":895,"y":1740,"wires":[]},{"id":"659677d1.4cdad","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"devices","pt":"flow","to":"payload.message","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":760,"wires":[[]]},{"id":"c6d12036.581398","type":"function","z":"41fdb4e0.4b258c","name":"Lookup device details","func":"devices = flow.get('devices');\n\ndevice = devices.find(d => d.friendly_name === msg.payload.title)\nif(device) {\n flow.set('seldevice_details', device);\n msg.payload = device;\n return msg;\n}\n\nmsg.payload.friendly_name='unknown';\nreturn msg;\n","outputs":1,"noerr":0,"x":760,"y":800,"wires":[["abe53e96.55fe5"]]},{"id":"eaf3ae0f.0bda78","type":"function","z":"41fdb4e0.4b258c","name":"Reformat for dropdown","func":"newPayload = msg.payload.message\n .map(d => d.friendly_name)\n .sort();\n\nnewMsg = {'payload': flow.get('bindtarget'), 'options': newPayload};\n\nreturn newMsg;\n","outputs":1,"noerr":0,"x":210,"y":2020,"wires":[["3c121965.fccfee"]]},{"id":"fd242a1.1c20358","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M BIND LIST INPUT","links":["4fa37390.262b2c"],"x":55,"y":2020,"wires":[["eaf3ae0f.0bda78"]]},{"id":"3c121965.fccfee","type":"ui_dropdown","z":"41fdb4e0.4b258c","name":"","label":"Target device","tooltip":"","place":"Select target device","group":"fc7fb74b.bfd778","order":12,"width":"6","height":"1","passthru":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":450,"y":2020,"wires":[["3bab7523.e1d58a"]]},{"id":"3bab7523.e1d58a","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"bindtarget","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":2020,"wires":[[]]},{"id":"acae2f37.f801d8","type":"inject","z":"41fdb4e0.4b258c","name":"","topic":"","payload":"","payloadType":"date","repeat":"6","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":1000,"wires":[["9ff5781a.c2949"]]},{"id":"4087cdbd.94accc","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"bridgestate","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":460,"wires":[[]]},{"id":"2d97345d.089a2c","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"fc7fb74b.bfd778","order":10,"width":"3","height":"1","passthru":false,"label":"Remove from group","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Remove","payloadType":"str","topic":"","x":160,"y":1780,"wires":[["7ce4d057.d3e6a8"]]},{"id":"ba22ba9.21386c8","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"fc7fb74b.bfd778","order":14,"width":"3","height":"1","passthru":false,"label":"Unbind device","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Unbind","payloadType":"str","topic":"","x":140,"y":2120,"wires":[["e0fadda3.b2cd48"]]},{"id":"ab636a61.91a49","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> in group <b>{{flow.groupname}}</b>?","output":"str","x":340,"y":1740,"wires":[["d33d1a31.1d55f8"]]},{"id":"d33d1a31.1d55f8","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"add","cancel":"cancel","topic":"Add to group","name":"","x":490,"y":1740,"wires":[["5931d490.1f662c"]]},{"id":"5931d490.1f662c","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"add","vt":"str"},{"t":"eq","v":"remove","vt":"str"},{"t":"eq","v":"cancel","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":630,"y":1760,"wires":[["f5275f69.23b2d"],["f5275f69.23b2d"],[]]},{"id":"7ce4d057.d3e6a8","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> in group <b>{{flow.groupname}}</b>?","output":"str","x":340,"y":1780,"wires":[["dd487520.42765"]]},{"id":"dd487520.42765","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"remove","cancel":"cancel","topic":"Remove from group","name":"","x":490,"y":1780,"wires":[["5931d490.1f662c"]]},{"id":"2d9d9926.f54d26","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> to <b>{{flow.bindtarget}}</b>?","output":"str","x":300,"y":2080,"wires":[["e135a791.af33f8"]]},{"id":"e135a791.af33f8","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"bind","cancel":"cancel","topic":"Bind device","name":"","x":450,"y":2080,"wires":[["e7a99026.195b18"]]},{"id":"e0fadda3.b2cd48","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> from <b>{{flow.bindtarget}}</b>?","output":"str","x":300,"y":2120,"wires":[["f9228780.e6137"]]},{"id":"f9228780.e6137","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"unbind","cancel":"cancel","topic":"Unbind device","name":"","x":450,"y":2120,"wires":[["e7a99026.195b18"]]},{"id":"e7a99026.195b18","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"bind","vt":"str"},{"t":"eq","v":"unbind","vt":"str"},{"t":"eq","v":"cancel","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":630,"y":2100,"wires":[["b690b2b3.713848"],["b690b2b3.713848"],[]]},{"id":"2d021cee.f5ee34","type":"ui_text_input","z":"41fdb4e0.4b258c","name":"","label":"New device name","tooltip":"","group":"fc7fb74b.bfd778","order":5,"width":"6","height":"1","passthru":true,"mode":"text","delay":"100","topic":"","x":150,"y":1700,"wires":[["8bf90e2f.f5001"]]},{"id":"32c9e791.3502d","type":"comment","z":"41fdb4e0.4b258c","name":"Device management","info":"","x":130,"y":1580,"wires":[]},{"id":"8bf90e2f.f5001","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"newdevicename","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":1700,"wires":[[]]},{"id":"7feaedbd.c903fc","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"fc7fb74b.bfd778","order":6,"width":"6","height":"1","passthru":false,"label":"Rename device","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Rename","payloadType":"str","topic":"","x":140,"y":1920,"wires":[["dab03dde.d96c48"]]},{"id":"dab03dde.d96c48","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> to <b>{{flow.newdevicename}}</b>?","output":"str","x":340,"y":1920,"wires":[["bc4f0be6.ae2238"]]},{"id":"bc4f0be6.ae2238","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"rename","cancel":"cancel","topic":"Rename device","name":"","x":490,"y":1920,"wires":[["710ceea8.7b5788"]]},{"id":"710ceea8.7b5788","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"rename","vt":"str"},{"t":"eq","v":"cancel","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":630,"y":1920,"wires":[["de09cd5b.91244"],[]]},{"id":"de09cd5b.91244","type":"function","z":"41fdb4e0.4b258c","name":"Format Data","func":"var oldname = flow.get('device');\nvar newname = flow.get('newdevicename');\n\nif (typeof oldname !== undefined && typeof newname !== undefined) {\n msg1 = { 'payload': {\"old\": oldname, \"new\": newname}, 'topic': 'zigbee2mqtt/bridge/config/rename'};\n msg2 = { 'payload': msg.payload + ' ' + oldname + ' to ' + newname };\n\n return [msg1, msg2];\n}","outputs":2,"noerr":0,"x":790,"y":1920,"wires":[["31060d6e.f0e2c2"],["1945309d.7844ef"]]},{"id":"1945309d.7844ef","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":970,"y":1940,"wires":[]},{"id":"d76da88e.0f55c","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"topic","propertyType":"msg","rules":[{"t":"regex","v":".*/bridge/state","vt":"str","case":false},{"t":"regex","v":".*/bridge/log","vt":"str","case":false},{"t":"regex","v":".*/bridge/config$","vt":"str","case":false},{"t":"regex","v":".*/networkmap/graphviz$","vt":"str","case":false},{"t":"regex","v":".*/bridge/config/.*","vt":"str","case":false},{"t":"regex","v":"^(?!.*get$|.*set$).*$","vt":"str","case":false}],"checkall":"false","repair":false,"outputs":6,"x":150,"y":540,"wires":[["4087cdbd.94accc"],["67905cdd.90a28c"],["82626ea6.05b9d"],["f80b3a2d.06f5f"],[],["e4688ac3.153158"]]},{"id":"82626ea6.05b9d","type":"json","z":"41fdb4e0.4b258c","name":"","property":"payload","action":"","pretty":false,"x":290,"y":540,"wires":[["66d8cca0.b0061c"]]},{"id":"66d8cca0.b0061c","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M BRIDGE CONFIG INPUT","links":["b7e64bb5.4d57d8"],"x":375,"y":540,"wires":[]},{"id":"36c6c323.c0c554","type":"ui_switch","z":"41fdb4e0.4b258c","name":"","label":"Permit join","tooltip":"","group":"4be86d0a.f91dc4","order":1,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"zigbee2mqtt/bridge/config/permit_join","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":510,"y":1140,"wires":[["60280214.c7cba4"]]},{"id":"809e7af2.e28c2","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"move","p":"payload.permit_join","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":1140,"wires":[["36c6c323.c0c554"]]},{"id":"b7e64bb5.4d57d8","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M BRIDGE CONFIG","links":["66d8cca0.b0061c"],"x":55,"y":1140,"wires":[["809e7af2.e28c2","11309fef.567ad8","3f14b9d3.d6362e","3910934d.002c2c","80879a01.1d00e8"]]},{"id":"ac53ccca.c67388","type":"ui_dropdown","z":"41fdb4e0.4b258c","name":"","label":"Log level","tooltip":"","place":"Select log level","group":"4be86d0a.f91dc4","order":3,"width":0,"height":0,"passthru":false,"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":"zigbee2mqtt/bridge/config/log_level","x":500,"y":1180,"wires":[["60280214.c7cba4"]]},{"id":"60280214.c7cba4","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M BRIDGE CONFIG OUT","links":["195beec1.da8d31"],"x":675,"y":1160,"wires":[]},{"id":"11309fef.567ad8","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"move","p":"payload.log_level","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":1180,"wires":[["ac53ccca.c67388"]]},{"id":"a98cc9fd.3050e","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M NOTIFICATIONS OUT","links":["e65f5610.9dcce8"],"x":675,"y":540,"wires":[]},{"id":"8ff859a6.d65f48","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"3","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":950,"y":2320,"wires":[]},{"id":"e65f5610.9dcce8","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M NOTIFICATIONS INPUT","links":["a98cc9fd.3050e"],"x":55,"y":2360,"wires":[["66af630d.72431c"]]},{"id":"31e5409e.f30c48","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.type","tot":"msg"},{"t":"move","p":"payload.message","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":2440,"wires":[["8ff859a6.d65f48"]]},{"id":"62904f90.1b48d","type":"comment","z":"41fdb4e0.4b258c","name":"Bridge status","info":"","x":110,"y":960,"wires":[]},{"id":"aa5a37a2.a523a8","type":"ui_button","z":"41fdb4e0.4b258c","name":"remove device","group":"fc7fb74b.bfd778","order":3,"width":"6","height":"1","passthru":false,"label":"Remove device","tooltip":"","color":"","bgcolor":"","icon":"","payload":"remove","payloadType":"str","topic":"","x":140,"y":1660,"wires":[["305d0d7e.f58952"]]},{"id":"305d0d7e.f58952","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}} device <b>{{flow.device}}</b> permanently?","output":"str","x":340,"y":1660,"wires":[["7386fa3f.3ea9dc"]]},{"id":"7386fa3f.3ea9dc","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"remove","cancel":"cancel","topic":"Remove device","name":"","x":490,"y":1660,"wires":[["80b0ef44.777e78"]]},{"id":"80b0ef44.777e78","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"remove","vt":"str"},{"t":"eq","v":"cancel","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":630,"y":1660,"wires":[["f0197ec1.6c4ae"],[]]},{"id":"f0197ec1.6c4ae","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"zigbee2mqtt/bridge/config/remove","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"device","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":1660,"wires":[["b88c6d7c.ac159"]]},{"id":"ec276b65.25ac48","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":5,"width":"0","height":"0","name":"","label":"Status","format":"{{msg.payload.bridgestate}}","layout":"row-left","x":710,"y":1040,"wires":[]},{"id":"be739e68.5f3ff","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":8,"width":"0","height":"0","name":"","label":"Devices","format":"{{msg.payload.numdevices}}","layout":"row-left","x":720,"y":1000,"wires":[]},{"id":"9ff5781a.c2949","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"payload.numdevices","pt":"msg","to":"devices.length","tot":"flow"},{"t":"set","p":"payload.bridgestate","pt":"msg","to":"bridgestate","tot":"flow"},{"t":"set","p":"payload.nwlast","pt":"msg","to":"networkmap_last","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":1000,"wires":[["be739e68.5f3ff","ec276b65.25ac48","64078851.ec82"]]},{"id":"abe53e96.55fe5","type":"function","z":"41fdb4e0.4b258c","name":"Reformat for details","func":"newPayload = [];\n\nnewentry = {\n 'title': msg.payload.friendly_name,\n 'description': 'zigbee2mqtt/...',\n 'icon': 'https://www.zigbee2mqtt.io/images/logo.png'\n};\nnewPayload.push(newentry);\nnewentry = {\n 'title': msg.payload.ieeeAddr,\n 'description': 'NwkAddr: ' + msg.payload.networkAddress + ' / manufId: ' + msg.payload.manufacturerID,\n 'icon_name': 'settings_input_antenna'\n};\nnewPayload.push(newentry);\nnewentry = { \n 'title': msg.payload.model,\n 'description': msg.payload.modelID,\n 'icon': 'https://www.zigbee2mqtt.io/images/devices/' + msg.payload.model.replace(new RegExp('/', 'g'), '-') + '.jpg'\n};\nnewPayload.push(newentry);\nnewentry = { \n 'title': msg.payload.manufacturerName,\n 'description': 'HW: ' + msg.payload.hardwareVersion + ' / SW: ' + msg.payload.softwareBuildID,\n 'icon_name': 'bookmark'\n};\nnewPayload.push(newentry);\nvar type_icon = msg.payload.type=='Router' ? 'device_hub' : 'input';\nnewentry = {\n 'title': msg.payload.type,\n 'description': 'Pwr: ' + msg.payload.powerSource,\n 'icon_name': type_icon\n};\nnewPayload.push(newentry);\n\nmsg.payload=newPayload;\nreturn msg;\n","outputs":1,"noerr":0,"x":970,"y":800,"wires":[["1e152c5a.b40714"]]},{"id":"f80b3a2d.06f5f","type":"change","z":"41fdb4e0.4b258c","name":"save networkmap","rules":[{"t":"set","p":"networkmap","pt":"flow","to":"payload","tot":"msg"},{"t":"set","p":"networkmap_last","pt":"flow","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":580,"wires":[["7c847660.da98b8"]]},{"id":"12fe3f5b.089cf1","type":"http in","z":"41fdb4e0.4b258c","name":"","url":"/z2mpanel/networkmap","method":"get","upload":false,"swaggerDoc":"","x":180,"y":2740,"wires":[["2dba5eef.d21b32"]]},{"id":"2dba5eef.d21b32","type":"template","z":"41fdb4e0.4b258c","name":"Render page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n <meta charset=\"utf-8\">\n <title>Network topology</title>\n <style>\n #graphviz_svg_div svg {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n }\n \n </style>\n </head>\n <body>\n <div id=\"graphviz_svg_div\"></div>\n <script language=\"javascript\" type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/[email protected]/viz.js\"></script>\n <script language=\"javascript\" type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/[email protected]/full.render.js\"></script>\n <script language=\"javascript\" type=\"text/javascript\" src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/svg-pan-zoom.min.js\"></script>\n <script type=\"bogus\" id=\"graphviz_input\">\n {{{flow.networkmap}}}\n </script>\n <script language=\"javascript\" type=\"text/javascript\">\n document.addEventListener(\"DOMContentLoaded\", function(event) {\n var viz = new Viz();\n var svg = document.getElementById(\"graphviz_input\").innerHTML;\n viz.renderSVGElement(svg, {engine: \"{{{flow.nwrenderengine}}}\"})\n .then(function(element) {\n document.getElementById(\"graphviz_svg_div\").appendChild(element);\n panZoom = svgPanZoom(element, {\n zoomEnabled: true,\n controlIconsEnabled: true,\n fit: true,\n center: true,\n minZoom: 0.1\n });\n\n element.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 //var svg = Viz(document.getElementById(\"graphviz_input\").innerHTML, \"svg\", {render: \"circo\"});\n //document.getElementById(\"graphviz_svg_div\").innerHTML = svg;\n });\n </script>\n </body>\n</html>","output":"str","x":410,"y":2740,"wires":[["d03c5ccf.fea4e"]]},{"id":"d03c5ccf.fea4e","type":"http response","z":"41fdb4e0.4b258c","name":"","statusCode":"","headers":{},"x":590,"y":2740,"wires":[]},{"id":"28a453ca.abbc54","type":"ui_template","z":"41fdb4e0.4b258c","group":"708ab4d2.19470c","name":"iframe nw map","order":0,"width":"27","height":"11","format":"<iframe frameborder=\"0\" width=\"100%\" height=\"100%\" src=\"/z2mpanel/networkmap\"></iframe>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":140,"y":2700,"wires":[[]]},{"id":"1e152c5a.b40714","type":"ui_list","z":"41fdb4e0.4b258c","group":"bb293343.5597b8","name":"Selected device","order":1,"width":"6","height":"7","lineType":"three","actionType":"none","allowHTML":true,"outputs":1,"x":1160,"y":800,"wires":[[]]},{"id":"534ea564.239fa4","type":"comment","z":"41fdb4e0.4b258c","name":"Device list & selected device","info":"","x":160,"y":720,"wires":[]},{"id":"612985c1.2a36ec","type":"inject","z":"41fdb4e0.4b258c","name":"Create network map","topic":"zigbee2mqtt/bridge/networkmap","payload":"graphviz","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":"10","x":150,"y":200,"wires":[["f3fa5edb.ba19f"]]},{"id":"9b44073c.ed769","type":"inject","z":"41fdb4e0.4b258c","name":"Request Device List","topic":"zigbee2mqtt/bridge/config/devices/get","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":160,"y":280,"wires":[["55c8e7b4.aa60d"]]},{"id":"9b4923b8.ca11b","type":"ui_button","z":"41fdb4e0.4b258c","name":"Create nw map","group":"4be86d0a.f91dc4","order":13,"width":"1","height":"1","passthru":false,"label":"","tooltip":"Refresh network map","color":"","bgcolor":"","icon":"refresh","payload":"graphviz","payloadType":"str","topic":"zigbee2mqtt/bridge/networkmap","x":140,"y":2560,"wires":[["9e63ab1b.3a9d98"]]},{"id":"9e63ab1b.3a9d98","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M NW MAP GEN","links":["195beec1.da8d31"],"x":375,"y":2560,"wires":[]},{"id":"66af630d.72431c","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"pairing","vt":"str"},{"t":"eq","v":"device_connected","vt":"str"},{"t":"eq","v":"device_removed","vt":"str"},{"t":"istype","v":"object","vt":"object"},{"t":"else"}],"checkall":"false","repair":false,"outputs":5,"x":210,"y":2360,"wires":[["5d22ede4.c93f3c"],["c18513bc.892f58"],["ae91c94c.a324a8"],["adb8e4a.06e6118"],["31e5409e.f30c48"]]},{"id":"5d22ede4.c93f3c","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload.message","propertyType":"msg","rules":[{"t":"eq","v":"connecting with device","vt":"str"},{"t":"eq","v":"device incoming","vt":"str"}],"checkall":"false","repair":false,"outputs":2,"x":450,"y":2260,"wires":[["97091ba0.84c3c8"],["49965272.5928d4"]]},{"id":"97091ba0.84c3c8","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"A device is attempting to pair...","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":2240,"wires":[["8ff859a6.d65f48"]]},{"id":"49965272.5928d4","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"A device is incoming or repairing...","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":2280,"wires":[["8ff859a6.d65f48"]]},{"id":"c18513bc.892f58","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Device paired successfully: {{msg.payload.message}}","output":"str","x":600,"y":2320,"wires":[["8ff859a6.d65f48"]]},{"id":"ae91c94c.a324a8","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Deviced removed: {{msg.payload.message}}","output":"str","x":600,"y":2360,"wires":[["8ff859a6.d65f48"]]},{"id":"91bfe250.317e58","type":"comment","z":"41fdb4e0.4b258c","name":"Notifications","info":"","x":110,"y":2200,"wires":[]},{"id":"7ea2f5d3.20d44c","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":970,"y":2120,"wires":[]},{"id":"c338544c.714d","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M BINDING OUT","links":["195beec1.da8d31"],"x":895,"y":2080,"wires":[]},{"id":"31060d6e.f0e2c2","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M RENAME OUT","links":["195beec1.da8d31"],"x":895,"y":1900,"wires":[]},{"id":"b88c6d7c.ac159","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M REMOVE OUT","links":["195beec1.da8d31"],"x":895,"y":1660,"wires":[]},{"id":"3eb08a02.49b0c6","type":"comment","z":"41fdb4e0.4b258c","name":"Zigbee2Mqtt Admin Panel","info":"","x":150,"y":40,"wires":[]},{"id":"4428a31f.aaf8cc","type":"comment","z":"41fdb4e0.4b258c","name":"---- Dont change things down here ----","info":"","x":190,"y":400,"wires":[]},{"id":"adb8e4a.06e6118","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload.type.group","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":2400,"wires":[["368e6327.a8ba64"]]},{"id":"368e6327.a8ba64","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Succesfully changed device {{payload.type.device}} in group {{payload.type.group}}","output":"str","x":600,"y":2400,"wires":[["8ff859a6.d65f48"]]},{"id":"17369bfe.bf4f1c","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"3","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":890,"y":520,"wires":[]},{"id":"7c847660.da98b8","type":"debug","z":"41fdb4e0.4b258c","name":"Debug save networkmap","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":730,"y":580,"wires":[]},{"id":"64078851.ec82","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":10,"width":"0","height":"0","name":"","label":"Last created","format":"{{msg.payload.nwlast | date:'dd.MM.yy HH:mm'}}","layout":"row-spread","x":730,"y":960,"wires":[]},{"id":"f9e4d9a8.7f0698","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"4be86d0a.f91dc4","order":12,"width":"5","height":"1","passthru":false,"label":"Show network map","tooltip":"","color":"","bgcolor":"","icon":"","payload":"{\"tab\":\"Z2M Network map\"}","payloadType":"json","topic":"","x":150,"y":2600,"wires":[["7c2c95cd.bde354"]]},{"id":"7c2c95cd.bde354","type":"ui_ui_control","z":"41fdb4e0.4b258c","name":"","x":600,"y":2600,"wires":[[]]},{"id":"b711e16b.68ace8","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M FLOW DEV TRIGGER","links":["f7eaa817.70bfd8","ced9b243.c5dfc","afb0f244.23a25","b3a59840.df7d9"],"x":675,"y":840,"wires":[]},{"id":"1748b1d3.c403c6","type":"inject","z":"41fdb4e0.4b258c","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":840,"wires":[["b711e16b.68ace8"]]},{"id":"c9ad14d7.25efe","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.message}} to device {{payload.meta.entity.friendlyName}}\nOriginal message: {{payload.meta.message}}","output":"str","x":680,"y":500,"wires":[["17369bfe.bf4f1c","ed1d0107.e63168"]]},{"id":"ed1d0107.e63168","type":"link out","z":"41fdb4e0.4b258c","name":"PUBLISH ERROR TO TELEGRAM","links":["34d4fa40.340716","237ac04e.ab42b"],"x":815,"y":480,"wires":[]},{"id":"8bf036c6.73765","type":"inject","z":"41fdb4e0.4b258c","name":"Request Group List","topic":"zigbee2mqtt/bridge/config/groups","payload":"","payloadType":"date","repeat":"5","crontab":"","once":true,"onceDelay":0.1,"x":160,"y":320,"wires":[["55c8e7b4.aa60d"]]},{"id":"11f61558.7117a3","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M LOG GROUPLIST","links":["7ede0202.b35fec","e5c5ae0c.07cd","6e40d738.56117"],"x":675,"y":460,"wires":[]},{"id":"e80199b8.085cf","type":"comment","z":"41fdb4e0.4b258c","name":"Networkmap","info":"","x":110,"y":2520,"wires":[]},{"id":"3a0d5cfe.4c9624","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"groupname","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":1860,"wires":[[]]},{"id":"e5c5ae0c.07cd","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M GROUP UI","links":["11f61558.7117a3"],"x":55,"y":1860,"wires":[["28a468b8.474708"]]},{"id":"28a468b8.474708","type":"function","z":"41fdb4e0.4b258c","name":"Reformat for list","func":"newPayload = [];\nObject.keys(msg.payload.message).forEach(function(key) {\n var msgKey = msg.payload.message[key].friendly_name + \" (ID: \" + key + \")\";\n var msgVar = msg.payload.message[key].friendly_name;\n newentry = '{\"'+msgKey+'\":\" '+ msgVar+'\"}';\n newPayload.push(msg.payload.message[key].friendly_name);\n});\n\nnewMsg = {'payload': flow.get('groupname'), 'options': newPayload}\nreturn newMsg;\n","outputs":1,"noerr":0,"x":240,"y":1860,"wires":[["5dadb91.15d1fc8"]]},{"id":"3f14b9d3.d6362e","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":6,"width":"0","height":"0","name":"","label":"Zigbee2MQTT version","format":"{{msg.payload.version}}","layout":"row-left","x":240,"y":1060,"wires":[]},{"id":"3910934d.002c2c","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":7,"width":"0","height":"0","name":"","label":"Coordinator firmware","format":"{{msg.payload.coordinator_firmware}}","layout":"row-left","x":240,"y":1100,"wires":[]},{"id":"98b139cb.1580c","type":"inject","z":"41fdb4e0.4b258c","name":"Reset CC253x","topic":"zigbee2mqtt/bridge/config/reset","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":240,"wires":[["f3fa5edb.ba19f"]]},{"id":"5dadb91.15d1fc8","type":"ui_dropdown","z":"41fdb4e0.4b258c","name":"Groups","label":"Group","tooltip":"","place":"Select group","group":"fc7fb74b.bfd778","order":8,"width":"6","height":"1","passthru":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":480,"y":1860,"wires":[["3a0d5cfe.4c9624"]]},{"id":"7f0d7d1b.77925c","type":"ui_text_input","z":"41fdb4e0.4b258c","name":"Selected device","label":"Selected device","tooltip":"Select device in device list","group":"fc7fb74b.bfd778","order":2,"width":0,"height":0,"passthru":false,"mode":"text","delay":300,"topic":"","x":420,"y":1620,"wires":[[]]},{"id":"b3a59840.df7d9","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M BIND DEVICE INP","links":["b711e16b.68ace8"],"x":55,"y":1620,"wires":[["252552df.47707e"]]},{"id":"252552df.47707e","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"device","tot":"flow"},{"t":"set","p":"enabled","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":180,"y":1620,"wires":[["7f0d7d1b.77925c"]]},{"id":"10f15096.f2e2a7","type":"ui_toast","z":"41fdb4e0.4b258c","position":"top right","displayTime":"5","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"System Notification","name":"","x":950,"y":1400,"wires":[]},{"id":"9b6ee19e.7eaa2","type":"function","z":"41fdb4e0.4b258c","name":"Format Data","func":"\nif (msg.payload == \"add\") {\n var action = \"Adding \";\n var what = \"group \";\n var cmd = \"add_group\";\n var groupname = flow.get('newgroupname');\n}\nif(msg.payload == \"remove\") {\n action = \"Removing \";\n what = \"group \";\n cmd = \"remove_group\";\n groupname = flow.get('groupname2');\n}\nvar msg1 = { payload: groupname, topic: \"zigbee2mqtt/bridge/config/\" + cmd};\nvar msg2 = { payload: action + what + groupname };\n\nreturn [msg1, msg2];\n","outputs":2,"noerr":0,"x":770,"y":1380,"wires":[["57bd2c36.530b44"],["10f15096.f2e2a7"]]},{"id":"57bd2c36.530b44","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M GROUP BIND OUT","links":["195beec1.da8d31"],"x":875,"y":1360,"wires":[]},{"id":"8d1eb62b.f9b298","type":"switch","z":"41fdb4e0.4b258c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"add","vt":"str"},{"t":"eq","v":"remove","vt":"str"},{"t":"eq","v":"cancel","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":610,"y":1380,"wires":[["9b6ee19e.7eaa2"],["9b6ee19e.7eaa2"],[]]},{"id":"224e867b.49852a","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"add","cancel":"cancel","topic":"Add group","name":"","x":450,"y":1360,"wires":[["8d1eb62b.f9b298"]]},{"id":"412c3cea.054a14","type":"ui_toast","z":"41fdb4e0.4b258c","position":"dialog","displayTime":"3","highlight":"","outputs":1,"ok":"remove","cancel":"cancel","topic":"Remove group","name":"","x":450,"y":1400,"wires":[["8d1eb62b.f9b298"]]},{"id":"61d65565.778b2c","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Add group <b>{{flow.newgroupname}}</b>?","output":"str","x":300,"y":1360,"wires":[["224e867b.49852a"]]},{"id":"9714f536.45a7c","type":"template","z":"41fdb4e0.4b258c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Remove group <b>{{flow.groupname2}}</b>?","output":"str","x":300,"y":1400,"wires":[["412c3cea.054a14"]]},{"id":"3cf4632.f5dc21c","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"63f0b808.3f7a8","order":15,"width":"6","height":"1","passthru":false,"label":"Add group","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Add","payloadType":"str","topic":"","x":130,"y":1360,"wires":[["61d65565.778b2c"]]},{"id":"d3e2314d.b2dff","type":"ui_button","z":"41fdb4e0.4b258c","name":"","group":"63f0b808.3f7a8","order":17,"width":"6","height":"1","passthru":false,"label":"Remove group","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Remove","payloadType":"str","topic":"","x":140,"y":1400,"wires":[["9714f536.45a7c"]]},{"id":"9924d81f.4ebc88","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"groupname2","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1440,"wires":[[]]},{"id":"6e40d738.56117","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M GROUP UI","links":["11f61558.7117a3"],"x":55,"y":1440,"wires":[["e4970101.dd4588"]]},{"id":"e4970101.dd4588","type":"function","z":"41fdb4e0.4b258c","name":"Reformat for list","func":"newPayload = [];\nObject.keys(msg.payload.message).forEach(function(key) {\n var msgKey = msg.payload.message[key].friendly_name + \" (ID: \" + key + \")\";\n var msgVar = msg.payload.message[key].friendly_name;\n newentry = '{\"'+msgKey+'\":\" '+ msgVar+'\"}';\n newPayload.push(msg.payload.message[key].friendly_name);\n});\n\nnewMsg = {'payload': flow.get('groupname2'), 'options': newPayload}\nreturn newMsg;\n","outputs":1,"noerr":0,"x":220,"y":1440,"wires":[["12a893e8.37bbcc"]]},{"id":"12a893e8.37bbcc","type":"ui_dropdown","z":"41fdb4e0.4b258c","name":"Groups","label":"","tooltip":"Selected group","place":"Select group","group":"63f0b808.3f7a8","order":16,"width":"6","height":"1","passthru":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":440,"y":1440,"wires":[["9924d81f.4ebc88"]]},{"id":"b12bbf60.64def","type":"ui_text_input","z":"41fdb4e0.4b258c","name":"","label":"New group name","tooltip":"","group":"63f0b808.3f7a8","order":14,"width":"6","height":"1","passthru":true,"mode":"text","delay":"100","topic":"","x":150,"y":1500,"wires":[["8deaf8ee.261f48"]]},{"id":"8deaf8ee.261f48","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"newgroupname","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":1500,"wires":[[]]},{"id":"4d92b0d9.ac78b","type":"ui_text","z":"41fdb4e0.4b258c","group":"fc7fb74b.bfd778","order":7,"width":"6","height":"1","name":"Group membership","label":"<h3>Device group membership</h3>","format":"","layout":"row-left","x":150,"y":1820,"wires":[]},{"id":"39e8e560.0cd73a","type":"ui_text","z":"41fdb4e0.4b258c","group":"fc7fb74b.bfd778","order":11,"width":"6","height":"1","name":"Bind device label","label":"<h3>Bind device</h3>","format":"","layout":"row-left","x":150,"y":1960,"wires":[]},{"id":"80879a01.1d00e8","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":4,"width":0,"height":0,"name":"bridge status label","label":"<h3>Bridge status</h3>","format":"","layout":"row-left","x":230,"y":1220,"wires":[]},{"id":"98a068fe.253b38","type":"ui_text","z":"41fdb4e0.4b258c","group":"fc7fb74b.bfd778","order":4,"width":0,"height":0,"name":"rename device label","label":"<h3>Rename device</h3>","format":"","layout":"row-left","x":980,"y":1620,"wires":[]},{"id":"180e0569.4542cb","type":"debug","z":"41fdb4e0.4b258c","name":"Debug save last message","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":730,"y":620,"wires":[]},{"id":"fd1ba42c.5dfa3","type":"ui_dropdown","z":"41fdb4e0.4b258c","name":"renderer","label":"Renderer","tooltip":"Graphviz renderer","place":"Select renderer","group":"4be86d0a.f91dc4","order":11,"width":"0","height":"0","passthru":false,"options":[{"label":"Circo","value":"circo","type":"str"},{"label":"Dot","value":"dot","type":"str"},{"label":"Neato","value":"neato","type":"str"},{"label":"Twopi","value":"twopi","type":"str"},{"label":"Fdp","value":"fdp","type":"str"}],"payload":"","topic":"","x":400,"y":2640,"wires":[["32725a3d.bcb4f6"]]},{"id":"32725a3d.bcb4f6","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"nwrenderengine","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":2640,"wires":[[]]},{"id":"28000b45.3c680c","type":"inject","z":"41fdb4e0.4b258c","name":"","topic":"","payload":"nwrenderengine","payloadType":"flow","repeat":"","crontab":"","once":true,"onceDelay":"1","x":160,"y":2640,"wires":[["fd1ba42c.5dfa3"]]},{"id":"7d9b51d.78bddb","type":"ui_text","z":"41fdb4e0.4b258c","group":"4be86d0a.f91dc4","order":9,"width":0,"height":0,"name":"nw map label","label":"<h3>Network map</h3>","format":"","layout":"row-left","x":620,"y":2560,"wires":[]},{"id":"4027404b.fdb2c","type":"link out","z":"41fdb4e0.4b258c","name":"Z2M GENERIC IN","links":["a9c68be3.ca359"],"x":295,"y":100,"wires":[]},{"id":"a9c68be3.ca359","type":"link in","z":"41fdb4e0.4b258c","name":"Z2M INPUT","links":["4027404b.fdb2c"],"x":55,"y":540,"wires":[["d76da88e.0f55c"]]},{"id":"b231b3fa.4127e8","type":"inject","z":"41fdb4e0.4b258c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":490,"y":60,"wires":[["13d08068.1921a8"]]},{"id":"13d08068.1921a8","type":"change","z":"41fdb4e0.4b258c","name":"","rules":[{"t":"set","p":"nwrenderengine","pt":"flow","to":"circo","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":60,"wires":[[]]},{"id":"642155ab.6200ac","type":"function","z":"41fdb4e0.4b258c","name":"Save last msg","func":"lastDevMsgs = flow.get('lastdevmsgs')||{};\n\nlastDevMsgs[msg.topic] = msg.payload;\nflow.set('lastdevmsgs', lastDevMsgs);\n\nreturn msg;","outputs":1,"noerr":0,"x":500,"y":620,"wires":[["180e0569.4542cb"]]},{"id":"a620fe13.ee9468","type":"function","z":"41fdb4e0.4b258c","name":"Lookup device last msg","func":"lastmsgs = flow.get('lastdevmsgs');\n\nentry=lastmsgs[\"zigbee2mqtt/\"+msg.payload.title];\n\nnewPayload = [];\n\nnewentry = {\n 'title': '<h3>Last message</h3>'\n};\nnewPayload.push(newentry);\n\nfor(var prop in entry) {\n newentry = {\n 'title': '<b>' + prop + '</b>: ' + (typeof entry[prop] === 'object' ? JSON.stringify(entry[prop]) : entry[prop] ),\n 'description': entry[prop]\n };\n newPayload.push(newentry);\n}\n\nmsg.payload = newPayload;\nreturn msg;\n","outputs":1,"noerr":0,"x":770,"y":760,"wires":[["9c19f4d.fadc588"]]},{"id":"9c19f4d.fadc588","type":"ui_list","z":"41fdb4e0.4b258c","group":"bb293343.5597b8","name":"Selected device msg","order":2,"width":"6","height":"6","lineType":"one","actionType":"none","allowHTML":true,"outputs":1,"x":1180,"y":760,"wires":[[]]},{"id":"ccd0e450.ac89a8","type":"ui_switch","z":"41fdb4e0.4b258c","name":"refresh_switch","label":"Auto refresh","tooltip":"","group":"b1982a6e.d25db","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":480,"y":100,"wires":[["89207f98.99d0d8"]]},{"id":"89207f98.99d0d8","type":"change","z":"41fdb4e0.4b258c","name":"Save refresh enabled","rules":[{"t":"set","p":"refreshEnabled","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":100,"wires":[[]]},{"id":"55c8e7b4.aa60d","type":"function","z":"41fdb4e0.4b258c","name":"fnc_refresh_enabled_test","func":"if(flow.get('refreshEnabled') === true)\n return msg;\n\nreturn null;","outputs":1,"noerr":0,"x":430,"y":300,"wires":[["f3fa5edb.ba19f"]]},{"id":"f3fa5edb.ba19f","type":"link out","z":"41fdb4e0.4b258c","name":"","links":["212504ad.d93e5c"],"x":675,"y":220,"wires":[]},{"id":"1cd59fc0.7557a8","type":"ui_button","z":"41fdb4e0.4b258c","name":"btn_refresh_devices","group":"b1982a6e.d25db","order":1,"width":0,"height":0,"passthru":false,"label":"Refresh devices","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"zigbee2mqtt/bridge/config/devices/get","x":500,"y":140,"wires":[["f3fa5edb.ba19f"]]},{"id":"e4688ac3.153158","type":"function","z":"41fdb4e0.4b258c","name":"TryParse json","func":"const payload = msg.payload\ntry {\n msg.payload = JSON.parse(payload);\n} catch (err){\n msg.payload = payload\n}\nreturn msg;","outputs":1,"noerr":0,"x":320,"y":620,"wires":[["642155ab.6200ac"]]},{"id":"7b5e8a11.1d5964","type":"comment","z":"41fdb4e0.4b258c","name":"Connect this to MQTT OUT","info":"","x":770,"y":180,"wires":[]},{"id":"fc7fb74b.bfd778","type":"ui_group","z":"","name":"Device management","tab":"483aecca.dda94c","order":3,"disp":true,"width":"6","collapse":false},{"id":"aa5944c2.55c4b8","type":"mqtt-broker","z":"","name":"Docker home automation","broker":"emqx","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"300","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"85a3098.e2ae378","type":"ui_group","z":"","name":"Device list","tab":"483aecca.dda94c","order":1,"disp":true,"width":"6","collapse":false},{"id":"4be86d0a.f91dc4","type":"ui_group","z":"","name":"Bridge configuration","tab":"483aecca.dda94c","order":5,"disp":true,"width":"6","collapse":true},{"id":"708ab4d2.19470c","type":"ui_group","z":"","name":"Network map","tab":"df698bbb.a5a5","order":1,"disp":false,"width":"27","collapse":false},{"id":"bb293343.5597b8","type":"ui_group","z":"","name":"Device details","tab":"483aecca.dda94c","order":2,"disp":true,"width":"6","collapse":false},{"id":"63f0b808.3f7a8","type":"ui_group","z":"","name":"Group configuration","tab":"483aecca.dda94c","order":4,"disp":true,"width":"6","collapse":true},{"id":"b1982a6e.d25db","type":"ui_group","z":"","name":"Dashboard Controls","tab":"483aecca.dda94c","order":6,"disp":true,"width":"6","collapse":false},{"id":"483aecca.dda94c","type":"ui_tab","z":"","name":"Z2M Admin","icon":"dashboard","disabled":false,"hidden":false},{"id":"df698bbb.a5a5","type":"ui_tab","z":"","name":"Z2M Network map","icon":"dashboard","disabled":false,"hidden":true}]