ControllerX. Bring full functionality to light and media player controllers

@shz I think you haven’t installed AppDaemon the program itself.
Enabling it in HACS just shows appdaemon apps to install.
If you’re running HASS.IO, then you will find it under add-ons
See the AppDaemon docs for installation methods.

Thank you for the Info. i was not sure. As i run homeassistant with docker, i will configure an appdaemon container that runs alongside and connect it to homeassistant

I used now this configuration:

Copy to clipboard

  dachboden_controller:
    module: controllerx
    class: E1810MediaPlayerController
    controller: tradfri_fernbedienung
    integration: deconz
    media_player: media_player.dachboden
    volume_steps: 40
    excluded_actions:
      - 4001 # Hold left arrow event
      - 5001 # Hold right arrow event

  dachboden_controller_speaker:
    module: controllerx
    class: CustomSwitchController
    controller: tradfri_fernbedienung
    integration: deconz
    switch: switch.leiste_2
    mapping:
      5001: toggle

But this want work. A long press to left or right still switches fast to the next/last song. I also restarted HA, but nothing changed.

When I look at the events, I see only 4002/5002 coming when long pressing on left/right.
Up/down are sending 2001/3001 as long as pressed and at the end 2003/3003, a short press is 2002/3002.

I it possible that I have an old firmware, that don’t send hold/release events for the left and right keys?
When I am pressing left/right longer I only get repeatedly 4002/5002. There is no 4001/5001 or 4003/5003 send!

Or do I had something defined wrong?

Hi @carsten_h,

Sorry for the late reply. I think you are experiencing a bug due to the firmware, indeed. I have the same problem as you with deCONZ and the E1810 controller. The brightness buttons work as expected, but not the left and right arrows. So the event id mapping I have in here does not match anymore with what I have.

The version of the firmware I have is 1.2.223, but the latest firmware is 2.3.014. I am currently updating the firmware with z2m via OTA updates. However, I am not sure how to achieve the same with deCONZ.

I will let you know if this fixed the problem or not once is updated (it takes a while…)

Cheers,
Xavi M.

I also found this: https://github.com/dresden-elektronik/deconz-rest-plugin/issues/2618#issuecomment-629755495

Apparently is a problem of the remote, maybe by removing the batteries and putting them back as they mention, it will fix the problem.

Oh, I have 1.2.214. I have to look how to make the OTA updates without UI.

You are right! Putting the battery out and back in fixed it. Now I get also 4001/5001 and 4003/5003.
And also the switch is switched now!

THANK YOU VERY MUCH!

1 Like

Good to know… I will try this once it finishes the update (23% now… haha)

Glad it worked then :slight_smile: Does you ControllerX config works then or it is not doing what you expected?

It is doing what I expected. So I can have two additionally switches.
Is it possible to not use switches but to start a script?

Yes, you could do the following:

custom_hue_dimmer_example:
  module: controllerx
  class: CallServiceController
  controller: your_controller
  integration: deconz
  mapping:
    1002:
      - service: script.my_script
      - service: script.my_script2
        data:
          attr1: value

This does a call service (the same as you can do on the developer tools on HA) and it calls those 2 scripts when clicking the center button for example.

Ah, OK. Thank you!

1 Like

Hello!
Thanks a lot for this AppDaemon, it’s very useful for me.
I have only a little problem. I’m using a Xiaomi WXKG01LM button to control IKEA TRÅDFRI LED bulb, but I want to use the old non-smart wall switch to switch on/off the bulb too.
It’s working fine until I restart the Home Assistant. When the analog switch turned off, after the HA restart, the corresponding app gets terminated, and I can only restart it, if I edit the config. I can’t see any good in log…
Is there any way to fix this?

Thanks a lot for your help!

Hello!

Is there any reason why this Xiaomi controller is only working with Zigbee2MQTT and not with deCONZ?
https://xaviml.github.io/controllerx/controllers/WXCJKG13LM

Glad to hear ControllerX is useful for you @expeacer. I will be looking into this that you just mentioned, but correct me if I am wrong, these are the steps you followed:

  • Turn off the dumb switch
  • Restart Home Assistant (the core, not the whole machine)
  • Turn on the dumb switch (otherwise it is normal that it does not work)
  • Your Xiomi controller cannot turn on/off your light anymore

Let me know if these are the steps you followed, otherwise, describe them in here, so I can reproduce it. Thanks! :slight_smile:

Hi @carsten_h,

The only reason is because I do not have this controller and no one open an issue wanting to add support to it. If you own the controller and want me to add it to ControllerX, then you need to fill in this issue template. I will basically need the events that each button fires when: clicked, hold, release, triple click, etc. Then I will add the same mapping than z2m.

Thanks :slight_smile:

Ok, I see. I wanted to buy it but I saw that there is no support in ControllerX. But if you only need the button codes, that is no problem. Sadly the button will take one month to deliver. So had to think about. I will write the issue template if I choose to buy it.

Of course, no problem. Adding new support to controllers is easy, however, I need the mappings which I can only have if someone has the controller. If you happen to purchase it and you are interested in using it with ControllerX, then I will be glad to add the support for it :slight_smile:

1 Like

A little correction - I don’t need to turn anything, the app get terminated when the HA restarted.
I made a little video about this, to make it easier. YouTube.

After the video, realized there is an error:

2020-06-11 10:39:03.603598 WARNING halo_light_xiaomi: ------------------------------------------------------------
2020-06-11 10:39:03.603457 WARNING halo_light_xiaomi: Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/appdaemon/app_management.py", line 143, in initialize_app
    await init()
  File "/conf/apps/controllerx/core/type/light_controller.py", line 118, in initialize
    self.supported_features = LightSupport(bitfield)
  File "/conf/apps/controllerx/core/feature_support/light.py", line 14, in __init__
    super().__init__(
  File "/conf/apps/controllerx/core/feature_support/__init__.py", line 21, in __init__
    parsed_number = int(number)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

2020-06-11 10:39:03.603129 WARNING halo_light_xiaomi: ------------------------------------------------------------
2020-06-11 10:39:03.603016 WARNING halo_light_xiaomi: Worker Ags: {}
2020-06-11 10:39:03.602875 WARNING halo_light_xiaomi: Unexpected error in worker for App halo_light_xiaomi:
2020-06-11 10:39:03.602678 WARNING halo_light_xiaomi: ------------------------------------------------------------

My app config:

halo_light_xiaomi:
  module: controllerx
  class: WXKG01LMLightController
  controller: sensor.xiaomi_switch_click
  integration: z2m
  light: light.halo_lampa_light

Thanks a lot for your help!

Hi @expeacer,

Thanks for the video. I did understand better the error now and I know what is happening. When the app is initialized, ControllerX reads the supported_features from the entity is going to act. Since the light is unavailable, the supported_features cannot be read and then the initialization of the controller crashed, meaning that the controller will not work, which is what is happening to you.

I have to think about how to tackle this. I wanted to read the supported_features attribute in initialization time to avoid requesting it every time a button is pressed since it is something that will not change. I will probably change it, so it reads the supported feature first time a button is held (if it cannot be reached, it will try to read next time), this way the initialization will not crash and it won’t terminate the app.

I created this issue related to this problem. I will fix it asap and it will be okay for next release :slight_smile:

Thanks for spotting this error!

1 Like