rektdeckard/huebert

Error on Hue White bulbs

scruffles opened this issue · 9 comments

I had a bit a trouble getting huebert running without modification. It appears that three of my bulbs don't have some information expected by utils.convertHSBToColor. It returns undefined. I got it running by having it return '#ff0000' at the end of the function as a fall through. From the debugger, I can see the state passed into convertHSBToColor by LightItem includes values like this:

alert: "none"
bri: 254
mode: "homeautomation"
on: true
reachable: true

obviously no values for hue and state. This happens for 4 bulbs, and I believe they are my only white ambiance bulbs (no color to query).

Thanks for that! It looks like it's an issue converting Hue's silly "Mired" color temperature scale used for non-RGB bulbs to an RGB value for the color picker, and vice versa. I though I worked this out a while ago, but I'll take another pass at it.

@scruffles wait, are these bulbs Hue White bulbs, or Hue Ambiance White bulbs?

I can see the state passed into convertHSBToColor by LightItem includes values like this:

alert: "none"
bri: 254
mode: "homeautomation"
on: true
reachable: true

Is this the whole state object? If not, can you post it?

ah.. it looks like the bulbs its having trouble with are Hue White A19. Yes, that was the whole state object

Gotcha! Yeah I hadn't even thought to test this since I don't own any Hue White bulbs, but the color picker should obviously not be shown at all in this case. Hotfix incoming in the next few minutes.

there seems to be a related issue in RoomItem. Line 8 filters everything without a hue. If the room is all Hue White bulbs, the array is empty and line 13 throws an exception. Giving it a default keeps it running:

const textColor = compatibleText(colors[0] || '#FF0000');

Yessir. I'll do a pass through for any other cases related to Hue White bulbs with no color or CT value.

@scruffles Just pushed a patch, let me know if it's working for you.

looks good