ControllerX. Bring full functionality to light and media player controllers

Hey there. Please do. I have tried a few inputs, but not working. I am just not understanding the code.

Update: I think I figured it out. Is this correct? Seems to work.

m1_dimmer:
  module: controllerx
  class: E1743Z2MLightController
  controller: master_dimmer
  integration:
    name: z2m
    listen_to: mqtt
  light:
    name: m_1
    mode: mqtt
  excluded_actions: ["off"]

master_light:
  module: controllerx
  class: E1743Z2MLightController
  controller: master_dimmer
  integration:
    name: z2m
    listen_to: mqtt
  light:
    name: master
    mode: mqtt
  mapping:
    "off": "off"
    "on$2": "on"
    "brightness_move_up": "hold_brightness_up"
    "brightness_move_down": "hold_brightness_down"

Hi @duceduc ,

Yes, this works, but if you check the logs, you are calling the brightness up/down twice because you are not restricting the brightness up/down actions in the first config. This is how I would do it:

m1_dimmer:
  module: controllerx
  class: E1743Z2MLightController
  controller: master_dimmer
  integration:
    name: z2m
    listen_to: mqtt
  light:
    name: m_1
    mode: mqtt
  actions: ["on"] # Only allows "on" action for this config

master_light:
  module: controllerx
  class: E1743Z2MLightController
  controller: master_dimmer
  integration:
    name: z2m
    listen_to: mqtt
  light:
    name: master
    mode: mqtt
  excluded_actions: ["on"] # Excluding "on" because it is managed by the other config
  merge_mapping:
    "on$2": "on"

Regards,
Xavi M.

1 Like

After the update of the ControllerX to v4.21.0, the lamps can no longer be controlled with my Hue dimmers.
I think I read that there was a breaking change… but I just can not get it to work anymore.
Can I undo the update nRückig make, or can someone help me with the config?

Working before Update:

HueLampen_Wohnzimmer:
  module: controllerx
  class: HueDimmerController
  controller: sensor.0x0017880104ac8164_action
  integration: z2m
  light: group.hue_lights

Thanks in advance!

Hi @fisch55 ,

As the breaking change says, the default mapping was changed to support the legacy: false from Zigbee2MQTT.

You can do it on the device.yaml file from Zigbee2MQTT or from the UI that it provides:

  • Go to devices in Zigbee2MQTT UI.
  • Click on the Hue Dimmer device.
  • Go to Settings (specific)
  • Mark the “legacy” as false
  • You might need to restart Z2M.

Regards,
Xavi M.

Ok, THX.

so my config above is right? I“ll test it tomorrow….

ok, I’ll tried…but no lights turns on…
I changed the legacy to flase, did a restart of z2m…

2022-06-16 07:57:56.954173 INFO example_app: 🎮 ControllerX v4.21.0
2022-06-16 08:00:48.531391 INFO AppDaemon: Reading config
2022-06-16 08:00:48.623677 INFO AppDaemon: Found 5 total apps
2022-06-16 08:00:48.776417 INFO AppDaemon: Initializing app HueLampen_Wohnzimmer using class HueDimmerController from module controllerx
2022-06-16 08:00:48.785830 INFO HueLampen_Wohnzimmer: 🎮 ControllerX v4.21.0
HueLampen_Wohnzimmer:
  module: controllerx
  class: HueDimmerController
  controller: sensor.0x0017880104ac8164_action
  integration: z2m
  light: group.hue_lights

what is my fault? the callbacks are coming in

Hi @fisch55 ,

Correct, the ControllerX config does not need any changes, only apply the legacy config in Zigbee2MQTT.

Are the AppDaemon logs showing anything when pressing the buttons? Could you please share them if so?

Could you check that sensor.0x0017880104ac8164_action exists as an entity? Maybe the name changed.

Could you also check if group.hue_lights is working from Home Assistant?

EDIT: just to make sure, which device you marked as legacy false? The controller or the light? It needs to be the controller, the Hue Dimmer controller.

Regards,
Xavi M.

ok - like this:

HueLampen_Wohnzimmer:
  module: controllerx
  class: HueDimmerController
  controller: sensor.0x0017880104ac8164_action
  integration: z2m
  light: group.hue_lights

it is available!

is working!

the dimmer ist set to legacy: false

It is counting , if I press the hue dimmer . See the total callbacks… but in the log , happens nothing!


Go back to ControllerX v4.20.0 it woks like a charm!

Hi @fisch55 ,

