ControllerX. Bring full functionality to light and media player controllers

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

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

https://xaviml.github.io/controllerx/controllers/TuYaERS10TZBVKAA/

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

entity

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:

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

and here is whatā€™s in the Z2M config for the Tuya:

'0x003c84fffeb13c00':
  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:

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

For testing purposes I also simplified above config by removing ā€œactionsā€ and ā€œmerge_mappingā€ blocks.
then this one:

pokoj_zyrandol:
    module: controllerx
    class: LightController
    controller:
        - shellies/shellyswitch25-C45BBE6B4D2E/input_event/0
    light: light.pokoj_zyrandol
    integration:
        name: mqtt
        key: event
    mapping:
        "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:

event_type: shelly.click
data:
  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"
context:
  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!
Marek

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.

hue_dimmer_ouderslaapkamer1:
  module: controllerx
  class: Philips929002398602Z2MLightController
  controller: sensor.hue_dimmer_slaapkamer1_action
  integration: z2m
  light: light.bed_1
  update_supported_features: true
  merge_mapping:
    on_press_release:
      service: light.toggle
      data:
        entity_id: light.bed_1
    on_press_release$2:
      service: light.toggle
      data:
        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.
    up_press_release:
      service: light.turn_on
      data:
        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?

Greetings

Lukas

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:

LightLivingRoom:
  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";
      ]]]
  excluded_actions:
    - 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:

https://controllerx.netlify.app/controllerx/examples/#advanced

Regards,

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:

lounge_lights_4button:
  module: controllerx
  class: E2002Z2MLightController
  integration: z2m
  controller: sensor.lounge_remote_4button_action
  light: Lounge Lights
  merge_mapping:
    toggle$2:
      service: light.toggle
      data:
        entity_id: light.lounge_lamp_1
    toggle$3:
      service: light.toggle
      data:
        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!

@xaviml
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;
https://github.com/xaviml/controllerx/issues/875

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>
    sys.exit(main())
             ^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", line 417, in main
    admain.main()
  File "/usr/lib/python3.11/site-packages/appdaemon/__main__.py", 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.

switch_light:
  module: controllerx
  class: WXKG17LMZ2MLightController
  integration:
    name: z2m
    listen_to: mqtt
  controller: "Switch friendly name"
  light:
    name: "Light friendly name"
    mode: mqtt
  mapping:
    single_left: toggle
    hold_left:
      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/aqara.py 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?

Hi,

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
appdaemon:
  latitude: 52.379189
  longitude: 4.899431
  elevation: 2
  time_zone: Europe/Amsterdam
  plugins:
    HASS:
      type: hass
    MQTT:
      type: mqtt
      namespace: mqtt # This is important
      client_host: 192.168.2.2 #
      client_user: addons #
      client_password: !secret mqtt_pw
http:
  url: http://127.0.0.1:5050
admin:
api:
hadashboard:
# 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

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

Can you check your directory structure - if you navigate to the root directory, do you have the addon_configs folder like this:

and then an xxxx_appdaemon folder within that one? Then within that one you should have your appdaemon.yaml file that you posted above, as well as an apps folder? Inside the apps folder, you should have your apps.yaml file as well as a controllerx folder?

I think I miss the ControllerX folder. All others I can find.
image

I have found it here:

Can I just copy over all files to the new directory? What happens when an update is pushed?