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

"No light Id defined. Please check the docs." even if a ID is supplied #300

Open
oxivanisher opened this issue Jan 25, 2022 · 5 comments
Open

Comments

@oxivanisher
Copy link

oxivanisher commented Jan 25, 2022

I get the "No light Id defined. Please check the docs." error for my hue lights since the newest version. I use the node in "universal mode" and tried many different things as topic, but nothing works. I think there is a error in this line:

const tempLightID = (!config.lightid && typeof msg.topic != 'undefined' && bridge.validResourceID.test(msg.topic) === true) ? msg.topic : config.lightid;

As far as I can see, the bridge tests for either id or deviceId (the documentation does not really specify which ID is required as topic). But it does not work with both for me.

This is one of my lights status output:

[..]
id: "4635741f-c8a7-4b88-aa82-f701e187132c"
idV1: "/lights/3"
uniqueId: "ba813788-0946-44bd-992f-348103d528a7-4635741f-c8a7-4b88-aa82-f701e187132c"
deviceId: "ba813788-0946-44bd-992f-348103d528a7"
name: "LivingColors 1"
[..]
@floriandrott
Copy link

floriandrott commented Jan 31, 2022

I have the same issue with the universal node. With deviceId it works better as with id but fails more than 50%.

@andreas-knx
Copy link

andreas-knx commented Feb 21, 2022

The problem seems to be related to this check:
bridge.validResourceID.test(msg.topic) === true
due to the following RegEx check:

this.validResourceID = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi;

If I remove the check, it is working flawlessly if I pass the deviceId in msg.topic

@bland328
Copy link

bland328 commented Feb 25, 2022

Just stopping in to say that I'm also running into this problem, and haven't yet gotten it work even once with either deviceId or id passed as msg.topic.

Edit: I tried disabling line 39 as suggested by @andreas-knx above, and it did get rid of the error message, but didn't make things work any better. I also manually tested that regex statement against my deviceId, and unsurprisingly, it did work properly.

bland328 added a commit to bland328/node-red-contrib-huemagic that referenced this issue Feb 25, 2022
@ideaweb
Copy link

ideaweb commented Mar 20, 2022

I have the same problem. ;-)

No idea what the line is doing, but i guess removing the var breaks javascript when accessing like

bridge.validResourceID.test()

Thats why i replaced the line with the followoing common regex and its working for me:

this.validResourceID = /[a-zA-Z0-9]/gi;

But of course, no idea if this breaks something else (e.g. for non universal mode).

Btw. in recent version id was accepted, which was much easier to handle than deviceid.

@andreas-knx
Copy link

Edit: I tried disabling line 39 as suggested by @andreas-knx above, and it did get rid of the error message, but didn't make things work any better. I also manually tested that regex statement against my deviceId, and unsurprisingly, it did work properly.

Hello @bland328 , by disabling the check I meant removing this comparison:
bridge.validResourceID.test(msg.topic) === true

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

5 participants