ControllerX. Bring full functionality to light and media player controllers

Thank you @Canaletto , I will look into it when I have time.

New AppDaemon version got release today with the fix for the template rendering. I will remove my patch when I have some more time again.

In case latest version is not working, v4.25.0 can be used since it does not contain the patch, and should work with latest AppDaemon version.

Xavi M.

Thank you. Always something so simple with other eyes on it!

1 Like

Am I the only one using this integration with the Tuya Smart knob?? LOL

Has anyone here successfully setup ControllerX with the Tuya Smart Knob?

It seems to connect and I can see the state changes however I get the following error in Zigbee2MQTT:


However if I use the same entity with the Ikea E1744 Smart Knob in ControllerX, it works just fine. I’m pulling my hair out here! Any help you be GREATLY appreciated! Below is my apps.yaml config:

  module: controllerx
  class: TuYaERS10TZBVKAAZ2MLightController
    name: z2m
    listen_to: mqtt
  controller: SmartKnob
  light: light.switch_office

and here is what’s in the Z2M config for the Tuya:

  friendly_name: SmartKnob

Thank you. it is working now.

For informations… but I prefer ZHA :wink:

Hi Xavi,
Congratulations for great job and building so flexible automation system for appdaemon!

I’m quite new here, but already managed to integrate few different IKEA Tradfri controllers with full success. Thanks to your well designed system.
I decided to post here, because I have stuck with my shelly 2.5 lab-solution (input-0 only, detached switch) controlling half of my chandelier (group of two z2m bulbs).
Spending few hours, I cannot understand the reason, but I have no appdaemon logs for that, nor any state change of the bulbs.

I tried this config:

    module: controllerx
    class: Shelly25LightController
    integration: shelly
    controller: shellyswitch25-C45BBE6B4D2E
    light: light.pokoj_zyrandol
        - single_push_1
        - long_push_1
        - btn_up_1
        - double_push_1
        long_push_1: hold_brightness_toggle

For testing purposes I also simplified above config by removing “actions” and “merge_mapping” blocks.
then this one:

    module: controllerx
    class: LightController
        - shellies/shellyswitch25-C45BBE6B4D2E/input_event/0
    light: light.pokoj_zyrandol
        name: mqtt
        key: event
        "S": "on"
        "L": "off"

No appdaemon application logs, no action. What can be the root of the issue?

my mqtt brocker reports correctly:

maj 25 18:56:19 shellies/shellyswitch25-C45BBE6B4D2E/input/0 1
maj 25 18:56:20 shellies/shellyswitch25-C45BBE6B4D2E/longpush/0 1
maj 25 18:56:20 shellies/shellyswitch25-C45BBE6B4D2E/input_event/0 {“event”:“L”,“event_cnt”:49}
maj 25 18:56:20 shellies/shellyswitch25-C45BBE6B4D2E/input/0 0
maj 25 18:56:21 shellies/shellyswitch25-C45BBE6B4D2E/input/0 1
maj 25 18:56:21 shellies/shellyswitch25-C45BBE6B4D2E/longpush/0 0
maj 25 18:56:21 shellies/shellyswitch25-C45BBE6B4D2E/input_event/0 {“event”:“S”,“event_cnt”:50}
maj 25 18:56:21 shellies/shellyswitch25-C45BBE6B4D2E/input/0 0

and HA events look like:

  device_id: d80542b9527d96bcb6688b882b7b3c1a
  device: shellyswitch25-C45BBE6B4D2E
  channel: 1
  click_type: single
  generation: 1
origin: LOCAL
time_fired: "2023-05-25T16:27:56.771676+00:00"
  id: 01H19VT1F39N4H4NZAJ0TKFQ0C
  parent_id: null
  user_id: null

For sure I overlooked something. Could you advice what I could mess up, please?
I wrote few short lines in python using mqtt API and “the appliance” works correctly. I intend to integrate the automation with your great unified solution.

Please help me here. Big thanks in advance!

I am not sure what I am doing wrong, hope someone can help.

Using a Philips Hue dimmer (v2, the one with the HUE button), the brightness up/down doesn´t seem to be working by default. I have to explicitly define brightness up and down, it doesn´t work without that.

  module: controllerx
  class: Philips929002398602Z2MLightController
  controller: sensor.hue_dimmer_slaapkamer1_action
  integration: z2m
  light: light.bed_1
  update_supported_features: true
      service: light.toggle
        entity_id: light.bed_1
      service: light.toggle
        entity_id: light.ouderslaapkamer_plafond
# I can only change brightness (up) when I define it like below. 
# Without this code, the brightness does not change when I press the 'brightness up' button.
      service: light.turn_on
        entity_id: light.bed_1
        brightness_step_pct: 10

Why is is the default behavior for brightness up not working in this example? Is this a bug or am I doing something wrong?

Hello Xavi

Firstly, thank you very much for your amazing work. It’s just so easy to understand how to add devices, also for a newbie like me.

Now I’m looking for a solution to add the Innr RC 250 and to use it with ZHA. Could you add the device? If yes, what information do you need from me?

I was able to configure the main button with the E1743 integration, I wondering know if it’s possible to find an existing integration to use the device?



Hey, new ControllerX user here.

I was able to get everything setup and running using the ICTCG1 controller and Z2M. The only stumbling block I am having is that the bulb I am controlling must be on before I can dim it. What I would like to do is to use the quick rotations to issue a light.turn_on/off command. Is this something that is supported when using Z2M?

Hi all,

