-
-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Fix ValueError when turning on blebox light with brightness set to 0 #170769
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -201,6 +201,10 @@ async def async_turn_on(self, **kwargs: Any) -> None: | |
| else: | ||
| value = feature.apply_brightness(value, brightness) | ||
|
|
||
| if isinstance(value, (list, tuple)) and not any(value): | ||
| await self._feature.async_off() | ||
| return | ||
|
Comment on lines
+204
to
+206
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The guard is intentionally on the post-processed value. Apply_brightness with brightness=0 always produces all-zero list/tuple for every color mode we handle, and no code path here produces a scalar. Checking brightness == 0 early would also miss cases where brightness comes implicitly from rgb/rgbww. |
||
|
|
||
| try: | ||
| await self._feature.async_on(value) | ||
| except ValueError as exc: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async_turn_off calls async_off() without any try/except either, so the error handling is already consistent. Neither path wraps it.