Skip to content

Commit

Permalink
Merge pull request #509 from xaviml/504-add-support-for-ikea-e2001e20…
Browse files Browse the repository at this point in the history
…02-zha

fix(device): rename W2049 for E2002
  • Loading branch information
xaviml authored Jun 9, 2022
2 parents c30d7e6 + 1566dfb commit cb578e5
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _Note: Remember to restart the AppDaemon addon/server after updating to a new ve
## :hammer: Fixes

- :warning: Change [Hue Dimmer](https://BASE_URL/controllerx/controllers/HueDimmer) mapping for Zigbee2MQTT to be compatible with `legacy: false` mapping. This option will need to be [enabled from Zigbee2MQTT](https://www.zigbee2mqtt.io/devices/324131092621.html#options). [ #496 ]
- :warning: Rename `W2049` controllers for `E2002` (e.g. `W2049LightController` is now `E2002LightController`). The old names can still be used, but they show a warning and will be removed in the future.

<!--
## :clock2: Performance
Expand Down
27 changes: 24 additions & 3 deletions apps/controllerx/cx_devices/ikea.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def get_zha_action(self, data: EventData) -> str:
return command


class W2049LightController(LightController):
class E2002LightController(LightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Light.ON,
Expand Down Expand Up @@ -640,7 +640,17 @@ def get_zha_actions_mapping(self) -> DefaultActionsMapping:
}


class W2049Z2MLightController(Z2MLightController):
class W2049LightController(E2002LightController):
async def initialize(self) -> None:
await super().initialize()
self.log(
"⚠️ `W2049LightController` is deprecated and will be removed. Use `E2002LightController` instead.",
level="WARNING",
ascii_encode=False,
)


class E2002Z2MLightController(Z2MLightController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": Z2MLight.ON,
Expand All @@ -657,7 +667,7 @@ def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
}


class W2049MediaPlayerController(MediaPlayerController):
class E2002MediaPlayerController(MediaPlayerController):
def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
return {
"on": MediaPlayer.PLAY_PAUSE,
Expand Down Expand Up @@ -688,3 +698,14 @@ def get_deconz_actions_mapping(self) -> DefaultActionsMapping:
4001: MediaPlayer.NEXT_SOURCE,
4003: MediaPlayer.RELEASE,
}


class W2049MediaPlayerController(E2002MediaPlayerController):
async def initialize(self) -> None:
await super().initialize()
self.log(
"⚠️ `W2049MediaPlayerController` is deprecated and will be removed. "
"Use `E2002MediaPlayerController` instead.",
level="WARNING",
ascii_encode=False,
)
File renamed without changes
4 changes: 4 additions & 0 deletions docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
},
]

DEPRECATED_CONTROLLERS = ["W2049"]

with open(Path(__file__).parent / "notes.yaml") as f:
NOTES: Dict[str, str] = yaml.full_load(f)

Expand Down Expand Up @@ -231,6 +233,8 @@ def get_devices() -> Dict[str, ControllerDocs]:
devices = defaultdict(list)
for controller in get_controllers():
device_name = get_device_name(controller.__class__.__name__)
if device_name in DEPRECATED_CONTROLLERS:
continue
controller_docs = get_controller_docs(controller)
devices[device_name].append(controller_docs)

Expand Down
6 changes: 6 additions & 0 deletions docs/notes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ E1744: |
If you want to use the default controller, you will need to set `legacy: false` in the Zigbee2MQTT configuration.
Read more in <a href="https://www.zigbee2mqtt.io/devices/E1744.html#legacy-integration">here</a>.
E1810: |
This device mapping has also support for E1524 controller.
E2002: |
This device mapping has also support for E2001 controller.
HueDimmer: |
In case of working with <strong>z2m</strong> the device needs to be flagged as `legacy: false` as
<a href="https://www.zigbee2mqtt.io/devices/324131092621.html#options">Zigbee2MQTT
Expand Down

0 comments on commit cb578e5

Please sign in to comment.