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

Connection failed to hue bridge / lamps #375

Closed
effen28 opened this issue Jun 12, 2022 · 19 comments · May be fixed by #390
Closed

Connection failed to hue bridge / lamps #375

effen28 opened this issue Jun 12, 2022 · 19 comments · May be fixed by #390

Comments

@effen28
Copy link

effen28 commented Jun 12, 2022

Hallo together,

since a few days ago (maybe since the update), I can not longer choose a lamp in the drop down.
=> it says, there went something wrong, try again

Unbenannt

also the Hue Bridge-Node says always connecting, but without success

image

Hope someone can support/help me

Thank you

@andesse
Copy link

andesse commented Jun 12, 2022

This is a known behavior. Check all the recent bug reports.

@andesse
Copy link

andesse commented Jun 15, 2022

Here my repository for https HUE API V2. It's just a flow with everything you need. https://github.com/andesse/node-red-hue-api.v2-flows

@Travelbacon
Copy link
Contributor

Travelbacon commented Jun 17, 2022

@Foddy Can you take a look at this please? I have the exact same problems.
Is there any help needed upgrading to the new API of Hue?

@xyzo
Copy link

xyzo commented Jun 20, 2022

@effen28 I do have the exact same issue and haven't found a solution so far. My Hue-Lights don't work anymore from their huemagic-nodes in Node Red :-(

@andesse
Copy link

andesse commented Jun 20, 2022

@xyzo here. Very easy. You will be happy.
https://github.com/andesse/hue-clip-api.node-red-flows

@xyzo
Copy link

xyzo commented Jun 20, 2022

@andesse I discovered that 30 mins ago. I already AM happy now :-D
Thanks for your work!!

@andesse
Copy link

andesse commented Jun 20, 2022

@xyzo cool, it won’t take long to set it up and you have zero issue for a long time, cause the api is brand new

@xyzo
Copy link

xyzo commented Jun 20, 2022

@andesse It works. Honestly I'd appreciate if there would be features like selecting rooms/lights/zones from within the nodes menus instead of copy and pasting UIDs everywhere.

To make sure: it works perfectly if you have digged yourself through everything what might be a bit difficult for people who are "only users". It's just a matter of being user friendly/intuitive...

@xyzo
Copy link

xyzo commented Jun 20, 2022

@andesse
BTW: the comment node "lights - DOUBLE CLICK FOR INFO" is empty... no info on double-click :-)

@andesse
Copy link

andesse commented Jun 20, 2022

@xyzo this is not a contrib. This is a flow that you change for your needs. I want that the users get contrib free and independent. So they have no struggle in the future when contribs don’t get updated.

Light Doubleclick. Can happen. I already have it in the readme at the end, that there could be mistakes.
Lights are almost the same setup like rooms.

Follow my recommendation. Trigger scenes, not lights separate if possible. It’s important to read the full readme.

@xyzo
Copy link

xyzo commented Jun 20, 2022

@andesse I got you and I didn't want to upset you.
Just saying that someone who doesn't have a clue about what is going on "inside" and just used huemagic before is now looking for something which works the same like huemagic. Some persons might be looking for similar solutions only.

You did great work with your tidy flow - really!
It's just not a simple out-of-the-box-solution like before and still I see the advantages.

@andesse
Copy link

andesse commented Jun 20, 2022

@andesse It works. Honestly I'd appreciate if there would be features like selecting rooms/lights/zones from within the nodes menus instead of copy and pasting UIDs everywhere.

To make sure: it works perfectly if you have digged yourself through everything what might be a bit difficult for people who are "only users". It's just a matter of being user friendly/intuitive...

I will never add this kind of features. These are parsed nodes again, that will not work some day if they are not maintained. If you want that, wait for HueMagic update.

@xyzo
Copy link

xyzo commented Jun 20, 2022

@andesse I won't wait :-)
What I got now with your work is for MY needs perfect. More perfect then huemagic was before :-)

...I was just giving my thoughts and I didn't want to blame anyone instead of saying thank you.

@andesse
Copy link

andesse commented Jun 20, 2022

Haha, yeah I got that. No worries. For me this solution has so many flows and examples now, that even only user people can do it when figured out.
most work is Label link in nodes.

Thanks for your second comment. :)
I am happy for everybody who can end struggling.

@lukystreik
Copy link

lukystreik commented Oct 16, 2022

Initializing the bridge (192.168.1.122)…
Connected to bridge
Processing bridge resources…
TypeError: Cannot read properties of undefined (reading 'owner')

