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?