-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(device): add TS0044 TuYa device
Z2M support related to #240
- Loading branch information
Showing
6 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from cx_const import DefaultActionsMapping, Light | ||
from cx_core import LightController | ||
|
||
|
||
class TS0044LightController(LightController): | ||
def get_z2m_actions_mapping(self) -> DefaultActionsMapping: | ||
return { | ||
"1_single": Light.TOGGLE, | ||
"1_double": Light.CLICK_BRIGHTNESS_UP, | ||
"1_hold": Light.CLICK_BRIGHTNESS_DOWN, | ||
"2_single": Light.TOGGLE, | ||
"2_double": Light.CLICK_BRIGHTNESS_UP, | ||
"2_hold": Light.CLICK_BRIGHTNESS_DOWN, | ||
"3_single": Light.TOGGLE, | ||
"3_double": Light.CLICK_BRIGHTNESS_UP, | ||
"3_hold": Light.CLICK_BRIGHTNESS_DOWN, | ||
"4_single": Light.TOGGLE, | ||
"4_double": Light.CLICK_BRIGHTNESS_UP, | ||
"4_hold": Light.CLICK_BRIGHTNESS_DOWN, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: TS0044 (TuYa) | ||
device_support: | ||
- type: Light | ||
domain: light | ||
controller: TS0044LightController | ||
delay: 350 | ||
mapping: | ||
- "Click top left → Toggle" | ||
- "Double click top left → Brighten up (1 step)" | ||
- "Hold top left → Dim down (1 step)" | ||
- "Click top right → Toggle" | ||
- "Double click top right → Brighten up (1 step)" | ||
- "Hold top right → Dim down (1 step)" | ||
- "Click bottom left → Toggle" | ||
- "Double click bottom left → Brighten up (1 step)" | ||
- "Hold bottom left → Dim down (1 step)" | ||
- "Click top right → Toggle" | ||
- "Double click top right → Brighten up (1 step)" | ||
- "Hold top right → Dim down (1 step)" | ||
integrations: | ||
- name: Zigbee2MQTT | ||
codename: z2m | ||
actions: | ||
- 1_single → Click top left | ||
- 1_double → Double click top left | ||
- 1_hold → Hold top left | ||
- 2_single → Click top right | ||
- 2_double → Double click top right | ||
- 2_hold → Hold top right | ||
- 3_single → Click bottom left | ||
- 3_double → Double click bottom left | ||
- 3_hold → Hold bottom left | ||
- 4_single → Click top right | ||
- 4_double → Double click top right | ||
- 4_hold → Hold top right | ||
note: >- | ||
Note that each button perform the same actions. | ||
This is because ControllerX is design to control just one entity (light or media player). | ||
So you can include the `actions` parameter to include the actions needed, | ||
or use the `mapping` attribute to define a <a href="/controllerx/advanced/custom-controllers">custom mapping</a>. | ||
You can check <a href="https://github.com/xaviml/controllerx/issues/18#issuecomment-582535634">here</a> for reference. | ||
Also, this controller support hold action, but not release. This means that there is not | ||
smooth brightness changes when holding, just step by step everytime is held. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
layout: controller | ||
title: TS0044 (TuYa) | ||
device: TS0044 | ||
--- |