Kane610/deconz

Group lights have color temperature attribute with 0 value

Closed this issue · 19 comments

Hi,

Recently encountered an issue with HA in combination with Google Assistant and Deconz. I initially registered this issue; home-assistant/core#15295 and did a commit to fix it here home-assistant/core#15305 (with my very limited knowledge of HA and Github)

After digging a bit deeper I found it is being caused because Deconz groups exposed as light can have a color temperature attribute which can be 0 which is not a valid value and causes the ZeroDivisionError. For more details look in the link above.

Hope you can fix it.

Rest assured I have this on my to do. But some other things have been higher up on my priority list. Will try to get this done before next rounds of beta begins.

Awesome, take your time. Not in a hurry but just wanted to make sure it's on the radar.

@bartnaaijkens could you possibly enable component debug logging and give me the json data for your groups?

This is entity info, I'd like the raw json data from deconz. It should be printed while hass is starting

Yes. Can you give me one good and one bad example?

In the entities overview (as also in the logging posted earlier) I do the following differences;
With all lights switched which works I get the following attributes on the living room group light

min_mireds: 153
max_mireds: 500
friendly_name: Living Room
supported_features: 63

With 1 light on the following;

min_mireds: 153
max_mireds: 500
brightness: 127
color_temp: 0
hs_color: 225.176,100
effect_list: colorloop
rgb_color: 0,63,255
xy_color: 0.137,0.065
friendly_name: Living Room
supported_features: 6

@bartnaaijkens would it work as long as ct is greater than 0?

I think it will as it went wrong with a division by zero (return math.floor(1000000 / mired_temperature) in home-assistant/core#15305).

According to the Deconz API ct.state value should be inbetween 153 and 500.

@bartnaaijkens would you mind trying this change out if it fixes your problem?

home-assistant/core#15791

I wouldn't know how to, to be honest. Not really a developer/advanced HA user.

how do you run your hass?

via hassio... would it be possible to just login via SSH, change the code of the file you committed and restart HA?

yes, that would work, if you have access to the file system

would https://developers.home-assistant.io/docs/en/creating_component_loading.html also work? Looks like a better approach...I'll give it a go tonight

Without reading it, if you're meaning creating a custom component, might work. But I am not certain since deconz uses configuration entries.

The other way would be that you set up a new system by downloading the PR

Managed by creating a custom component (with all *.py files and your customized one).

The fix works like a charm! Google Assistant responds perfect now, no more division errors.

Awesome! I will remove the wip tag then. Thanks for your support!

It seems that Balloob cherry picked this fix for 0.75 🎉