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

Fix: Lights always report "on" state #2331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

romanr
Copy link

@romanr romanr commented Jan 26, 2025

Fixes #2313

  • The is_on method (lines 244-251 in light.py) to checs if prop_brightness is present and use brightness_for_on to determine if the light is on. Even if the power property (on) is false, the brightness might exceed the threshold, causing an incorrect state.

  • To skip the brightness check, added a condition in is_on to check if power_property is configured. Set a flag during initialization (like use_power_property) and use it to decide whether to use the parent class’s is_on (based on power) or the brightness-based check.

  • Fixed the turn_on and turn_off methods in light.py (lines 253-335) may not correctly handle the power property when brightness settings are present.

  • Added device customization to correctly map the power property and exclude brightness from influencing the state. Set ‘power_property’ to ‘on’ and ensure brightness isn’t included in properties that trigger the state check.

The is_on method (lines 244-251 in light.py) checks if prop_brightness is present and uses brightness_for_on to determine if the light is on. Even if the power property (on) is false, the brightness might exceed the threshold, causing an incorrect state.

To skip the brightness check, add a condition in is_on to check if power_property is configured. Set a flag during initialization (like use_power_property) and use it to decide whether to use the parent class’s is_on (based on power) or the brightness-based check.

The turn_on and turn_off methods in light.py (lines 253-335) may not correctly handle the power property when brightness settings are present.

Added device customization should correctly map the power property and exclude brightness from influencing the state. Set ‘power_property’ to ‘on’ and ensure brightness isn’t included in properties that trigger the state check.
@romanr romanr changed the title Fix light state always reporting on #2313 Fix: Lights always report "on" state Feb 11, 2025
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.

Light Ceiling not reporting status
1 participant