Error in Zigbee2Mqtt Admin flow

Good evening,
I am testing the Zigbee2Mqtt Admin flow example.
It works quite well except for the part of retrieving the icons from the website zigbee2mqtt.
The code crashes in the function node

newPayload = [];
msg.payload.message.forEach(function(entry) {
    if(entry.type != 'Coordinator') {
      newentry = {'title': entry.friendly_name, 
               'description': entry.model + ' (' + entry.ieeeAddr + ')',
               'icon': 'https://www.zigbee2mqtt.io/images/devices/' + entry.model.replace(new RegExp('/', 'g'), '-') + '.jpg'
      };
      newPayload.push(newentry);
    }
});

msg.payload=newPayload;
return msg;

Here is the debug result:

It revolves around this value which is not right, if I understand correctly. payload.message[1].model
But I don't understand how the syntax works
entry.model.replace(new RegExp('/', 'g')

For verification,I used a Curl https from the image location, it's ok, it's accessible.

If you could guide me?

Does every object in the array have a model , and does the type not equal "Coordinator" ?

1 Like

Not an answer to your question, but its much easier to use the build in dashboard of Zigbee2mqtt
You can find it at http://x.x.x.x:8080 after you add:

frontend:
  port: 8080
  host: 0.0.0.0

to your configuration.yaml of the zigbee2mqtt setup.

1 Like

Yes, except the last one

indeed I see that there is a device not recognized

I never thought to activate this dashboard. It's worth a look indeed. If it is easier or simpler

edit: Just started, it seems to me complete indeed. I'm going to go deeper into it :+1:

Yes, delete the unknown and Bingo !!!! Great
image

Thanks to both of you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.