zigbee2mqttadminpanel
zigbee2mqttadminpanel copied to clipboard
Feature Request: Sort devices by friendly_name
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;