NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

Node - name labels ? #104

Open bakman2 opened 1 year ago

bakman2 commented 1 year ago

I use zigbee2mqtt and the friendly names are mqtt topics, which means that my devices have long names, would like to have a shorter description within the node-red editor.

SCR-20220906-b5s The default name field is missing from the nodes. Would it be possible to add this ?

example from the change node:

SCR-20220906-b6t

bakman2 commented 1 year ago

@NorthernMan54 could I help with this in a PR ? Or are you already using the node.name by forcing the devicename ? (was trying to decipher the nodes).

NorthernMan54 commented 1 year ago

The device name aka node.name is set based on the named passed by Homebridge.

You could probably change the names by playing with the code here

https://github.com/NorthernMan54/node-red-contrib-homebridge-automation/blob/244059ce5453e17812fb4dd11aea73d554958db4/lib/Service.js#L118

and use something like this to grab everything after the 3rd slash as the name.

name.split('/').slice(2).join('/')

But would it be re-usable by other users

bakman2 commented 1 year ago

Ok, the node-red documentation describes a default name field, ie the name will remain but add a visual label. (other nodes have a "name" field, which ends up as the visual label).