Skip to content
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

Added ZHA support for Philips929002398602LightController #580

Merged
merged 3 commits into from
Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ _This minor change does not contain any breaking changes._
## :pencil2: Features
-->

<!--
## :hammer: Fixes
-->

- Fix Z2M and deCONZ default mapping for [Philips929002398602](https://BASE_URL/controllerx/controllers/Philips929002398602). [ #580 ]

<!--
## :clock2: Performance
Expand All @@ -26,8 +26,6 @@ _This minor change does not contain any breaking changes._

- Update minimum supported Python version to 3.8

<!--
## :video_game: New devices

- [XYZ](https://BASE_URL/controllerx/controllers/XYZ) - add device with Z2M support. [ #123 ]
-->
- [Philips929002398602](https://BASE_URL/controllerx/controllers/Philips929002398602) - add ZHA support. [ #580 ] @cznewt @ScratMan
32 changes: 26 additions & 6 deletions apps/controllerx/cx_devices/philips.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,36 +78,56 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
class Philips929002398602LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on_press_release": Light.ON,
"on_hold": Light.HOLD_COLOR_UP,
"on_press_release": Light.TOGGLE,
"on_hold": Light.TOGGLE,
"on_hold_release": Light.RELEASE,
"up_press_release": Light.CLICK_BRIGHTNESS_UP,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_hold_release": Light.RELEASE,
"down_press_release": Light.CLICK_BRIGHTNESS_DOWN,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_hold_release": Light.RELEASE,
"off_press_release": Light.OFF,
"off_press_release": Light.CLICK_COLOR_UP,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_hold_release": Light.RELEASE,
}

def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
return {
1002: Light.ON,
1001: Light.HOLD_COLOR_UP,
1002: Light.TOGGLE,
1001: Light.TOGGLE,
1003: Light.RELEASE,
2002: Light.CLICK_BRIGHTNESS_UP,
2001: Light.HOLD_BRIGHTNESS_UP,
2003: Light.RELEASE,
3002: Light.CLICK_BRIGHTNESS_DOWN,
3001: Light.HOLD_BRIGHTNESS_DOWN,
3003: Light.RELEASE,
4002: Light.OFF,
4002: Light.CLICK_COLOR_UP,
4001: Light.HOLD_COLOR_DOWN,
4003: Light.RELEASE,
}

def get_zha_actions_mapping(self) -> DefaultActionsMapping:
return {
"off_long_release": Light.RELEASE,
"off_hold": Light.HOLD_COLOR_DOWN,
"off_short_release": Light.CLICK_COLOR_UP,
"down_long_release": Light.RELEASE,
"down_hold": Light.HOLD_BRIGHTNESS_DOWN,
"down_short_release": Light.CLICK_BRIGHTNESS_DOWN,
"up_long_release": Light.RELEASE,
"up_hold": Light.HOLD_BRIGHTNESS_UP,
"up_short_release": Light.CLICK_BRIGHTNESS_UP,
"on_long_release": Light.RELEASE,
"on_hold": Light.TOGGLE,
"on_short_release": Light.TOGGLE,
}

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


class Philips929002398602Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
Expand Down