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

[mqtt.homeassistant] interpret a dimmable light as OFF properly from zigbee2mqtt #15925

Conversation

ccutrer
Copy link
Contributor

@ccutrer ccutrer commented Nov 19, 2023

zigbee2mqtt can send a brightness of say 99, with a state of OFF, when a bulb is off. make sure if state is sent, it overrides all other inferences

…zigbee2mqtt

zigbee2mqtt can send a brightness of say 99, with a state of OFF, when a bulb is
off. make sure if state is sent, it overrides all other inferences

Signed-off-by: Cody Cutrer <[email protected]>
@ccutrer ccutrer requested a review from lolodomo November 19, 2023 16:58
@ccutrer ccutrer requested a review from antroids as a code owner November 19, 2023 16:58
@ccutrer ccutrer added the bug An unexpected problem or unintended behavior of an add-on label Nov 19, 2023
@antroids
Copy link
Contributor

Will this work with brightness color mode?

@ccutrer
Copy link
Contributor Author

ccutrer commented Nov 19, 2023

yes. if the device sends "state": "ON", "brightness": 128, the channel will have state 50% (assuming default max of 255). if it sends "state": "ON", "brightness": 255, the channel will have state 100%. if it sends "state": "OFF", "brightness": 0, the channel will have state 0. Critically, if the device sends "state": "OFF", "brightness": 128, the channel will have state 0, not 50%. This is how my Hue bulbs connected via zigbee2mqtt work. And given that zigbee2mqtt is a very common way to use signee with Home Assistant, I feel fairly confident that this is how all Home Assistant MQTT devices are expected to work.

@antroids
Copy link
Contributor

if it sends "state": "OFF", "brightness": 0, the channel will have state 0.

It seems the brightnessValue will not be updated:
if (jsonState.brightness != null && !off) {

@ccutrer
Copy link
Contributor Author

ccutrer commented Nov 19, 2023

Oh man, you're right. I have it handle for a color+brightness bulb, but not a brightness only bulb.

Copy link
Contributor

@antroids antroids left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

@lolodomo lolodomo merged commit 9d214b0 into openhab:main Nov 25, 2023
2 checks passed
@lolodomo lolodomo added this to the 4.1 milestone Nov 25, 2023
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Nov 26, 2023
…zigbee2mqtt (openhab#15925)

* [mqtt.homeassistant] interpret a dimmable light as OFF properly from zigbee2mqtt

zigbee2mqtt can send a brightness of say 99, with a state of OFF, when a bulb is
off. make sure if state is sent, it overrides all other inferences

* handle brightness but not color bulbs

---------

Signed-off-by: Cody Cutrer <[email protected]>
@ccutrer ccutrer deleted the mqtt-homeassistant-dimmable-light-off-from-zigbee2mqtt branch November 29, 2023 22:45
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
…zigbee2mqtt (openhab#15925)

* [mqtt.homeassistant] interpret a dimmable light as OFF properly from zigbee2mqtt

zigbee2mqtt can send a brightness of say 99, with a state of OFF, when a bulb is
off. make sure if state is sent, it overrides all other inferences

* handle brightness but not color bulbs

---------

Signed-off-by: Cody Cutrer <[email protected]>
Signed-off-by: Jørgen Austvik <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants