Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.77k stars 1.64k forks source link

Graphviz payload can't be processed even by the recommended webgraphviz.com on the wiki #23447

Closed Lovasz-Akos closed 1 month ago

Lovasz-Akos commented 1 month ago

What happened?

Trying to extract the network map over mqtt replies an odd format of the map that standard graphviz processors can't handle afaik

What did you expect to happen?

I thought it would be a copypaste of the respone payload (obviously the graph data part, not the whole payload)

How to reproduce it (minimal and precise)

publish to zigbee2mqtt/bridge/request/networkmap with payload {"type": "graphviz","routes": true} subscribe to zigbee2mqtt/bridge/response/networkmap

Zigbee2MQTT version

1.39.0

Adapter firmware version

7.4.3 [GA]

Adapter

Sonoff Zigbee 3.0 USB Dongle Plus with new ember driver and fw

Setup

HomeAssistant addon, on an Odroid H3+

Debug log

the whole payload for the response is

{
    "data": {
        "routes": true,
        "type": "graphviz",
        "value": "digraph G {\nnode[shape=record];\n  \"0xe0798dfffed3663c\" [style=\"bold, filled\", fillcolor=\"#e04e5d\", fontcolor=\"#ffffff\", label=\"{Coordinator|0xe0798dfffed3663c (0x0000)|0 seconds ago}\"];\n  \"0xe0798dfffed3663c\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"69\"]\n  \"0xe0798dfffed3663c\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"88\"]\n  \"0xe0798dfffed3663c\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"154\"]\n  \"0xa4c138c1633b4ddb\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Desk Lamp|0xa4c138c1633b4ddb (0xb416)failed: lqi,routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|12 hours, 24 minutes ago}\"];\n  \"0xa4c138c1633b4ddb\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n  \"0xa4c138c1633b4ddb\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n  \"0xa4c138c1633b4ddb\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n  \"0xa4c138521633a776\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Air Refresher|0xa4c138521633a776 (0x2509)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|20 seconds ago}\"];\n  \"0xa4c138521633a776\" -> \"0xe0798dfffed3663c\" [penwidth=2, weight=1, color=\"#009900\", label=\"152 (routes: 0xf908,0xe217)\"]\n  \"0xa4c138521633a776\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"27\"]\n  \"0xa4c138521633a776\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"75\"]\n  \"0xa4c1380315a324bd\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bathroom Leak|0xa4c1380315a324bd (0x4926)|Tuya Water leak detector (TS0207_water_leak_detector)|2 hours, 39 minutes ago}\"];\n  \"0xa4c1380315a324bd\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"30\"]\n  \"0xa4c1384584ca0f0c\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Kitchen Leak|0xa4c1384584ca0f0c (0xe217)|Tuya Water leak detector (TS0207_water_leak_detector)|3 hours, 32 minutes ago}\"];\n  \"0xa4c1384584ca0f0c\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"69\"]\n  \"0x04cd15fffe6b30cb\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bedroom Motion|0x04cd15fffe6b30cb (0x81c4)|Tuya PIR sensor (RH3040)|2 hours, 34 minutes ago}\"];\n  \"0x04cd15fffe6b30cb\" -> \"0xe0798dfffed3663c\" [penwidth=1, weight=0, color=\"#994444\", label=\"200\"]\n  \"0x04cd15fffe69092c\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Living Room Motion|0x04cd15fffe69092c (0x1fad)|Tuya PIR sensor (RH3040)|1 hour, 42 minutes ago}\"];\n  \"0x04cd15fffe69092c\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"88\"]\n  \"0xbc33acfffefc6669\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Living Room Temp|0xbc33acfffefc6669 (0x2c24)|Tuya Temperature & humidity sensor (TT001ZAV20)|24 seconds ago}\"];\n  \"0xbc33acfffefc6669\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"100\"]\n  \"0x60a423fffe3c8b22\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bathroom Temp|0x60a423fffe3c8b22 (0x4c86)|Tuya Temperature & humidity sensor (TT001ZAV20)|6 minutes, 44 seconds ago}\"];\n  \"0x60a423fffe3c8b22\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"103\"]\n  \"0xa4c138c66bac1183\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Night Light|0xa4c138c66bac1183 (0xea2b)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|21 seconds ago}\"];\n  \"0xa4c138c66bac1183\" -> \"0xe0798dfffed3663c\" [penwidth=2, weight=1, color=\"#009900\", label=\"177 (routes: 0xf65f)\"]\n  \"0xa4c138c66bac1183\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"27\"]\n  \"0xa4c138c66bac1183\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"85\"]\n  \"0xa4c13849e4f04d8d\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Entrance Button|0xa4c13849e4f04d8d (0xf908)|Tuya Button scene switch (SH-SC07)|1 hour, 41 minutes ago}\"];\n  \"0xa4c13849e4f04d8d\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"69\"]\n  \"0xa4c138723ef64d1f\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Server Plug|0xa4c138723ef64d1f (0xb1a2)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|1 minute, 14 seconds ago}\"];\n  \"0xa4c138723ef64d1f\" -> \"0xe0798dfffed3663c\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"255\"]\n  \"0xa4c138723ef64d1f\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"69\"]\n  \"0xa4c138723ef64d1f\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"81\"]\n  \"0xa4c138c542725729\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Desk Button|0xa4c138c542725729 (0xf65f)|Tuya Button scene switch (SH-SC07)|1 minute, 40 seconds ago}\"];\n  \"0xa4c138c542725729\" -> \"0xa4c138c66bac1183\" [penwidth=1, weight=0, color=\"#994444\", label=\"145\"]\n  \"0xa4c138f2b3ed5881\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Fan|0xa4c138f2b3ed5881 (0xf711)failed: lqi,routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|1 week, 5 days ago}\"];\n  \"0xa4c138f2b3ed5881\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n  \"0xa4c138f2b3ed5881\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n  \"0xbc33acfffefbc3b2\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Outside Temp|0xbc33acfffefbc3b2 (0x0d7f)|Tuya Temperature & humidity sensor (TT001ZAV20)|18 minutes, 33 seconds ago}\"];\n  \"0xbc33acfffefbc3b2\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"88\"]\n  \"0x14b457fffedeeb12\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bedroom Temp|0x14b457fffedeeb12 (0x3590)|Tuya Temperature & humidity sensor (TT001ZAV20)|4 minutes, 30 seconds ago}\"];\n  \"0x14b457fffedeeb12\" -> \"0xa4c138723ef64d1f\" [penwidth=1, weight=0, color=\"#994444\", label=\"188\"]\n}"
    },
    "status": "ok"
}

