From 127acb550bde73bbde38bf814de37529527e2274 Mon Sep 17 00:00:00 2001 From: kroimon Date: Mon, 22 Jun 2020 23:44:32 +0200 Subject: [PATCH 1/2] Add ZHA support for HueDimmerController This adds (limited) support for using the HueDimmerController with ZHA. At least for my dimmer, no hold-events for the on and off buttons were created, so I could not add those. --- apps/controllerx/devices/philips.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/controllerx/devices/philips.py b/apps/controllerx/devices/philips.py index 4a48b748..072324ff 100644 --- a/apps/controllerx/devices/philips.py +++ b/apps/controllerx/devices/philips.py @@ -40,6 +40,16 @@ def get_deconz_actions_mapping(self) -> TypeActionsMapping: 4003: Light.RELEASE, } + def get_zha_actions_mapping(self) -> TypeActionsMapping: + return { + "on": Light.ON, + "step_0_30_9": Light.CLICK_BRIGHTNESS_UP, + "step_0_56_9": Light.HOLD_BRIGHTNESS_UP, + "step_1_30_9": Light.CLICK_BRIGHTNESS_DOWN, + "step_1_56_9": Light.HOLD_BRIGHTNESS_DOWN, + "off_with_effect_0_0": Light.OFF, + "stop": Light.RELEASE, + } class Niko91004LightController(LightController): def get_deconz_actions_mapping(self) -> TypeActionsMapping: From 0c692a4c7667a56631ef73ac31d5fe507e8f5ecd Mon Sep 17 00:00:00 2001 From: Xavi Date: Tue, 23 Jun 2020 23:33:32 +0200 Subject: [PATCH 2/2] docs(controller): add Hue Dimmer Switch documentation for ZHA related to #92 --- apps/controllerx/devices/philips.py | 1 + docs/_data/controllers/hue-dimmer-switch.yml | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/apps/controllerx/devices/philips.py b/apps/controllerx/devices/philips.py index 072324ff..ae04a7b2 100644 --- a/apps/controllerx/devices/philips.py +++ b/apps/controllerx/devices/philips.py @@ -51,6 +51,7 @@ def get_zha_actions_mapping(self) -> TypeActionsMapping: "stop": Light.RELEASE, } + class Niko91004LightController(LightController): def get_deconz_actions_mapping(self) -> TypeActionsMapping: return { diff --git a/docs/_data/controllers/hue-dimmer-switch.yml b/docs/_data/controllers/hue-dimmer-switch.yml index 415810d3..0f37be55 100644 --- a/docs/_data/controllers/hue-dimmer-switch.yml +++ b/docs/_data/controllers/hue-dimmer-switch.yml @@ -48,3 +48,16 @@ integrations: - "4001 🠖 Hold \"O\"" - "4002 🠖 Click release \"O\"" - "4003 🠖 Hold release \"O\"" + - name: ZHA + codename: zha + actions: + - "on 🠖 Click \"I\"" + - "step_0_30_9 🠖 Click 🔆" + - "step_0_56_9 🠖 Hold 🔆" + - "step_1_30_9 🠖 Click 🔅" + - "step_1_56_9 🠖 Hold 🔅" + - "off_with_effect_0_0 🠖 Click \"O\"" + - "stop 🠖 Release brightness buttons" +note: >- + For ZHA integration, the hold events just work for the brightness buttons, + and they are fired right after the click events. \ No newline at end of file