Could you please do the following?

  • Share Zigbee2mqtt logs when you interact with the device.
  • add log_level: DEBUG to the controllerx config (same level as class and module), then share AppDaemon logs when interacting with the device.

Regards,

ok, here is the z2m log, pressed on button:
turns 3 lights on…

2022-06-16 21:47:10Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":0,"type":0,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null
2022-06-16 21:47:10Received Zigbee message from '0x0017880104ac8164', type 'commandOn', cluster 'genOnOff', data '{}' from endpoint 1 with groupID null
2022-06-16 21:47:11Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":1,"type":2,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null
2022-06-16 21:47:11Received MQTT message on 'zigbee2mqtt/Sideboard Lampe/set' with data '{"state": "ON"}'
2022-06-16 21:47:11Publishing 'set' 'state' to 'Sideboard Lampe'
2022-06-16 21:47:11Received MQTT message on 'zigbee2mqtt/TV Lampe/set' with data '{"state": "ON"}'
2022-06-16 21:47:11Publishing 'set' 'state' to 'TV Lampe'
2022-06-16 21:47:11Received MQTT message on 'zigbee2mqtt/Pflanzen Lampe/set' with data '{"state": "ON"}'
2022-06-16 21:47:11Publishing 'set' 'state' to 'Pflanzen Lampe'
2022-06-16 21:47:11Received MQTT message on 'zigbee2mqtt/0x00178801001c96b9/set' with data '{"state": "ON"}'
2022-06-16 21:47:11Publishing 'set' 'state' to '0x00178801001c96b9'
🤖 Service: light.turn_on
  - entity_id: group.hue_lights
2022-06-16 21:46:56.369159 INFO HueLampen_Wohnzimmer: 🎮 Button event triggered: `off-press`
2022-06-16 21:46:56.382946 INFO HueLampen_Wohnzimmer: 🏃 Running `Predefined (off)` now
2022-06-16 21:46:56.404687 INFO HueLampen_Wohnzimmer: 
🤖 Service: light.turn_off
  - entity_id: group.hue_lights
2022-06-16 21:47:11.408617 INFO HueLampen_Wohnzimmer: 🎮 Button event triggered: `on-press`
2022-06-16 21:47:11.425804 INFO HueLampen_Wohnzimmer: 🏃 Running `Predefined (on)` now
2022-06-16 21:47:11.444479 INFO HueLampen_Wohnzimmer: 

all with the old controller version

Can you do the same with “legacy: false” option and new ControllerX version? Thanks!

Also, I am interested in Zigbee2MQTT logs where device events are fired.

z2m log new controller

2022-06-16 21:59:07Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":0,"type":0,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null
2022-06-16 21:59:07Received Zigbee message from '0x0017880104ac8164', type 'commandOn', cluster 'genOnOff', data '{}' from endpoint 1 with groupID null
2022-06-16 21:59:07Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":1,"time":1,"type":2,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null
2022-06-16 21:59:13Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":4,"time":0,"type":0,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null
2022-06-16 21:59:14Received Zigbee message from '0x0017880104ac8164', type 'commandHueNotification', cluster 'manuSpecificPhilips', data '{"button":4,"time":2,"type":2,"unknown1":3145728,"unknown2":0}' from endpoint 2 with groupID null

log_level: DEBUG ? ihre to insert this in appDaemon

Like this:

HueLampen_Wohnzimmer:
  log_level: DEBUG
  module: controllerx
  class: HueDimmerController
  controller: sensor.0x0017880104ac8164_action
  integration: z2m
  light: group.hue_lights

Are these the only logs z2m are showing when you interact with the device?

Seem to be having som trouble using Philips929002398602LightController
Getting this when trying to use it. “ValueError: This controller does not support deconz.”

It is supported in deconz, since I can configure it in there and use it to do simple jobs on/off like the deconz only offer, but I really need the far more advanced features ControllerX can give me :slight_smile:

But I noticed that deconz etc. is not in the Integrations list here:
https://xaviml.github.io/controllerx/controllers/Philips929002398602/

So when I use deconz, I can not use this controller “in advanced mode” … ?

--------appsl.yaml example---------------


dimmer_fitness_X2:
module: controllerx
class: Philips929002398602LightController
controller: fitness_switch_02
integration: deconz
light: group.fitness


--------log file example-------------