First of all thanks a lot @xaviml, it’s been 3 years that I am using and enjoying your tool!
I am trying to add a condition to select the light to be controlled, and the following code doesn’t seem to work:

  module: controllerx
  class: E1810Controller
  controller: sensor.remote_living_room_action
  integration: z2m
  light: |
        if (states['input_boolean.check'].state == 'off')
         return "light.lights_living_room_A";
        return "light.lights_living_room_B";
    - toggle
    - toggle_hold

Any idea how to make it work?

Hi @Alex95 ,

You can use “constrain_input_boolean” from AppDaemon. You find some examples of it in the Examples page:


That worked, thanks!!

Hi, I have been using the integration and its perfect.
I am using the 4 button IKEA controller (it doesn’t have the middle on/off button).

I am trying to map a 2 click action and 3 click action to toggle the individual lights.
The issue is that i don’t know how to define which button should be listen to for the double click (as there is no middle button).

This is what i have:

  module: controllerx
  class: E2002Z2MLightController
  integration: z2m
  controller: sensor.lounge_remote_4button_action
  light: Lounge Lights
      service: light.toggle
        entity_id: light.lounge_lamp_1
      service: light.toggle
        entity_id: light.lounge_lamp_2

Double and Triple clicks do nothing. All other features work ok (on/off, temperature, brightness)
How can i define which button should be listened to?

Thank you!

With addon-appdaemon V 0.15.2 the addon has been moved into a different folder outside the HA config folder. Hence the ControllerX config file is not accessable anymore under /config/appdaemon/apps/apps.yaml.

Do you have any advise how to deal with it and can tell us the implication for the ControllerX Project? Not sure if her in the comminity or on github discussion forum is the right place to talk about it.

Good source for those having issues because they missed to consider the braking change of path to secrets.yaml in appdaemon.yaml.

Thanks in advance!

I reported a bug for this one;

I can not fix this issue

I am getting this with appdeamon:

s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
Log level is set to INFO
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service init-appdaemon: starting
s6-rc: info: service init-appdaemon successfully started
s6-rc: info: service appdaemon: starting
s6-rc: info: service appdaemon successfully started
s6-rc: info: service legacy-services: starting
[13:52:57] INFO: Starting AppDaemon...
s6-rc: info: service legacy-services successfully started
ERROR Error loading secrets file: /config/secrets.yaml
Traceback (most recent call last):
  File "/usr/bin/appdaemon", line 8, in <module>
  File "/usr/lib/python3.11/site-packages/appdaemon/", line 417, in main
  File "/usr/lib/python3.11/site-packages/appdaemon/", line 276, in main
    if "appdaemon" not in config:
TypeError: argument of type 'NoneType' is not iterable
[13:52:58] INFO: Service AppDaemon exited with code 1 (by signal 0)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service appdaemon: stopping
s6-rc: info: service appdaemon successfully stopped
s6-rc: info: service init-appdaemon: stopping
s6-rc: info: service init-appdaemon successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

How to add the new config folder within Studio code server:

basically just add via File / Open Folder or File / Add Folder to Workspace
the folder /addon_configs/
After that you can find your apps.yaml :slight_smile:

Additional background and advise for developer of custom solutions:

1 Like

Hey everyone!

I’m trying to integrate my Xiaomi Aqara E1 wireless remote switches (WXKG16LM and WXKG17LM) with ControllerX. So far it’s going pretty well, but I cannot get the hold action to work. I’ve included a snippet from my apps.yaml below.

  module: controllerx
  class: WXKG17LMZ2MLightController
    name: z2m
    listen_to: mqtt
  controller: "Switch friendly name"
    name: "Light friendly name"
    mode: mqtt
    single_left: toggle
      action: hold
      attribute: brightness
      direction: toggle
      mode: stop

The single_left action is working just fine, turning the light on and off. However, the hold_left action only seems to increase the brightness of the light. Once it hits full brightness, pressing and holding the same button again does absolutely nothing (or so it seems, at least).

Below is a snippet of the code I added to controllerx/cx_devices/ to integrate my switches.

class WXKG17LMZ2MLightController(Z2MLightController):
    def get_z2m_actions_mapping(self) -> DefaultActionsMapping:
        return {
            "single_both": Z2MLight.TOGGLE,
            "single_left": Z2MLight.TOGGLE,
            "double_left": Z2MLight.CLICK_BRIGHTNESS_UP,
            "hold_left": Z2MLight.HOLD_BRIGHTNESS_TOGGLE,
            "single_right": Z2MLight.TOGGLE,
            "double_right": Z2MLight.CLICK_BRIGHTNESS_UP,
            "hold_right": Z2MLight.HOLD_BRIGHTNESS_TOGGLE

Does anybody see what I’m doing wrong?


I am struggling to get ControllerX to work. I’ve installed it recently like a week ago. I am able to edit the yaml files in the new location. I tried everything I could think off but no results and no idea where and what to look for in logs etc.

Any help is much appreciated!

What I see in Appdeamon under Events - MQTT is all traffic being sent. (so looks good I assume)

These are my yaml files:

secrets: /homeassistant/secrets.yaml
  latitude: 52.379189
  longitude: 4.899431
  elevation: 2
  time_zone: Europe/Amsterdam
      type: hass
      type: mqtt
      namespace: mqtt # This is important
      client_host: #
      client_user: addons #
      client_password: !secret mqtt_pw
# keuken_controller:
#   module: controllerx
#   class: Philips929002398602Z2MLightController
#   controller: New Hue Dimmer
#   integration:
#     name: z2m
#     listen_to: mqtt
#     action_key: action
#   light:
#     name: Keuken Spot 1
#     mode: mqtt

  module: controllerx
  class: Philips929002398602LightController
  integration: z2m
  controller: sensor.new_hue_dimmer_action
  light: light.keuken_spot_1