Supergiovane / node-red-contrib-knx-ultimate

Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer.
https://youtu.be/egRbR_KwP9I
MIT License
143 stars 34 forks source link

Hue Light Node - Setup problem (maybe similar to #261) #281

Closed SmartyKNX closed 9 months ago

SmartyKNX commented 9 months ago

Hi there!

After updating from 2.2.8 oder 2.2.9 (cannot remember exactly) to 2.2.10 the list of HUE lights does not load anymore. Configured lights respond to KNX telegrams and show correct status ("KNX -> HUE {"on"....) however cannot be configured at all (nothing is being displayed below the name field). New lights stuck at "Initializing. Please wait"

Restart of NodeRed does not help. Deleting the bridge configuration and setting up a new one does not help as well.

Maybe it is a similiar reason as in issue #261.

Cheers, Tom

Supergiovane commented 9 months ago

Hi I'll take a loog

Supergiovane commented 9 months ago

I cannot reproduce you issue. As you can see, i see all lights. Please, can you tell me your node.js version and node-red version? Thanks

https://github.com/Supergiovane/node-red-contrib-knx-ultimate/assets/37666636/8e3ded3f-f588-4b68-8acf-de92ca5df931

Supergiovane commented 9 months ago

I need the log also, so i can see errors. Thanks.

SmartyKNX commented 9 months ago

Thanks for your help. However it does not resolve this issue for me. Rebooting the HUE bridge does not either.

I just installed node-red-contrib-huemagic to check if it is a generic problem. Nope. All lights are found.

Comunication between the node and the bridge seems to work, as lights can be switch on and off. However there is no way to edit the configuration or to add new lights.

This is v3.0.2 on Docker (Synology). I have no idea where to fetch logs unfortunately as I do not know how to ssh into the docker session.

Cheers, Tom

SmartyKNX commented 9 months ago

Just to have it stated clearly: editing the node did work flawlessly before the update to 2.2.10

Supergiovane commented 9 months ago

Ok, thank you for the info. I'll try some tweaking and i'll let you know. Please stand by.

Supergiovane commented 9 months ago

Hi node-red-contrib-knx-ultimate@2.2.11 is out Please install it when you see it in the palette, then let me know. If it doesn't work, i need at least the node-red log, otherwise it's difficult to help you.

SmartyKNX commented 9 months ago

I will give it a go tomorrow and let you know.

SmartyKNX commented 9 months ago

Did it tonight. Nope, does not resolve this issue. I found this error in the logs

2023-11-03 21:16:26,stdout,"[error] 11/3/2023, 10:16:26 PM.432 callConnectToHueBridgeOfAllHUEServers: Node Philips hue Cannot read properties of null (reading 'ConnectToHueBridge')

Current status: existing light nodes do work as expected (without being able to be edited). New nodes will not find the HUE lights.

Supergiovane commented 9 months ago

Ok. Will take a look tomorrow!

Supergiovane commented 9 months ago

Hi Tom, node-red-contrib-knx-ultimate@2.2.12 is out. Please try it and let me know. Thanks.

Supergiovane commented 9 months ago

Sorry, the version is node-red-contrib-knx-ultimate@2.2.16

SmartyKNX commented 9 months ago

Yes, it's fixed.

Cheers Tom

SmartyKNX commented 9 months ago

Unfortunately every third or fourth deploy I will see these lines in the logs:

2023-11-04 21:16:44,stdout,"[error] 11/4/2023, 10:16:44 PM.100 KNXUltimatehueEngine: loadResourcesFromHUEBridge: Error response for https://a.b.c.d/clip/v2/resource with status 429 Too Many Requests 2023-11-04 21:16:48,stdout,hueEngine: isConnected: Error response for https://a.b.c.d/clip/v2/resource/bridge with status 429 Too Many Requests

(IP adresse replaced)

The second line is being repeated every few seconds.

In this case the light node is stuck at the Init Status forever. Unfortunately I cannot resolve this issue with another deploy, but have to shut down Node Red and restart.

I installed node-red-contrib-huemagic once again to see, if it is a local problem in my configuration. Nope. A light node from node-red-contrib-huemagic is usable at the same time as the "Too Many Requests" error occurs.

Cheers Tom

Supergiovane commented 9 months ago

Hi Tom Do you run other hue nodes beside knx-ultimate? Knx-ultimate do a single resource read at startup, then obey to the max requests per second, as stated in the hue standards documentation. Anyway, the nodes must not remain in lock mode. I’ll take a look.

Supergiovane commented 9 months ago

Hi Tom Please upgrade to node-red-contrib-knx-ultimate@2.2.19

SmartyKNX commented 9 months ago

Hi Massimo

This error occurred regardless of whether Node-Red-Contrib-Huemagic was installed or not. There are no other HUE nodes in my setup.

I upgraded to 2.2.19, deployed about 10 times now and the previous error has not shown up again. So it seems to be resolved (or will occur at the 20th deploy... hopefully not)

Beside this: you added a beta kelvin value. I'm not sure about the range, because a hue light with some standard warm color temperature (most likely about 3000K or so) shows up with values around 42000? Do I need to apply some kind of conversion factor?

Supergiovane commented 9 months ago

Hi scale(msg.payload, [0, 65535], [153, 500]); The scale you must use is 0-65535, as per KNX standard. Hue light uses “mirek” instead, that goes from 153 to 500 The hue light node performs the conversion to and from HUE values.

SmartyKNX commented 9 months ago

First of all: thanks for your enormous commitment and quick solutions for the bridge issues.

I understand your point, but the temperature of hue light is mostly published and used in values like 2700K, 3000K, 4000K and therefor these values are very userfriendly.

I was pretty sure the ISE HUE uses values like this. I blew some dust from my device, hooked it up again and indeed they use a range of 2000K to 6533K (with DPT 9.002) and the values are quite reasonable. I hammered some ISE values between 2000 and 6500 into an Excel spreadsheet along with the corresponding values from your implementation and unfortunately it's not a straight line so there won't be a 1:1 conversion. Do you know a converter?

Cheers Tom

Supergiovane commented 9 months ago

Hi You can set the switch on color temperature. If you click on the textbox, a color/temperature page will show up. I’ve never tried to set a kelvin degree, but you can try it. If you set 2700K and click apply, the corresponding RGB color will show up. Do not try to blow your mind with complicated calculations. I need to know what you want to achieve, and i’ll do it for you. If you want to set a temperature in Kelvin via a datapoint, i can add such datapoint. I need anyway to make a scale change, because HUE Lights accepts only mirek or color.xy. :-)

SmartyKNX commented 9 months ago

That's very kind of you, but I had some spare time tonight and had another look at the figures I put into the Excel sheet.

It seems to be pretty simple: 1000000 / Mirek value = Kelvin-value That's no scientific formula I guess, but it's pretty precise within the usual range and is very similar to the values from ISE HUE.

I can use a simple function node to rescale your values to Mirek and convert to/from Kelvin, so it does not need to be done inside the node. If you like the idea you can put it there of course as DPT 9.002

(Btw. I never found a satisfying conversion from RGB to color temperature or vice versa.)

Supergiovane commented 9 months ago

I opened another issue for that.