|
| 1 | +--- |
| 2 | +title: Zigbee2MQTT - HA sensor is deprecated |
| 3 | +layout: page |
| 4 | +--- |
| 5 | + |
| 6 | +_Zigbee2MQTT HA sensor deprecated since ControllerX v4.29.0_ |
| 7 | + |
| 8 | +Zigbee2MQTT 2.0.0 brought [some breaking changes](https://github.com/Koenkk/zigbee2mqtt/discussions/24198), and one of them was to deprecate the [Home Assistant action sensors](https://www.zigbee2mqtt.io/guide/usage/integrations/home_assistant.html#via-home-assistant-action-sensor-deprecated), which is the default option for [Zigbee2MQTT integration](/controllerx/start/integrations/zigbee2mqtt) in ControllerX. |
| 9 | + |
| 10 | +You might be here because of a warning in AppDaemon logs that look like the following: |
| 11 | + |
| 12 | +!!! quote |
| 13 | + |
| 14 | + ⚠️ Listening to HA sensor actions is now deprecated and will be removed in the future. Use `listen_to: mqtt` or `listen_to: event` instead. Read more about it here: https://xaviml.github.io/controllerx/others/z2m-ha-sensor-deprecated |
| 15 | + |
| 16 | +This might be because your controller configuration looks like: |
| 17 | + |
| 18 | +```yaml hl_lines="4-5" |
| 19 | +livingroom_controller: |
| 20 | + module: controllerx |
| 21 | + class: E1810Controller |
| 22 | + controller: sensor.livingroom_controller_action |
| 23 | + integration: z2m |
| 24 | + light: light.livingroom |
| 25 | +``` |
| 26 | +
|
| 27 | +The issue is within the `integration: z2m` which is defaulted to read a HA `sensor`. You need to switch to either [`mqtt`](/controllerx/start/integrations/zigbee2mqtt/#mqtt-topics-listen_to-mqtt) (recommended) or HA [`event`](/controllerx/start/integrations/zigbee2mqtt/#event-state-listen_to-event) (experimental). |
| 28 | + |
| 29 | +## Switch to MQTT listener (recommended) |
| 30 | + |
| 31 | +In case of switching to MQTT (as [recommneded by Zigbee2MQTT](https://www.zigbee2mqtt.io/guide/usage/integrations/home_assistant.html#via-mqtt-device-trigger-recommended)), you would need to first [enable MQTT plugin](/controllerx/others/enable-mqtt-plugin). Then, change your configuration to something like the following: |
| 32 | + |
| 33 | +```yaml hl_lines="4-7" |
| 34 | +livingroom_controller: |
| 35 | + module: controllerx |
| 36 | + class: E1810Controller |
| 37 | + controller: livingroom_controller # (1) |
| 38 | + integration: |
| 39 | + name: z2m |
| 40 | + listen_to: mqtt # (2) |
| 41 | + light: light.livingroom |
| 42 | +``` |
| 43 | + |
| 44 | +1. This is the device friendly_name in Zigbee2MQTT. Check [here](/controllerx/start/integrations/zigbee2mqtt/#mqtt-topics-listen_to-mqtt) how to get this value. |
| 45 | +2. By indicating `mqtt` here, ControllerX will listen to MQTT controller topic. |
| 46 | + |
| 47 | +## Switching to HA Event sensor listener (experimental) |
| 48 | + |
| 49 | +Another option is to listen the newly (and experimental) event entity from Zigbee2MQTT 2.0.0. First, we will need to enable the experimental feature in Zigbee2MQTT as explained [here](/controllerx/start/integrations/zigbee2mqtt/#event-state-listen_to-event). Then, you would need to switch configuration to something like: |
| 50 | + |
| 51 | +```yaml hl_lines="4-7" |
| 52 | +livingroom_controller: |
| 53 | + module: controllerx |
| 54 | + class: E1810Controller |
| 55 | + controller: office_controller_action # (1) |
| 56 | + integration: |
| 57 | + name: z2m |
| 58 | + listen_to: event # (2) |
| 59 | + light: light.livingroom |
| 60 | +``` |
| 61 | + |
| 62 | +1. This is the event entity without the `event.` prefix. Check [here](/controllerx/start/integrations/zigbee2mqtt/#event-state-listen_to-event) how to get this value. |
| 63 | +2. By indicating `event` here, ControllerX will listen to the event entity changes. |
0 commit comments