zigbee2mqttadminpanel icon indicating copy to clipboard operation
zigbee2mqttadminpanel copied to clipboard

Feature Request: Sort devices by friendly_name

Open dirstel opened this issue 5 years ago • 0 comments

As I am using a naming scheme, a sorted device list may come handy. I implemented this in my flow (lack of configuration keeps me using a "fork"). Anyway: this may help you/others:

Put a function node using the following code right behind the JSON node in Devices subflow.

BTW. the JSON node may be ommited, when configuring the mqtt-in node to do the JSON conversion by itself.

// coordinator does not have a friendly name
msg.payload.message[0].friendly_name="";
// sort
msg.payload.message.sort((a, b) => a.friendly_name.localeCompare(b.friendly_name));
return msg; 

dirstel avatar Aug 11 '19 09:08 dirstel