-
Notifications
You must be signed in to change notification settings - Fork 728
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
move_to_level_with_on_off
: don't send on_off
when already on
#2015
Conversation
Pull Request Test Coverage Report for Build 3721583172
💛 - Coveralls |
Codecov ReportBase: 83.53% // Head: 83.58% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## dev #2015 +/- ##
==========================================
+ Coverage 83.53% 83.58% +0.05%
==========================================
Files 249 249
Lines 8016 8023 +7
==========================================
+ Hits 6696 6706 +10
+ Misses 1320 1317 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
We kind of handle a bit of this in HA: https://github.com/home-assistant/core/blob/df23f031314b18303d76a99f9f35e40949d3bb22/homeassistant/components/zha/light.py#L287 we have logic in there that determines which method to call. How does this differ? |
Also, whatever is implemented should align to the spec as close as possible. There are some differences in the newest spec for level control devices (we still haven't really updated ZHA to account for it yet.) |
The logic in ZHA solves an opposite problem - it makes sure that the on_off command is additionally issued for some devices. And this PR makes sure it is not called when not needed.
I believe in this PR we do follow the specs. The only difference is that we use min level of 0 instead of 1, but this PR does not change that. I compared against Table 3-146 in Revision 8 ZCL specs. |
On Home Assistant 2023.3.1 with a Moes double dimmer TS0601 signature _TZE200_fjjbhx9d. The lights still flash to 100% every time the dimmer reaches its target value. Is this still a known issue? Is there a quirk tweak to resolve with this device? |
@CobraDunn It's easier to just create a new issue now. |
Fixes #1554
See also: #1748, #1754
The problem:
ZCL defines the
move_to_level_with_on_off
which HAzha
integration uses to control the brightness.The Tuya dimmers don't have this command. The quirk has implemented this command by subsequently issuing
on_off
andmove_to_level
commands.However it was found out that not all Tuya dimmers behave same on the
on_off
command: some of them switch brightness to 100% upon it, that means that changing brightness from 50% to 55% will first briefly transition through 100%.This PR addresses the issue by remembering the current state and only issuing
on_off
command when needed:on_off
, thenmove_to_level
)move_to_level
is issuedon_off
command is issued to switch off the deviceTo save the current state, the
TuyaMCUCluster
was enhanced to save the respective attributes ontuya_mcu_command
.And to do that, an additional field
cluster_name
was added to theTuyaClusterData
struct.