Same here, since upgrading to the latest verion of nodered and huemagic, the connection to the brigde is broken.
The Node status is "connecting".
hue brigde Version 1.53.1953188020
nodejs 3.0.2
huemagic 4.2.2

Downgrade to 4.2.1 doesn´t fix the problem.

I have two bridges with the same current firmware. The first one works with no issues, the second have above problem

@lukystreik
Copy link

lukystreik commented Oct 16, 2022

I´ve found the issue.
If you add debug logs in the function this.fullResource in utils/api.js it is a lot easier to determine the problem!
You should add something like that below on log stage debug:

//load the util function at the beginning of the api.js:
const util = require('util');

...
around line 185:
// GET FULL/ROOT RESOURCE
this.fullResource = function(resource, allResources = {})
{
const scope = this;
var fullResource = Object.assign({}, resource);

console.log("before Owner: " + util.inspect(resource,false, null, true /* enable colors */));

            if(resource["owner"])
            {

console.log("in Owner: " + util.inspect(resource["owner"],false, null, true /* enable colors */));
fullResource = scope.fullResource(allResources[fullResource["owner"]["rid"]], allResources);
}

Bildschirmfoto 2022-10-16 um 13 50 06

Now we can see, witch is the case:
Here in the group 6 a private group as owner is defined, witch can not processed by the huemagic api:

nodered-local-node-red-1 | vor Owner: {
nodered-local-node-red-1 | id: 'beda2532-950b-4f9e-b8e1-653e1fcd5bbd',
nodered-local-node-red-1 | id_v1: '/groups/6',
nodered-local-node-red-1 | owner: {
nodered-local-node-red-1 | rid: '867613e6-172e-4ae8-80e4-e8a8dc18cee1',
nodered-local-node-red-1 | rtype: 'private_group'

nodered-local-node-red-1 | },
nodered-local-node-red-1 | on: { on: false },
nodered-local-node-red-1 | alert: { action_values: [ 'breathe' ] },
nodered-local-node-red-1 | signaling: {},
nodered-local-node-red-1 | dynamics: {},
nodered-local-node-red-1 | type: 'grouped_light'
nodered-local-node-red-1 | }
nodered-local-node-red-1 | im Owner: { rid: '867613e6-172e-4ae8-80e4-e8a8dc18cee1', rtype: 'private_group' }
nodered-local-node-red-1 | vor Owner: undefined
nodered-local-node-red-1 | 16 Oct 13:46:03 - [info] [hue-bridge:vxhue2] TypeError: Cannot read properties of undefined (reading 'owner')
nodered-local-node-red-1 | 16 Oct 13:46:03 - [red] Uncaught Exception:
nodered-local-node-red-1 | 16 Oct 13:46:03 - [error] TypeError: Cannot read properties of undefined (reading 'owner')
nodered-local-node-red-1 | at API.fullResource (/data/node_modules/node-red-contrib-huemagic/huemagic/utils/api.js:187:14)
nodered-local-node-red-1 | at API.fullResource (/data/node_modules/node-red-contrib-huemagic/huemagic/utils/api.js:190:25)
nodered-local-node-red-1 | at /data/node_modules/node-red-contrib-huemagic/huemagic/utils/api.js:247:30
nodered-local-node-red-1 | at Array.forEach ()
nodered-local-node-red-1 | at /data/node_modules/node-red-contrib-huemagic/huemagic/utils/api.js:244:14
nodered-local-node-red-1 | at new Promise ()
nodered-local-node-red-1 | at API.processResources (/data/node_modules/node-red-contrib-huemagic/huemagic/utils/api.js:224:10)
nodered-local-node-red-1 | at /data/node_modules/node-red-contrib-huemagic/huemagic/hue-bridge-config.js:92:47
nodered-local-node-red-1 | at processTicksAndRejections (node:internal/process/task_queues:96:5)
nodered-local-node-red-1 exited with code 1

Therefore Object.assign() is the place, where the exception throwed

@lukystreik
Copy link

lukystreik commented Oct 16, 2022

Quick fix: Ingore undefined objects like private_groups in api.js:

Bildschirmfoto 2022-10-16 um 16 40 51

line 176ff. in utils/api.js
if (resource === undefined ) {
console.log("huemagic: ignore undefined resources");
return allResources;
}

@zelloxy
Copy link

zelloxy commented Oct 17, 2022

I'd love for a fix for this, just begun setting up my flow and getting th "Connected to bridge" then the owner error.

@andesse
Copy link

andesse commented Oct 17, 2022

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

Successfully merging a pull request may close this issue.

6 participants