Skip to content

Commit

Permalink
feat(device): add ZHA support for E1812
Browse files Browse the repository at this point in the history
related to #324
  • Loading branch information
xaviml committed Jun 24, 2021
1 parent 7f0658f commit e134ea0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
17 changes: 17 additions & 0 deletions apps/controllerx/cx_devices/ikea.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
SwitchController,
action,
)
from cx_core.integration import EventData


class E1810Controller(LightController):
Expand Down Expand Up @@ -503,6 +504,16 @@ def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
1003: Light.RELEASE,
}

def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.TOGGLE,
"move_with_on_off": Light.HOLD_BRIGHTNESS_TOGGLE,
"stop": Light.RELEASE,
}

def get_zha_action(self, data: EventData) -> str:
return data["command"]


class E1812SwitchController(SwitchController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
Expand All @@ -511,6 +522,12 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {1002: Switch.TOGGLE}

def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {"on": Light.TOGGLE}

def get_zha_action(self, data: EventData) -> str:
return data["command"]


class W2049LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
Expand Down
8 changes: 7 additions & 1 deletion docs/_data/controllers/E1812.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ integrations:
- name: Zigbee2MQTT
codename: z2m
actions:
- "on → Click"
- '"on" → Click'
- "brightness_move_up → Hold"
- "brightness_stop → Released after being held"
- name: deCONZ
Expand All @@ -25,3 +25,9 @@ integrations:
- "1002 → Click"
- "1001 → Hold"
- "1003 → Released after being held"
- name: ZHA
codename: zha
actions:
- '"on" → Click'
- "move_with_on_off → Hold"
- "stop → Released after being held"

0 comments on commit e134ea0

Please sign in to comment.