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

If (by accident) use a 'postfix' (rgb, left, right) as friendly name, all commands are ignored #2486

Closed
rduivenvoorde opened this issue Dec 8, 2019 · 1 comment

Comments

@rduivenvoorde
Copy link

Bug Report

I like short (friendly) names, so gave my first rgb-lamp as friendlyname 'rgb' in the config
After that I was unable to set/get messages for that specific device.
Renaming to rgblamp fixed this, so at first the idea was that there was a minimal length of friendly name, but 'xx' also seemed to work on further testing

After some q&a on the discord-channel, people pointed to:

https://github.com/Koenkk/zigbee2mqtt/blob/dev/lib/util/utils.js#L30

So apparently 'rgb' ('left', 'right', 'center', 'bottom_left', 'bottom_right', 'l1', 'l2', 'default',
'top_left', 'top_right', 'white', 'rgb', 'system', 'top', 'bottom', 'center_left', 'center_right',
'ep1', 'ep2', ) are a sort of 'reserved keyword', and using it made all fail via:

zigbee2mqtt/lib/zigbee.js

Lines 167 to 177 in b459c35

if (postfix) {
isDefaultEndpoint = false;
if (postfixByNumber) {
endpoint = device.getEndpoint(postfix);
} else {
assert(mapped != null, `Postfix '${postfix}' is given but device is unsupported`);
assert(endpoints != null, `Postfix '${postfix}' is given but device defines no endpoints`);
const endpointID = endpoints[postfix];
assert(endpointID, `Postfix '${postfix}' is given but device has no such endpoint`);
endpoint = device.getEndpoint(endpointID);
}

On Discord people proposed:

  • put this info in docs
    and/or
  • "It should only check for postfixes if the thing in front of the postfix is a valid friendly name, I'd say."

How to reproduce it (minimal and precise)

Just give a device 'rgb' or 'left' as friendly name and try to get/set messages

Debug Info

zigbee2mqtt version 1.7.1 (commit #b459c35)

@Koenkk
Copy link
Owner

Koenkk commented Dec 9, 2019

These postfixes are indeed not allowed as a friendly_name, zigbee2mqtt will now check for this and refuse to start int his case. Thanks!

@Koenkk Koenkk closed this as completed Dec 9, 2019
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

2 participants