Rob's Node-Red Template and Example Flow Thread!

Yeah, I got it figured out, not sure what I was doing wrong, probably lack of sleep :sleeping:

@LosinIt I see that issue, mine are configured differently. I have the deactivation delay set to 0, just tried setting it how you did, definitely a bug with the node like the dev said. When I use it for motion sensors, I have a stoptimer node further down the sequence like @TechMedX suggests

3 Likes

:+1:
I appreciate knowing that.

Is there anything you needed to do in order to make it work?
I installed the nodes and was able to get the API key. However it doesn’t find any lights/connects.


Not that i recall!
After the latest update, i remember it taking a long time for a new light added to the hub to show up in the node.
Other than that, once i got the api key it was good to go…
Oh, i dont have the hue bridge node anywhere on my flows, not that it should matter…
Its late here, but i can post screenshots of all my settings tomorrow if you like

1 Like

That would be great :slight_smile:

1 Like

For anyone else affected, I found this thread that describes my issue and the log line I just found in node-red logs:
TypeError: Cannot read property ‘owner’ of undefined in node-red-log · Issue #378 · Foddy/node-red-contrib-huemagic · GitHub

Anyone has an idea how to update to this version?

Doesn’t look like the repository’s maintainer is interested anymore… shame. I went ahead and manually updated (using nano) messages.js as described here to fix the Hue groups node, and updated messages.js and api.js as described here to fix the broken Hue light node. Total hack, and I hope these fixes persist if and when a new release is pushed out. If not, I’ll add them back (assuming Philips doesn’t tweak their API and invalidate the fixes).

FYI, for node-red 3, the files are located in the following folder on your Core:
/home/oh-la/data/node-red/node_modules/node-red-contrib-huemagic/huemagic/utils

I did the same now and it kind of works. However sometimes the nodes become unresponsive and the command does not trigger. Is there any better integration? Nearly all my lights are Hue and its a big part of my automation.

If you can guarantee they’ll never be powered off, and you don’t need hue features, you could always pair them directly to core

The built in home assistant auto picked up my hue lights and I’ve seen no issues controlling them there.

The home assistant integration can then be exposed to node-red.

1 Like

It would be a workaround, but why not … Can you elaborate how?
Thanks!

I would start by following the get started instructions for home assistant in the docs. Remembering oh-la needs to be the first user.

From there home assistant already saw the hue lights on the network settings up was about as simple as pushing the button on the bridge.

For the home assistant nodes @RRodman posted a nice example for getting it setup. Let me see if I can find the post.

1 Like

OK - Can post some screens of my settings - But seems like you found the issue/workaround.
I havent addded any new lamps in a bit, so maybe ill face the same issue if/when i do - Guess i can count myself lucky it work for me - at the moment!!
Anyway, hope these help!:

[{"id":"4da9121cb6df2639","type":"change","z":"4650fd536792fcf5","name":"CT-6500k, 25%","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"on\":true, \"brightness\":25, \"colorTemp\":153}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":420,"wires":[["2a650eecbfafda7a"]]},{"id":"1fa4683ee61887bc","type":"hubitat device","z":"4650fd536792fcf5","deviceLabel":"Olivia Sleep Time","name":"","server":"26c9a23e.36f4ce","deviceId":"833","attribute":"switch","sendEvent":true,"x":410,"y":420,"wires":[["958c22d9e45e4b20"]]},{"id":"958c22d9e45e4b20","type":"switch","z":"4650fd536792fcf5","name":"off/on","property":"payload.value","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"on","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":420,"wires":[["91076f91a5d14cbb"],["4da9121cb6df2639"]]},{"id":"2a650eecbfafda7a","type":"hue-light","z":"4650fd536792fcf5","name":"Bathroom","bridge":"7dcda340.c6ab4c","lightid":"8be8bac6-3a9f-4394-9ced-abc2f840cfa2","colornamer":true,"skipevents":false,"initevents":false,"x":900,"y":420,"wires":[[]]},{"id":"26c9a23e.36f4ce","type":"hubitat config","name":"Hubitat","usetls":false,"host":"192.168.20.11","port":"80","appId":"545","nodeRedServer":"http://192.168.20.10:1880","webhookPath":"/hubitat/webhook","autoRefresh":true,"useWebsocket":false,"colorEnabled":false,"color":"#000000"},{"id":"7dcda340.c6ab4c","type":"hue-bridge","name":"Philips hue","bridge":"192.168.20.12","key":"eJKwVfdJ1cgCdCvTV0blnPBKeFuk6Jv4qa1r0lF7","worker":"1","disableupdates":false}]
1 Like

FYI, it’s good practice to sanitize your posts of any API keys, even if they’re only valid inside your network

1 Like

I forgot at time of posting, so i just rolled with it!
But yes, good advice in general!

2 Likes

Yah, I can’t roll with that. Edited out your keys.

1 Like

I fail to see the problem since part of the key was cropped. It would impossible for all but the most determined bad actor to make use of what was visible. Even then it could not be used without access to @bdydrp’s internal net.

Of course it’s best to not show any kind of security key, token, password in the first place but let’s keep things in perspective.

It’s better to set the standard for future posts. So others don’t think it’s OK.

2 Likes

Can anyone share an example for how to properly turn on a Hue scene using contrib-home-assistant-websocket? I have the package installed and connected to HA… everything works well on that front. Just can’t seem to figure out how to fire off my scenes correctly. For example, in my family room I have a 6-bulb group. I have a scene that turns off three of them and dims the other 3. When I use the huemagic node to enable the scene it works, but when I do it with HA websockets nodes it turns on all 6 and dims them all. Would like to ditch huemagic, since it doesn’t appear to be well-supported. Can post more helpful details later tonight - currently not at home and am describing the issue from memory. Hopefully someone has a tip that’ll help!

1 Like

There is a better way, there is a new integration using v2 of the Hue API.

It’s excellent. I’ve been using it this week, and it bypasses all but one of the dependancies that we rely upon with the old Hue node (huemagic). It’s so much faster, no errors (once I removed the old instance).

Details here: GitHub - andesse/HUE-CLIP-API.Node-RED-Flows: Node-Red Flow to communicate with HUE CLIP API V2

My Hue lights are just brilliant now. Working on changing over my motion sensors today.

6 Likes