[go: up one dir, main page]

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

Update Group.py #1045

Closed
wants to merge 1 commit into from
Closed

Update Group.py #1045

wants to merge 1 commit into from

Conversation

Warex2020
Copy link

Fix for KeyError: 'bri'
The error occurred because some lights in a group did not have the bri (brightness) key in their state. To resolve this, the .get() method is used to provide a default value of 0 when bri is not available:

bri = bri + light().state.get("bri", 0)
This ensures that the program doesn't fail when the bri key is missing.

Fix for KeyError: 'bri'
The error occurred because some lights in a group did not have the bri (brightness) key in their state. To resolve this, the .get() method is used to provide a default value of 0 when bri is not available:

bri = bri + light().state.get("bri", 0)
This ensures that the program doesn't fail when the bri key is missing.
@hendriksen-mark
Copy link
Member

Hi thanks for your pull request, the problem with doing it this way is that if its a device without brightness(a plug for example) it is still added to the average causing the average to be lower then the real average. I have a better solution i will push soon.

@hendriksen-mark
Copy link
Member

hi, i made changes to fix this. please try and give feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants