Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Sort devices by friendly_name #17

Open
dirstel opened this issue Aug 11, 2019 · 0 comments
Open

Feature Request: Sort devices by friendly_name #17

dirstel opened this issue Aug 11, 2019 · 0 comments

Comments

@dirstel
Copy link

dirstel commented Aug 11, 2019

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; 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant