Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] light unavailable after 2022.9.0 upadate #713

Open
damianbraun opened this issue Sep 7, 2022 · 54 comments
Open

[BUG] light unavailable after 2022.9.0 upadate #713

damianbraun opened this issue Sep 7, 2022 · 54 comments
Assignees
Labels
enhancement New feature or request fixed
Milestone

Comments

@damianbraun
Copy link

Environment

  • ShellyForHASS release with the issue: 1.0.1
  • Last working ShellyForHASS release (if known): 1.0.1 (under homeassiastant 2022.8.7
  • Home Assistant Core release with the issue: 2022.9.0
  • Operating environment (Home Assistant/Supervised/Docker/venv): HomeAssistant

Describe the bug

After 2022.9.0 update, light entities of shelly dimmer 2's became unavailable.

Steps to Reproduce

Expected behavior

Screenshots

Traceback/Error logs

Logger: homeassistant.setup
Source: setup.py:320
First occurred: 20:14:23 (3 occurrences)
Last logged: 20:21:03

Unable to prepare setup for platform shelly.light: Platform not found (cannot import name 'ATTR_WHITE_VALUE' from 'homeassistant.components.light' (/usr/src/homeassistant/homeassistant/components/light/init.py)).

Additional context

@kingunlim
Copy link

second this

@emilio77
Copy link

emilio77 commented Sep 7, 2022

third with same problem

@HFeenstra
Copy link

HFeenstra commented Sep 7, 2022

Second this too. I thought I was the only one with issue, until I just found this bug.
Was thinking towards 2022.9 update of HA

Have this notification:
The following integrations and platforms could not be set up:

shelly.light (Show logs)
Please check your config and logs.

Looking into logs, nothing to find there.

@Olausson92
Copy link

Same problem after I updated to HA 20220907-0 today.

Logger: homeassistant.setup
Source: setup.py:320
First occurred: 21:42:46 (1 occurrences)
Last logged: 21:42:46

Unable to prepare setup for platform shelly.light: Platform not found (cannot import name 'ATTR_WHITE_VALUE' from 'homeassistant.components.light' (/usr/src/homeassistant/homeassistant/components/light/__init__.py)).

@mattlamb99
Copy link

Same issue after todays upgrade.

Logger: homeassistant.setup
Source: setup.py:320
First occurred: 8:33:12 AM (1 occurrences)
Last logged: 8:33:12 AM

Unable to prepare setup for platform shelly.light: Platform not found (cannot import name 'ATTR_WHITE_VALUE' from 'homeassistant.components.light' (/usr/src/homeassistant/homeassistant/components/light/init.py)).

@mattlamb99
Copy link

mattlamb99 commented Sep 7, 2022

Found the issue cause:
Remove white_value support from light (@emontnemery - #76926) (light docs) (group docs) (flux docs) (switch_as_x docs)

@HFeenstra
Copy link

Found the issue cause:
Remove white_value support from light (@emontnemery - #76926) (light docs) (group docs) (flux docs) (switch_as_x docs)

Let’s hope someone can have a look at it. Hmm something was ready to get removed 1,5 years ago..?? Finally removed, I guess I missed the breaking changes

@mattlamb99
Copy link

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights
#714

@arturkoko
Copy link

Same issue

@damianbraun damianbraun changed the title [BUG] [BUG] light unavailable after 2022.9.0 upadate Sep 8, 2022
@antoweb
Copy link

antoweb commented Sep 8, 2022

same issue

@antoweb
Copy link

antoweb commented Sep 8, 2022

any solution or we are waiting for a new release?

@Moxser
Copy link

Moxser commented Sep 8, 2022

I have the same problem.

Logger: homeassistant.setup
Source: setup.py:320
First occurred: 11:04:32 (1 occurrences)
Last logged: 11:04:32

Unable to prepare setup for platform shelly.light: Platform not found (cannot import name 'ATTR_WHITE_VALUE' from 'homeassistant.components.light' (/usr/src/homeassistant/homeassistant/components/light/init.py)).

@kingunlim
Copy link

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights
#714

hey thx, how can i use your fix?

best regards

@piet1951
Copy link

piet1951 commented Sep 8, 2022

Same problem, I restored a backup. What to do now ?

@jacko85
Copy link

jacko85 commented Sep 8, 2022

Note this is affecting other integrations since 2022.9 also basnijholt/adaptive-lighting#336

@antoweb
Copy link

antoweb commented Sep 8, 2022

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights
#714

hey thx, how can i use your fix?

best regards

Just remove this lines from light.py

ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,

   if ATTR_WHITE_VALUE in kwargs:
        white_value = int(kwargs[ATTR_WHITE_VALUE])
        self._white_value = white_value

as speciifed in this url: ca4b860

and restart HA

@kingunlim
Copy link

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights
#714

hey thx, how can i use your fix?
best regards

Just remove this lines from light.py

ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
   if ATTR_WHITE_VALUE in kwargs:
        white_value = int(kwargs[ATTR_WHITE_VALUE])
        self._white_value = white_value

as speciifed in this url: ca4b860

and restart HA

can you tell me what is the path to this file?
thx best regards

@antoweb
Copy link

antoweb commented Sep 8, 2022

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights
#714

hey thx, how can i use your fix?
best regards

Just remove this lines from light.py

ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,
   if ATTR_WHITE_VALUE in kwargs:
        white_value = int(kwargs[ATTR_WHITE_VALUE])
        self._white_value = white_value

as speciifed in this url: ca4b860
and restart HA

can you tell me what is the path to this file? thx best regards

config\custom_components\shelly\light.py

@kingunlim
Copy link

@antoweb
thank you very much! :)
Strange thing, the light entities are very slow now, but i just checked from extern @work, so i must check when im at home.

@antoweb
Copy link

antoweb commented Sep 8, 2022

You are welcome. But this is a workaround, we are waiting for a definitive solution

@hakana
Copy link
Contributor

hakana commented Sep 8, 2022

We working on a new release.

@Ragbak99
Copy link

Ragbak99 commented Sep 8, 2022

After deleting those lines the error is gone. Thanx

@david-kalbermatten
Copy link

Duplicate of #706

@doug62
Copy link

doug62 commented Sep 9, 2022

+1 - Same problem

@dolenec
Copy link

dolenec commented Sep 9, 2022

Any timeline when the fix will be officially published?

@Friedrieck
Copy link

ATTR_WHITE_VALUE,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_EFFECT,
SUPPORT_WHITE_VALUE,

To those wanting to correct it by themselves, keep the second line of this block above (as specified in the original fix: ca4b860).

@TohtoriR
Copy link

TohtoriR commented Sep 9, 2022

same issue here. I'm not in a hurry with the fix as restored a backup but would obviously like to have the new bells and whistles from the new core. When could this fix be expected roughly? I do have those rgbw bulbs so the workaround is probably not for me.

@tmjo
Copy link

tmjo commented Sep 9, 2022

Same issue, please fix. The "manual" fix referenced above fixes the issue for me temporarily (Dimmer2).

@dreerr
Copy link

dreerr commented Sep 10, 2022

To simplify it even further, remove ONLY the red lines, and leave everything else as is. image

Close the file and restart HA.

I can also confirm that the temporary fix is working, I had issues with Shelly Bulb Duo and Shelly Dimmer

@pljda
Copy link

pljda commented Sep 11, 2022

To simplify it even further, remove ONLY the red lines, and leave everything else as is. image
Close the file and restart HA.

I can also confirm that the temporary fix is working, I had issues with Shelly Bulb Duo and Shelly Dimmer

Unfortunately it did not worked for me :(
Neither the Dimmer2 nor the Duo
Hope Shelly will issue an update on this matter !

@bjeanes
Copy link

bjeanes commented Sep 11, 2022

That diff is not complete, I think. You also have to delete the line which references SUPPORT_WHITE_VALUE. I have the Dimmer 2 and it did work for me.

@SamKr
Copy link

SamKr commented Sep 12, 2022

Same problem here

@vorreiter
Copy link

Same problem

@taanczos
Copy link

Same here :( my fishes now lack of sunrise and moonlight :P

@hakana hakana self-assigned this Sep 12, 2022
@hakana hakana added enhancement New feature or request fixed labels Sep 12, 2022
@hakana hakana added this to the 1.0.2 milestone Sep 12, 2022
@hakana
Copy link
Contributor

hakana commented Sep 12, 2022

I have created a new release 1.0.2. Now it is in pre-release/beta mode. Can you please test and I will change it to a full release shortly.

@hakana
Copy link
Contributor

hakana commented Sep 12, 2022

This fix removes the white_channel for RGBW2 in color mode. We looking for a solution for this.
I think the only solution is to add another entity for the white channel in parallel to the RGB entity. Does someone know a better solution? I'm very busy right now so any help is needed!

@taanczos
Copy link

Hey! Thank you. It works for my rgbw2 and shelly dimmers. But I dont use the white channel with the rgbw2 only the rgb.

@pljda
Copy link

pljda commented Sep 12, 2022

I have created a new release 1.0.2. Now it is in pre-release/beta mode. Can you please test and I will change it to a full release shortly.

Hi Hakana, I think that you made it. My Dimmer & Duo lights are back to life :) This is good news.
Thanks for your quick action !
philippe

@Dilergore
Copy link

Dilergore commented Sep 13, 2022

@hakana - I think that solution should be okay. Anyway I do not think anyone is using White + RGB at the same time. Even on the UI I have a single slider for brightness today which I control differently: if 'white_value > 0' I change white_value else I control brightness. In addition I have several pre-defined colors for easy change and there is one which changes brightness to '1' and white_value to 255 (so this is the white setting basically).

I've been using MQTT so far for RGBW2 but even with that the issue is the same. You could use the default light template and more or less it works, but it is not perfect.

Another workable solution I could imagine is to have a virtual 'mode' switch which needs to be set either 'white' or 'RGB' and the brightness would control the white brightness in white mode and the RGB brightness in RGB mode.

@dolenec
Copy link

dolenec commented Sep 13, 2022

Maybe it is just time to migrate to native Shelly integration.. I thought that this integration would be up-to-date not that something is forgotten to be implemented and that author do not have time.. sorry - but this is probably something that author need to be hear..

If there is no time, no problem, but be honest and publish this and give project to someone else.. simply my humble opinion.

PS. this so called hotfix broke rgbw2 behaive as was before, so it is not hotfix but half way baked patch..

@SamKr
Copy link

SamKr commented Sep 13, 2022

@dolenec you know they're sharing this for free, developing it in their own spare time? It's not a product you've bought. The speed with which they deployed this hotfix (even though the auther mentioned he's very busy atm) is something to thank them for, not to get annoyed at :\ Also, he repeatedly asked for help, so there's no option to 'give it to someone else' as noone has the skills and time to help.

Perhaps you'd be better off buying something off the shelves?

@david-kalbermatten
Copy link

Another workable solution I could imagine is to have a virtual 'mode' switch which needs to be set either 'white' or 'RGB' and the brightness would control the white brightness in white mode and the RGB brightness in RGB mode.

That's actually what the new ColorMode.WHITE is supposed to be used for. See: home-assistant/core#51411 and https://developers.home-assistant.io/docs/core/entity/light/#color-modes

@fh-lipweeyeo
Copy link

Another workable solution I could imagine is to have a virtual 'mode' switch which needs to be set either 'white' or 'RGB' and the brightness would control the white brightness in white mode and the RGB brightness in RGB mode.

That's actually what the new ColorMode.WHITE is supposed to be used for. See: home-assistant/core#51411 and https://developers.home-assistant.io/docs/core/entity/light/#color-modes

Note that there is actually an enum called ColorMode.RGBW in the link.

@doug62
Copy link

doug62 commented Sep 13, 2022

FWIW - I purchase cheap LED strips from China, $8/15ft, I have about 15 RGBW2s, I DO USE RGB+W to change the color/temperature of the whites, There is a way to control W+RGB, the WIZ integration does this, there is also a way to factor W into the RBG in some color spaces, I haven't reviewed the details but: 1) Folks do use RGB+W; 2) There is an existing pattern (WIZ) And sorry - though I'm experienced C# dev I know/care nothing about Python so can't really contribute but THANKS to those who do!

@doug62
Copy link

doug62 commented Sep 16, 2022

Assuming that this broke RGBW (which I'm heavily dependent upon), it is probably time to move to the native integration - does anyone know of any reasons why/how to do this? Is one "better" than the other?

@bigboban
Copy link

It's a trap! This integration has RGBW feature broken. And official HA integration does NOT support Shelly4pro. For me there is no fully functional integration for all shelly devices. Only way is use one or other integration and integrate unsupported device(s) some other way (REST, MQTT, ..).

@doug62
Copy link

doug62 commented Sep 17, 2022

FWIW - The core/shelly does have both color+white on RGBW2

@doug62
Copy link

doug62 commented Sep 17, 2022

@hakana - Thanks for your work, earlier you were asking for a pattern, i have confirmed that the core shelly rgbw2 works same as this used to flawlessly, I'm not a python dev, looking at their code at https://github.dev/home-assistant/core/blob/38b087d2209dbe26f90676ecebf90fc1b97836e3/homeassistant/components/shelly/light.py#L12

@hakana
Copy link
Contributor

hakana commented Sep 17, 2022 via email

@doug62
Copy link

doug62 commented Sep 17, 2022

WIZ: (Color)
image

WIZ Temperature:
image

LIFX:
image

@david-kalbermatten
Copy link

How is it working in core integration. Is there two entities, one for rgb and one for white channel? Can you take a screen shot?

The core integration offers white brightness and color brightness but the overall brightness slider only affects the RGB component.
image

@Dilergore
Copy link

Dilergore commented Sep 28, 2022

I have a more or less working setup with MQTT default light schema, if you want to use it just change the <deviceId> to the proper value:

mqtt:
  light:
    - name: "ledstrip"
      qos: 2
      rgbw_command_topic: "shellies/shellyrgbw2-<deviceId>/color/0/set"
      rgbw_state_topic: "shellies/shellyrgbw2-<deviceId>/color/0/status"
      rgbw_command_template: >
        {"red": {{ red }}, "green": {{ green }}, "blue": {{ blue }}, "white": {{ white }} }
      rgbw_value_template: > 
        {{value_json.red|int}},{{value_json.green|int}},{{value_json.blue|int}},{{value_json.white|int}}
      brightness_scale: 100
      brightness_command_topic: "shellies/shellyrgbw2-<deviceId>/color/0/set"
      brightness_state_topic: "shellies/shellyrgbw2-<deviceId>/color/0/status"
      brightness_command_template: >
        {%- if value == 1 -%}
          { "gain": 0 }
        {%- else -%}
          { "gain": {{ value }} }
        {%- endif -%}
      brightness_value_template: "{{ value_json.gain }}"
      command_topic: "shellies/shellyrgbw2-<deviceId>/color/0/command"
      state_topic: "shellies/shellyrgbw2-<deviceId>/color/0/status"
      payload_on: "on"
      payload_off: "off"
      state_value_template: >
        {%- if value_json.ison -%}
          on
        {%- else -%}
          off
        {%- endif -%}
      effect_list:
        - 0
        - 1
        - 2
        - 3
        - 4
        - 5
        - 6
      effect_command_topic: "shellies/shellyrgbw2-<deviceId>/color/0/set"
      effect_state_topic: "shellies/shellyrgbw2-<deviceId>/color/0/status"
      effect_command_template: >
        {"effect": {{ value }} }
      effect_value_template: "{{ value_json.effect }}"

The way this works is the following:

  • Brightness controls RGB only
  • On the more-info dialog there is a "Color Brightness" which is basically just changing RGB values with a slider between 0-255 (more or less useless if ask me)
  • On the more-info dialog there is a "White Brightness" slider which can be used to control the White channel.

The problem with this in general is that while the normal more-info dialog has an option for "White Brightness", you cannot add it on the UI in any way as a slider (or I haven't yet found an option).

Update 9/29/2022:

I realized I had a bug in the above code, so I updated the post with the working one. After fixing some of the issues, I can confirm that I can control the white value with a slider using slider-entity-row. Using the above I have a working setup which does the exact same as before.

Also please note that the brightness_command_template is defined in a way that if `brightness' equals to 1 that is actually 0. It is this way to be able to change gain to 0 without turning the light off (In case you only want white and no RGB).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed
Projects
None yet
Development

No branches or pull requests