Skip to content

Commit

Permalink
Add the on_off call in the move_to_level_with_on_off command (#1754)
Browse files Browse the repository at this point in the history
* Implement the `move_to_level_with_on_off` command 

Implement the `on_off` call in the `move_to_level_with_on_off` command for the MCU Tuya devices.
The previous implementation was removed in #1748. Originally introduced in #1489

* Fix black coverage
  • Loading branch information
javicalle committed Sep 25, 2022
1 parent 939a944 commit 70d2b9f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion zhaquirks/tuya/mcu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,23 @@ async def command(
command_id,
args,
)
# (move_to_level_with_on_off --> send the on_off command first)
if command_id == 0x0004:
cluster_data = TuyaClusterData(
endpoint_id=self.endpoint.endpoint_id,
cluster_attr="on_off",
attr_value=bool(
args[0]
), # maybe must be compared against `minimum_level` attribute
expect_reply=expect_reply,
manufacturer=manufacturer,
)
self.endpoint.device.command_bus.listener_event(
TUYA_MCU_COMMAND,
cluster_data,
)

# (move_to_level, move, move_to_level_with_on_off)
# (move_to_level_with_on_off --> ZHA have the `ForceOnLight` implementation)
if command_id in (0x0000, 0x0001, 0x0004):
cluster_data = TuyaClusterData(
endpoint_id=self.endpoint.endpoint_id,
Expand Down

0 comments on commit 70d2b9f

Please sign in to comment.