2022-06-23 12:13:06.155376 INFO AppDaemon: Initializing app dimmer_fitness_X2 using class Philips929002398602LightController from module controllerx
2022-06-23 12:13:06.170489 INFO dimmer_fitness_X2: :video_game: ControllerX v4.20.0
2022-06-23 12:13:06.199491 WARNING dimmer_fitness_X2: ------------------------------------------------------------
2022-06-23 12:13:06.200493 WARNING dimmer_fitness_X2: Unexpected error running initialize() for dimmer_fitness_X2
2022-06-23 12:13:06.201300 WARNING dimmer_fitness_X2: ------------------------------------------------------------
2022-06-23 12:13:06.202602 WARNING dimmer_fitness_X2: Traceback (most recent call last):
File “/usr/lib/python3.10/site-packages/appdaemon/app_management.py”, line 163, in initialize_app
await init()
File “/config/appdaemon/apps/controllerx/cx_core/controller.py”, line 103, in initialize
self.log(f":video_game: ControllerX {cx_version.version}", ascii_encode=False)
File “/config/appdaemon/apps/controllerx/cx_core/type/light_controller.py”, line 148, in init
await super().init()
File “/config/appdaemon/apps/controllerx/cx_core/type_controller.py”, line 66, in init
await super().init()
File “/config/appdaemon/apps/controllerx/cx_core/release_hold_controller.py”, line 27, in init
await super().init()
File “/config/appdaemon/apps/controllerx/cx_core/controller.py”, line 118, in init
if custom_mapping is None:
File “/config/appdaemon/apps/controllerx/cx_core/controller.py”, line 236, in get_default_actions_mapping
raise ValueError(f"This controller does not support {integration.name}.")
ValueError: This controller does not support deconz.
2022-06-23 12:13:06.203497 WARNING dimmer_fitness_X2: -----------------------------------------------------------

Hi @Jano1959 ,

That error means that this controller is not supported by ControllerX with deCONZ integration. If you have this device with deCONZ, you can create a ticket specifying the events that controller fires: Sign in to GitHub · GitHub

Then, I will be implementing the default mapping for this controller for deCONZ.

Regards,
Xavi M.

1 Like

Done :ok_hand:

# [NEW DEVICE] #516

1 Like

@ xaviml
Hello,

I have updated the HA to 2022.6 and my lights no longer working with controllerx.
I have the config for about 2 years and all worked flawless, tried to use Z2MLightController feature (Zigbee2MQTT <> MQTT Broker <> AppDaemon (ControllerX) ) but with no success, not sure what I’m doing wrong.

  • I have enabled the MQTT plugin in AppDaemon.
  • in the apps.yaml the config is like this:
Kitchen_lights_controller:
  log_level: DEBUG
  module: controllerx
  class: HueDimmerZ2MLightController
  controller: LIV_DIM01
  integration:
    name: z2m
    listen_to: mqtt
  light: 
    name: kitchen_lights
    mode: mqtt
  • the name I’m using for controller is from here:

  • the name for light is from mqtt:

Can you please tell me what I’m doing wrong? I’m getting this error:

… is not recognized as a template

bellow is the debug file.

