StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
616 stars 111 forks source link

[BUG] light unavailable after 2022.9.0 upadate #713

Open damianbraun opened 1 year ago

damianbraun commented 1 year ago

Environment

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 commented 1 year ago

second this

emilio77 commented 1 year ago

third with same problem

HFeenstra commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

HFeenstra commented 1 year ago

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 commented 1 year ago

Have made a very crude fix to at least get most of your lights working again - but this doesn't fix RGBW lights https://github.com/StyraHem/ShellyForHASS/pull/714

arturkoko commented 1 year ago

Same issue

antoweb commented 1 year ago

same issue

antoweb commented 1 year ago

any solution or we are waiting for a new release?

Moxser commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

jacko85 commented 1 year ago

Note this is affecting other integrations since 2022.9 also https://github.com/basnijholt/adaptive-lighting/issues/336

antoweb commented 1 year ago

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: https://github.com/StyraHem/ShellyForHASS/pull/714/commits/ca4b860f6985b3c3e845f74f93bfc9e661a7959e

and restart HA

kingunlim commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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

hakana commented 1 year ago

We working on a new release.

Ragbak99 commented 1 year ago

After deleting those lines the error is gone. Thanx

david-kalbermatten commented 1 year ago

Duplicate of #706

doug62 commented 1 year ago

+1 - Same problem

dolenec commented 1 year ago

Any timeline when the fix will be officially published?

Friedrieck commented 1 year ago

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: https://github.com/StyraHem/ShellyForHASS/commit/ca4b860f6985b3c3e845f74f93bfc9e661a7959e).

convicte commented 1 year ago

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

Close the file and restart HA.

lwYeo commented 1 year ago

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).

This does not fix RGBW2 devices, anyone has a quick workaround for RGBW2?

TohtoriR commented 1 year ago

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 commented 1 year ago

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

dreerr commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Same problem here

vorreiter commented 1 year ago

Same problem

taanczos commented 1 year ago

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

hakana commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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: https://github.com/home-assistant/core/pull/51411 and https://developers.home-assistant.io/docs/core/entity/light/#color-modes

fh-lipweeyeo commented 1 year ago

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: https://github.com/home-assistant/core/pull/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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

doug62 commented 1 year ago

@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