# \[HOW-TO\]\[Pro\]\[Cloud\] - Zigbee Route map (Homey Pro / Homey SHS / Homey Bridge)

**URL:** <https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966>\
**Category:** Tutorials\
**Tags:** zigbee, homey-pro, homey-bridge\
**Created:** [February 26, 2024, 4:28pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966 "2024-02-26T16:28:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [February 26, 2024, 4:28pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/1 "2024-02-26T16:28:57Z")

</div>

Hi,  
I saw this [thread](https://community.homey.app/t/mesh-map-of-zigbee-network/91010) and was inspired to create a script which can do this for you.

I made 2 variants:

- [Zigbee Variant](https://community.homey.app/t/104966)
- [Zwave Variant](https://community.homey.app/t/105763)

Instructions:

1. Run this script in the **[WebAPI playground](https://tools.developer.homey.app/tools/api-playground)**: (make sure to empty the text area first)

```js
const main = async function () {
  console.log("Starting main function...");

  const zigbeeUpdate = await Homey.zigbee.runCommand({ command: 'UPDATE_NODES' }).catch((err) => {
    console.error("Error updating Zigbee nodes:", err);
  });
  const data = await Homey.zigbee.getState();

  const homeyID = data.controllerState.panId;

  let nodes = Object.values(data.nodes).map((node) => {
    const nodeType = node.type || node.deviceType || "enddevice";

    return {
      name: encodeURIComponent(node.name),
      group: nodeType.toLowerCase(),
      id: node.nwkAddr,
      nodeState: {
        id: node.nwkAddr,
      },
    };
  });
  const edges = [];

  nodes = [
    {
      name: encodeURIComponent("Homey"),
      id: homeyID,
      group: "coordinator",
      nodeState: {
        id: homeyID,
      },
    },
    ...nodes,
  ];

  if (data.controllerState && !data.controllerState.routes) {
    return "No data found.";
  } else {
    for (const [key, value] of Object.entries(data.controllerState.routes)) {
      if (typeof value === "string") {
        edges.push({ from: parseInt(value), to: parseInt(key) });
      } else if (Array.isArray(value) && value.length > 0) {
        if (nodes.some((n) => n.id === parseInt(value[0]))) {
          edges.push({ from: parseInt(value[0]), to: parseInt(key) });
        } else {
          edges.push({ from: homeyID, to: parseInt(key) });
        }
      } else if (Array.isArray(value) && value.length === 0) {
        edges.push({ from: homeyID, to: parseInt(key) });
      } else {
        console.log("No routes found");
      }
    }

    const nodeIds = nodes.map((n) => n.id);
    const edgeIds = [...edges.map((e) => e.to), ...edges.map((e) => e.from)];

    nodeIds.forEach((id) => {
      if (!edgeIds.includes(id)) {
        edges.push({ from: homeyID, to: id });
      }
    });

    const buf = window
      .btoa(JSON.stringify({ nodes, edges }))
      .toString("base64");
    return `https://martijnpoppen.github.io/com.homey.map.mesh#${buf}`;
  }
};

main();

```

1. copy the url in the reponse and paste it in your browser. (remove quotes)
2. Voila, you have a map of your Zigbee Routes.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/a/2a826ed4901b16ad0c41137d4e5ac0cbe8a552ff.png)

* * *

**Contributions**  
If you appreciate what I do, contribute to future development by making a [paypal contribution](https://www.paypal.me/martijnpoppen)  
or buy me a coffee on [Ko-Fi](https://ko-fi.com/martijnpoppen#checkoutModal) or [Bunq.me](https://bunq.me/MartijnPoppen)

[![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/9/2916364caa1239076c12be293d270d5980d9d272.png)](https://paypal.me/martijnpoppen) [![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/martijnpoppen#checkoutModal)[![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/8449771d527e7184562e1301d641dfc1e99a4261.png)](https://bunq.me/MartijnPoppen)

* * *

## 💻 Apps made by @martijnpoppen

See for more apps link below 👇🏻 or just open the pull down.

> [@Apps made by @martijnpoppen](https://community.homey.app/t/apps-made-by-martijnpoppen/85812/1):
>
> Click to expand

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 26, 2024, 4:52pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/2 "2024-02-26T16:52:45Z")

</div>

Hi Martijn,

is there something which has to be changed in the script? Because this is the output:

```auto
{
  "error": "Object.entries requires that input parameter not be null or undefined"
}

```

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [February 26, 2024, 4:56pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/3 "2024-02-26T16:56:20Z")

</div>

Hey @DirkG  
Strange, Did you select a Homey?

Does it work when you only run:

```auto
Homey.zigbee.getState()
```

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [February 26, 2024, 5:01pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/4 "2024-02-26T17:01:27Z")

</div>

> [@martijnpoppen](#):
>
> Does it work when you only run:

Yes

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [February 26, 2024, 5:03pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/5 "2024-02-26T17:03:15Z")

</div>

@DirkG Can you send me the response of that in a DM?  
You can copy the response by clicking the icon next to “root”

---

<div class="post-metadata">

**Author:** ![LRvdLinden](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lrvdlinden/32/80786_2.png) [@LRvdLinden](https://community.homey.app/u/LRvdLinden)\
**Post date:** [February 26, 2024, 5:03pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/6 "2024-02-26T17:03:50Z")

</div>

Another brilliant script. Thx!

---

<div class="post-metadata">

**Author:** ![DaDa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dada/32/79161_2.png) [@DaDa](https://community.homey.app/u/DaDa)\
**Post date:** [February 26, 2024, 5:07pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/7 "2024-02-26T17:07:04Z")

</div>

Error for me:

##### Response

“root”:{  
1 item  
“error”:  
string"can’t convert undefined to object"  
}

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [February 26, 2024, 5:08pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/8 "2024-02-26T17:08:19Z")

</div>

This script will only work on the older Homey Pro’s (2016-2019), the data is just not available for Homey Pro (early 2023) (the object is there but empty).  
Also it is a “current route map” **not** the mesh map, as the mesh in reality will be much bigger with more connections between devices.

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [February 26, 2024, 5:09pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/9 "2024-02-26T17:09:38Z")

</div>

@Caseda yep i see ☹  
That’s a pity.  
Changed the title to route instead of mesh 😉

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [February 26, 2024, 5:13pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/10 "2024-02-26T17:13:55Z")

</div>

Yay, almost start to celebrate for HP23, anyway, great stuff!

---

<div class="post-metadata">

**Author:** ![martijnpoppen](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/martijnpoppen/32/84849_2.png) [@martijnpoppen](https://community.homey.app/u/martijnpoppen)\
**Post date:** [February 26, 2024, 5:14pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/11 "2024-02-26T17:14:43Z")

</div>

@Sharkys yeah wish i knew that earlier 😛

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [February 26, 2024, 5:17pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/12 "2024-02-26T17:17:37Z")

</div>

I really wonder if it’s Athom decision or “SDK” Silicon Labs issue, would be so much helpful! Mostly when reading again and again about ZigBee issue

---

<div class="post-metadata">

**Author:** ![Caseda](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/caseda/32/138695_2.png) [@Caseda](https://community.homey.app/u/Caseda)\
**Post date:** [February 26, 2024, 5:23pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/13 "2024-02-26T17:23:28Z")

</div>

It is an Athom decision, getting the mesh network is a build in function (not just from a controller perspective) from ZigBee (and Z-Wave) but Athom just never implemented it, also not for the older Homey Pro’s hence it only being a “last used route map”.

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [February 26, 2024, 5:56pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/14 "2024-02-26T17:56:18Z")

</div>

> [@Caseda](#):
>
> It is an Athom decision

Thank you Caseda. I understand they would like to keep it simple for “this kind of product”…but given the nature of Zigbee devices (China, not following all required standards etc.), they can’t keep it simple for users and I believe such functionality is essential. But you know it, I know it…but I guess Athom decided already.  
It’s a pity then seeing those pissed users, while they complain about Homey and after all, could be device itself… and nobody can advice anything, because simply the supporting details, like a routing network, is simply not there.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 26, 2024, 10:07pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/15 "2024-02-26T22:07:58Z")

</div>

Well, maybe it’s time for some kind of a user vote ‘post’, @Sharkys , as Athom said: “The more votes, the higher the chance we will consider ~~fixing~~ enabling it”  
From what I understand they omitted the zigbee overview, and did not implement a mesh/route map because of the many(what is many?) questions about zigbee ‘issues’ when actually nothing was wrong. A simple “What are you looking at, and how does this work” would suffice imho

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 26, 2024, 10:10pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/16 "2024-02-26T22:10:12Z")

</div>

Very nice @martijnpoppen ! Hats off again my man. Maybe Athom can hire you to build something useful for the Pro 2023.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 27, 2024, 10:02am UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/17 "2024-02-27T10:02:21Z")

</div>

I don’t see any redundant connections between routers, which means the old Homey’s are using a suboptimal topology (cluster tree instead of mesh).

---

<div class="post-metadata">

**Author:** ![Sharkys](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sharkys/32/54029_2.png) [@Sharkys](https://community.homey.app/u/Sharkys)\
**Post date:** [February 27, 2024, 6:15pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/18 "2024-02-27T18:15:50Z")

</div>

That would explain a lot, right ;-(

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [February 27, 2024, 6:17pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/19 "2024-02-27T18:17:08Z")

</div>

I wasn’t going to make any statements about that… 😛

---

<div class="post-metadata">

**Author:** ![DaDa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dada/32/79161_2.png) [@DaDa](https://community.homey.app/u/DaDa)\
**Post date:** [February 27, 2024, 7:14pm UTC](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966/20 "2024-02-27T19:14:41Z")

</div>

[quote=“Caseda, post:8, topic:104966, full:true”]  
This script will only work on the older Homey Pro’s (2016-2019), the data is just not available for Homey Pro (early 2023).[/quote]

That is a shame. It’s damned hard to figure out why my Zigbee nodes keep dropping out of the mesh, without any kind of info. I guess I have to keep bugging Athom about it.

[Next page](https://community.homey.app/t/how-to-pro-cloud-zigbee-route-map-homey-pro-homey-shs-homey-bridge/104966.md?page=2)