2022-06-26 18:09:09.030714 INFO AppDaemon: AppDaemon Version 4.2.1 starting
2022-06-26 18:09:09.031373 INFO AppDaemon: Python version is 3.10.4
2022-06-26 18:09:09.031871 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2022-06-26 18:09:09.032347 INFO AppDaemon: Added log: AppDaemon
2022-06-26 18:09:09.032851 INFO AppDaemon: Added log: Error
2022-06-26 18:09:09.033393 INFO AppDaemon: Added log: Access
2022-06-26 18:09:09.034300 INFO AppDaemon: Added log: Diag
2022-06-26 18:09:09.083461 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2022-06-26 18:09:09.172329 INFO HASS: HASS Plugin Initializing
2022-06-26 18:09:09.173111 INFO HASS: HASS Plugin initialization complete
2022-06-26 18:09:09.174160 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module mqttplugin
2022-06-26 18:09:09.191591 INFO MQTT: MQTT Plugin Initializing
2022-06-26 18:09:09.192236 INFO MQTT: Using 'mqtt-client/status' as Will Topic
2022-06-26 18:09:09.192744 INFO MQTT: Using 'mqtt-client/status' as Birth Topic
2022-06-26 18:09:09.193285 INFO MQTT: Using appdaemon_mqtt_client as Client ID
2022-06-26 18:09:09.194941 INFO AppDaemon: Initializing HTTP
2022-06-26 18:09:09.195878 INFO AppDaemon: Using 'ws' for event stream
2022-06-26 18:09:09.205533 INFO AppDaemon: Starting API
2022-06-26 18:09:09.214016 INFO AppDaemon: Starting Admin Interface
2022-06-26 18:09:09.215214 INFO AppDaemon: Starting Dashboards
2022-06-26 18:09:09.257316 INFO HASS: Connected to Home Assistant 2022.6.7
2022-06-26 18:09:09.297231 INFO MQTT: Connected to Broker at URL 192.168.1.4:1883
2022-06-26 18:09:09.321353 INFO AppDaemon: Got initial state from namespace mqtt
2022-06-26 18:09:09.329995 INFO MQTT: MQTT Plugin initialization complete
2022-06-26 18:09:09.392901 INFO AppDaemon: App 'Kitchen_lights_controller' added
2022-06-26 18:09:09.397978 INFO AppDaemon: Found 1 total apps
2022-06-26 18:09:09.400203 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2022-06-26 18:09:09.406043 INFO AppDaemon: Running on port 5050
2022-06-26 18:09:09.540178 INFO HASS: Evaluating startup conditions
2022-06-26 18:09:09.565122 INFO HASS: Startup condition met: hass state=RUNNING
2022-06-26 18:09:09.566298 INFO HASS: All startup conditions met
2022-06-26 18:09:09.637849 INFO AppDaemon: Got initial state from namespace default
2022-06-26 18:09:11.427196 INFO AppDaemon: Scheduler running in realtime
2022-06-26 18:09:11.436378 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2022-06-26 18:09:11.437487 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx to module import path
2022-06-26 18:09:11.438745 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core to module import path
2022-06-26 18:09:11.439808 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core/feature_support to module import path
2022-06-26 18:09:11.440853 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core/stepper to module import path
2022-06-26 18:09:11.441875 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core/type to module import path
2022-06-26 18:09:11.442875 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core/integration to module import path
2022-06-26 18:09:11.443854 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_core/action_type to module import path
2022-06-26 18:09:11.444865 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/cx_devices to module import path
2022-06-26 18:09:11.549260 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/controllerx/controllerx.py
2022-06-26 18:09:11.694949 INFO AppDaemon: Initializing app Kitchen_lights_controller using class HueDimmerZ2MLightController from module controllerx
2022-06-26 18:09:11.908490 INFO Kitchen_lights_controller: 🎮 ControllerX v4.22.0
2022-06-26 18:09:11.929075 DEBUG Kitchen_lights_controller: `on` is not recognized as a template
2022-06-26 18:09:11.934720 DEBUG Kitchen_lights_controller: `hold_colortemp_up` is not recognized as a template
2022-06-26 18:09:11.940342 DEBUG Kitchen_lights_controller: `release` is not recognized as a template
2022-06-26 18:09:11.945773 DEBUG Kitchen_lights_controller: `click_brightness_up` is not recognized as a template
2022-06-26 18:09:11.951076 DEBUG Kitchen_lights_controller: `hold_brightness_up` is not recognized as a template
2022-06-26 18:09:11.956549 DEBUG Kitchen_lights_controller: `release` is not recognized as a template
2022-06-26 18:09:11.962311 DEBUG Kitchen_lights_controller: `click_brightness_down` is not recognized as a template
2022-06-26 18:09:11.967610 DEBUG Kitchen_lights_controller: `hold_brightness_down` is not recognized as a template
2022-06-26 18:09:11.972903 DEBUG Kitchen_lights_controller: `release` is not recognized as a template
2022-06-26 18:09:11.978196 DEBUG Kitchen_lights_controller: `off` is not recognized as a template
2022-06-26 18:09:11.983581 DEBUG Kitchen_lights_controller: `hold_colortemp_down` is not recognized as a template
2022-06-26 18:09:11.989088 DEBUG Kitchen_lights_controller: `release` is not recognized as a template
2022-06-26 18:09:11.991814 DEBUG Kitchen_lights_controller: Calling listen_event for Kitchen_lights_controller
2022-06-26 18:09:11.994918 INFO AppDaemon: App initialization complete
2022-06-26 18:09:12.006630 DEBUG Kitchen_lights_controller: MQTT data event: {}

Appreciate your help.
Thank you,
Paul.

Hi @smilemp13 ,

ControllerX v4.21.0 rel3ased a breaking change for HueDimmer Controller. You need to set legacy: false for the controller in Zigbee2MQTT. That is probably why you do not see anything in the logs. Check release notes here: Release v4.21.0 · xaviml/controllerx · GitHub

The message is not recognized as a template is expected when debugging, so it is not an issue.

Finally, is the kitchen_lights the name in Zigbee2MQTT?

Regards,
Xavi M.