controllerx: [BUG] Zigbee2MQTT breaking changes

Bug report

As Zigbee2MQTT 1.42. or 2.0 come with breaking changes (https://github.com/Koenkk/zigbee2mqtt/discussions/24198), it also breaks some controllers, such as E1743

Description

The controller does not work anymore.

Additional information

  • Devices involved:
    • Model: eg. IKEA E1743
    • …
  • Integration: z2m
  • AppDaemon version: v4.4.2
  • HACS version (if installed from there): 2.0.1
  • Home Assistant Core version: 2024.11.3

AppDaemon app configuration

nachttisch_links:
  module: controllerx
  class: E1743Controller
  integration: z2m
  controller: sensor.dim_nachttisch_links_action
  light: light.hue_color_lamp_1

nachttisch_rechts:
  module: controllerx
  class: E1743Controller
  integration: z2m
  controller: sensor.dim_nachttisch_rechts_action
  light: light.schlafzimmer_nachttisch_rechts

wohnzimmer_dim:
  module: controllerx
  class: E1743Controller
  integration: z2m
  controller: sensor.dim_wohnzimmer_action
  light: light.wohnzimmer_decke
  
flur_dim:
  module: controllerx
  class: E1743Controller
  integration: z2m
  controller: sensor.dim_flur3_action
  light: light.flur_deckenlampe

kueche_dim:
  module: controllerx
  class: E1743Controller
  integration: z2m
  controller: sensor.dim_kueche_action
  light: light.unterschranke_kuche

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 20 (8 by maintainers)

Commits related to this issue

Most upvoted comments

v2.0.0 of Z2M has been released.

Here’s what I had to do:

  1. Enable MQTT plugin, see below for a config example
  2. Restart AppDaemon
  3. Migrate my z2m apps to mqtt

Appdaemon config

appdaemon:
  # ...
  plugins:
    # ...
    MQTT:
      type: mqtt
      namespace: mqtt
      client_host: core-mosquitto
      client_user: mqtt
      client_password: password
      # Listen only to zigbee2mqtt messages
      client_topics:
        - zigbee2mqtt/#

Apps configuration

Before

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: sensor.livingroom_controller_action
  integration: z2m
  light: light.bedroom

After

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: Livingroom Controller # this is the "friendly name" of the device in Z2M
  integration:
    name: z2m
    listen_to: mqtt
  light: light.bedroom

Suggestions

I suggest updating the second code sample here, it wasn’t immediately clear that the controller key had changed, nor that the device’s friendly name was expected. Maybe also setup a Z2M 2.0 migration page in the docs?

MQTT error

I got the following errors in the logs. Looks like it ended up successful (Plugin initialization complete) but still, a bit scary.

The warning disappeared when listening only to z2m messages (client_topics config key).

Logs
2025-01-03 23:48:22.165394 INFO MQTT: Connected to Broker at URL core-mosquitto:1883
2025-01-03 23:48:22.555183 INFO MQTT: Unable to decode MQTT message
2025-01-03 23:48:22.557665 ERROR MQTT: Unable to decode MQTT message, with Traceback: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/plugins/mqtt/mqttplugin.py", line 271, in mqtt_on_message
    payload = payload.decode()
              ^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
2025-01-03 23:48:22.560667 INFO MQTT: Unable to decode MQTT message
2025-01-03 23:48:22.562073 ERROR MQTT: Unable to decode MQTT message, with Traceback: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/plugins/mqtt/mqttplugin.py", line 271, in mqtt_on_message
    payload = payload.decode()
              ^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
2025-01-03 23:48:22.565533 INFO MQTT: Unable to decode MQTT message
2025-01-03 23:48:22.566949 ERROR MQTT: Unable to decode MQTT message, with Traceback: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/plugins/mqtt/mqttplugin.py", line 271, in mqtt_on_message
    payload = payload.decode()
              ^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte
2025-01-03 23:48:22.702510 INFO AppDaemon: Got initial state from namespace mqtt
2025-01-03 23:48:22.703181 INFO MQTT: MQTT Plugin initialization complete

Edited on 2025-01-04: add appdaemon config example + update on MQTT warning

I ran into trouble with node-red, and found out that there is a setting in Z2M that should be activated: billede According to KennethLavrsen it is no longer experimental. It’s a rather cool addition, it will create an entity for the event. So instead of a sensor, it’s doable with an event entity. The value of the button in Node Red is in: data.new_state.attributes.event_type A cool benefit is that if you go to Developer Tools -> States and look up the device, it shows the possible values provided by the button.

Maybe ControllerX could use this as well @xaviml ?

ControllerX v4.29.0 has been now released.

@xaviml I’m facing an issue with the following config:

ampoule_chambre: module: controllerx class: E1810Controller controller: Interrupteur chambre integration: name: z2m listen_to: mqtt light: light.ampoule_chambre merge_mapping: “toggle$2”: on_full_brightness arrow_left_click: - service: switch.toggle data: entity_id: switch.guirlande_chambre arrow_right_click: - service: switch.toggle data: entity_id: switch.guirlande_chambre toggle_hold: [] arrow_left_hold: [] arrow_left_release: [] arrow_right_hold: [] arrow_right_release: [] The intent is to use a single press on the “power” button to toggle the light and a double press to trigger full brightness. However, a single click on the button shows this in the logs:

2025-01-06 13:31:44.560420 INFO ampoule_chambre: 🎮 Button event triggered: `toggle$2`
2025-01-06 13:31:44.567770 INFO ampoule_chambre: 🏃 Running `Predefined (on_full_brightness)` now
2025-01-06 13:31:44.580925 INFO ampoule_chambre: 
🤖 Service: light.turn_on
  - entity_id: light.ampoule_chambre
  - brightness: 255

If I remove the toggle$2 config, then the button works properly.

This didn’t happen with the action sensor.

Hi @Crocmagnon ,

I had similar issue in my setup, but I did not have time to debug where the problem was coming from. However, it seemed a problem from Zigbee2MQTT since when I restarted it, it got fixed.

The following issue was released on Zigbee2MQTT 2.1.2, so maybe that was causing it: https://github.com/Koenkk/zigbee2mqtt/issues/26281

Since I have this version, it has not happened to me again.