Pasting the data to webgraphviz.com results in: Error: :1: syntax error near line 1 context: digraph G >>> {\ <<< nnode[shape=record];\n \"0xe0798dfffed3663c\" [style=\"bold, filled\", fillcolor=\"#e04e5d\", fontcolor=\"#ffffff\", label=\"{Coordinator|0xe0798dfffed3663c (0x0000)|0 seconds ago}\"];\n \"0xe0798dfffed3663c\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"69\"]\n \"0xe0798dfffed3663c\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"88\"]\n \"0xe0798dfffed3663c\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"154\"]\n \"0xa4c138c1633b4ddb\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Desk Lamp|0xa4c138c1633b4ddb (0xb416)failed: lqi,routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|12 hours, 24 minutes ago}\"];\n \"0xa4c138c1633b4ddb\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n \"0xa4c138c1633b4ddb\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n \"0xa4c138c1633b4ddb\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n \"0xa4c138521633a776\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Air Refresher|0xa4c138521633a776 (0x2509)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|20 seconds ago}\"];\n \"0xa4c138521633a776\" -> \"0xe0798dfffed3663c\" [penwidth=2, weight=1, color=\"#009900\", label=\"152 (routes: 0xf908,0xe217)\"]\n \"0xa4c138521633a776\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"27\"]\n \"0xa4c138521633a776\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"75\"]\n \"0xa4c1380315a324bd\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bathroom Leak|0xa4c1380315a324bd (0x4926)|Tuya Water leak detector (TS0207_water_leak_detector)|2 hours, 39 minutes ago}\"];\n \"0xa4c1380315a324bd\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"30\"]\n \"0xa4c1384584ca0f0c\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Kitchen Leak|0xa4c1384584ca0f0c (0xe217)|Tuya Water leak detector (TS0207_water_leak_detector)|3 hours, 32 minutes ago}\"];\n \"0xa4c1384584ca0f0c\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"69\"]\n \"0x04cd15fffe6b30cb\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bedroom Motion|0x04cd15fffe6b30cb (0x81c4)|Tuya PIR sensor (RH3040)|2 hours, 34 minutes ago}\"];\n \"0x04cd15fffe6b30cb\" -> \"0xe0798dfffed3663c\" [penwidth=1, weight=0, color=\"#994444\", label=\"200\"]\n \"0x04cd15fffe69092c\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Living Room Motion|0x04cd15fffe69092c (0x1fad)|Tuya PIR sensor (RH3040)|1 hour, 42 minutes ago}\"];\n \"0x04cd15fffe69092c\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"88\"]\n \"0xbc33acfffefc6669\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Living Room Temp|0xbc33acfffefc6669 (0x2c24)|Tuya Temperature & humidity sensor (TT001ZAV20)|24 seconds ago}\"];\n \"0xbc33acfffefc6669\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"100\"]\n \"0x60a423fffe3c8b22\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bathroom Temp|0x60a423fffe3c8b22 (0x4c86)|Tuya Temperature & humidity sensor (TT001ZAV20)|6 minutes, 44 seconds ago}\"];\n \"0x60a423fffe3c8b22\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"103\"]\n \"0xa4c138c66bac1183\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Night Light|0xa4c138c66bac1183 (0xea2b)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|21 seconds ago}\"];\n \"0xa4c138c66bac1183\" -> \"0xe0798dfffed3663c\" [penwidth=2, weight=1, color=\"#009900\", label=\"177 (routes: 0xf65f)\"]\n \"0xa4c138c66bac1183\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"27\"]\n \"0xa4c138c66bac1183\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"85\"]\n \"0xa4c13849e4f04d8d\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Entrance Button|0xa4c13849e4f04d8d (0xf908)|Tuya Button scene switch (SH-SC07)|1 hour, 41 minutes ago}\"];\n \"0xa4c13849e4f04d8d\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"69\"]\n \"0xa4c138723ef64d1f\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Server Plug|0xa4c138723ef64d1f (0xb1a2)failed: routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|1 minute, 14 seconds ago}\"];\n \"0xa4c138723ef64d1f\" -> \"0xe0798dfffed3663c\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"255\"]\n \"0xa4c138723ef64d1f\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"69\"]\n \"0xa4c138723ef64d1f\" -> \"0xa4c138c66bac1183\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"81\"]\n \"0xa4c138c542725729\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Desk Button|0xa4c138c542725729 (0xf65f)|Tuya Button scene switch (SH-SC07)|1 minute, 40 seconds ago}\"];\n \"0xa4c138c542725729\" -> \"0xa4c138c66bac1183\" [penwidth=1, weight=0, color=\"#994444\", label=\"145\"]\n \"0xa4c138f2b3ed5881\" [style=\"rounded, filled\", fillcolor=\"#4ea3e0\", fontcolor=\"#ffffff\", label=\"{Fan|0xa4c138f2b3ed5881 (0xf711)failed: lqi,routingTable|Moes Smart plug (with power monitoring) (MOES_plug)|1 week, 5 days ago}\"];\n \"0xa4c138f2b3ed5881\" -> \"0xa4c138521633a776\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n \"0xa4c138f2b3ed5881\" -> \"0xa4c138723ef64d1f\" [penwidth=0.5, weight=0, color=\"#994444\", label=\"0\"]\n \"0xbc33acfffefbc3b2\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Outside Temp|0xbc33acfffefbc3b2 (0x0d7f)|Tuya Temperature & humidity sensor (TT001ZAV20)|18 minutes, 33 seconds ago}\"];\n \"0xbc33acfffefbc3b2\" -> \"0xa4c138521633a776\" [penwidth=1, weight=0, color=\"#994444\", label=\"88\"]\n \"0x14b457fffedeeb12\" [style=\"rounded, dashed, filled\", fillcolor=\"#fff8ce\", fontcolor=\"#000000\", label=\"{Bedroom Temp|0x14b457fffedeeb12 (0x3590)|Tuya Temperature & humidity sensor (TT001ZAV20)|4 minutes, 30 seconds ago}\"];\n \"0x14b457fffedeeb12\" -> \"0xa4c138723ef64d1f\" [penwidth=1, weight=0, color=\"#994444\", label=\"188\"]\n} Warning: :1: string ran past end of line

Lovasz-Akos commented 1 month ago

ok I see the issue is with the escaping being too heavy, so in theory if I sanitize it enough I could use it