Hypfer / hass-scene_presets

Hue-like scene presets for lights in home assistant
Apache License 2.0
107 stars 7 forks source link

Issue running in a few scenes #11

Closed peros550 closed 8 months ago

peros550 commented 8 months ago

First, let me congratulate you for your idea and efforts in bringing these scenes in HA.

I have some old Hue bulbs, but when they fail I choose to replace them with Wiz , which also come from same company (Signify) at a much affordable price. The one thing missing was scenes and interoperability with older bulbs, and I just found your integration and gave it a try.

Running the scenes against Wiz bulbs, the colors do not match the picture. They tend to stuck in a range of white.

And in a few scenes (Motown, Tokyo, , I got the following error :

Logger: homeassistant.config_entries
Source: config_entries.py:406
First occurred: 6:50:37 PM (1 occurrences)
Last logged: 6:50:37 PM

Error setting up entry scene_presets for scene_presets
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 406, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/scene_presets/__init__.py", line 178, in async_setup_entry
    await async_setup_view(hass)
  File "/config/custom_components/scene_presets/view.py", line 25, in async_setup_view
    hass.components.frontend.async_register_built_in_panel(
  File "/usr/src/homeassistant/homeassistant/components/frontend/__init__.py", line 303, in async_register_built_in_panel
    raise ValueError(f"Overwriting panel {panel.frontend_url_path}")
ValueError: Overwriting panel scene_presets

If you need me to provide more logs, let me know.

Thanks

Hypfer commented 8 months ago

The logs are entirely unrelated to any interaction in the UI including any specific scenes.

Have you set up multiple config entries? Because that's what triggers the logline for me and sounds plausible as something that might happen by accident. image

As for the Wiz bulbs.. yeah. I'm not surprised that different Vendors use different LEDs with different calibration and thus don't have matching colors. This is nothing new, unusual or related to this custom component.

peros550 commented 8 months ago

OK removed the extra service and restarted HA.

I get the following message sometimes as a notification "Failed to call service scene_presets/apply_preset. value must be at least 0 for dictionary value @ data['kelvin']"

Any way to make the colors work for Wiz bulbs? Something I can do on my end?

Hypfer commented 8 months ago

Colors don't work at all? I understood the description as "Colors are not exactly the same between Wiz and Hue".

Can you share a screenshot of one of those wiz lights in the devtools view including all attributes on the right?

peros550 commented 8 months ago

thanks for taking the time to look into this. Here are the states from dev screen.

`min_color_temp_kelvin: 2202
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 454
effect_list:
  - Ocean
  - Romance
  - Sunset
  - Party
  - Fireplace
  - Cozy
  - Forest
  - Pastel Colors
  - Wake up
  - Bedtime
  - Warm White
  - Daylight
  - Cool white
  - Night light
  - Focus
  - Relax
  - True colors
  - TV time
  - Plantgrowth
  - Spring
  - Summer
  - Fall
  - Deepdive
  - Jungle
  - Mojito
  - Club
  - Christmas
  - Halloween
  - Candlelight
  - Golden white
  - Pulse
  - Steampunk
  - Rhythm
supported_color_modes:
  - color_temp
  - rgbw
color_mode: color_temp
brightness: 135
color_temp_kelvin: 2932
color_temp: 341
hs_color:
  - 27.941
  - 58.774
rgb_color:
  - 255
  - 174
  - 105
xy_color:
  - 0.503
  - 0.383
rgbw_color: null
effect: null
friendly_name: Desk Light
supported_features: 4`
image image
Hypfer commented 8 months ago

Oooh so that's what that was about with that person that mentioned something about rgbw.

Okay, so lights with a color_mode of rgbw exist. The code currently only checks for xy, hs and rgb and if those don't exist, it will check for color_temp and attempt to convert the rgb color to a color temperature.

That's why you only get shades of white. This conversion code isn't clamping the output value properly and that's where this kelvin error message is coming from.

Regarding the Wiz bulbs: What I can do is add rgbw to the list of supported_color_modes that allow color. However since I don't have an rgbw bulb, I don't know if that's enough or if it will require to also send a w value of 0 or something like that.

That's something you can test though.

service: light.turn_on
target:
  entity_id: light.<wiz_bulb>
data:
  xy_color:
    - 0.1461
    - 0.3543

Running this should turn the light turquoise. Does that work? Does that work coming from different states (previous state being off, just a color, a color with white, only white)?

peros550 commented 8 months ago

yes! it worked. turquoise! Any kind of further test, more than happy to run.

Hypfer commented 8 months ago

Please try version 1.1.2 that was just released. Hopefully that should fix everything

peros550 commented 8 months ago

Many thanks! It works nice ! :)