ControllerX. Bring full functionality to light and media player controllers

Hi @motionist,

I answered the GitHub ticket ([QUESTION] · Issue #410 · xaviml/controllerx · GitHub). We can keep the discussion in there.

Regards,
Xavi M.

Hi @Jared_Heath,

Double taps are done with $ token. You can read more about it here.

If you want to control multiple lights with the same controller, you will need to either:

  • Create a group of lights with Group integration or Light group integration (Read more here). This is the recommended way.
  • Create multiple configs, one for each light (not recommended since you need to repeat the configs).

You can use mapping or merge_mapping for this purpose. Read about these attributes here, and here.

Only thing you need is what is defined in here, which is <action>$<number_of_clicks>. ControllerX will understand automatically that tthe action is a double click one, and handle it.

Regards,
Xavi M.

Hi @Canaletto,

These actions were reported in this ticket: ZHA integration for WXCJKG12LM · Issue #202 · xaviml/controllerx · GitHub 1 year ago. Did this change from ZHA? Has the 1_long press action worked for you before? Unfortunately, I do not have this device to check this myself. I just want to confirm this is how it works with the latest version of dependencies (HA, ZHA, etc).

Regards,
Xavi M.

Yes ! Is x_hold

{
    "event_type": "zha_event",
    "data": {
        "device_ieee": "54:ef:44:10:00:1c:48:fd",
        "unique_id": "54:ef:44:10:00:1c:48:fd:6:0x0012",
        "device_id": "d598367d8463218f46ae9718a5a16872",
        "endpoint_id": 6,
        "cluster_id": 18,
        "command": "6_hold",
        "args": {
            "button": 6,
            "press_type": "hold",
            "attr_id": 85,
            "value": 0
        }
    },
    "origin": "LOCAL",
    "time_fired": "2022-01-23T15:42:04.390564+00:00",
    "context": {
        "id": "290ae05772efd15fcaf783a05815e912",
        "parent_id": null,
        "user_id": null
    }
}
1 Like

Hi @Canaletto,

I have filed this issue in this ticket. I have now released now ControllerX v4.18.2 with this fix.

Regards,
Xavi M.

1 Like

Hi @xaviml, thank you for getting back to me :slight_smile:

Basically it just wasn’t working… I had no response after clicking the buttons.

I have since done some other automations with these buttons though, so for now my issue is “resolved”.

I’ve used your controller for the E1743 (IKEA) and it works flawlessly, but I seem to not have the same luck with the SmartThings buttons for whatever reason.

Really appreciate the work you’ve done here and the response! :slight_smile:

1 Like

I have a ControllerX question. I have this working with a LIFX light bulb and an IKEA switch (Ikea E2002).

This is working.

Now I want to add a function for ‘double click’.

When double clicking the ‘ON’ button, I want to change color & brightness to a specific value. I can’t get this working, even tried in Node-Red. Any advice ?

At this moment I have this :

image

I think it is something like :

mapping:
on$2: < a way to set color/brightness >

I know I need to SET this values :

color_mode: hs
brightness: 61
hs_color:
  - 319.663
  - 70.999

But how do I put this in the config for double click ?

See un example :slight_smile:

moes_1_app_1:
  module: controllerx
  class: Controller
  controller: sensor.moes_sw_1_action
  integration: z2m
  mapping:
    1_single:
      service: light.turn_on
      data:
        entity_id: light.groupe_d_ampoules_led
        color_name: blue
        transition: 25
        brightness: 255

Attention : use minus carracters…

Hi,

Yeelight lights have limit 60 request/minute. After that lights become unavailable for few minutes, which is pretty bad. What would be the best way to implement this limit to ControllerX? It is pretty easy to exceed this limit by rotating the E1744.

I am using the example code:

“The following configuration is a tricky one, but at the same time it also shows the power of ControllerX to adapt to any use case. Imagine we want the following for our Symfonisk controller (E1744) with deCONZ”

Update: I found question in this topic by @tobimori who had same problem. The recommended solution was to use values:

  automatic_steps: 6
  delay: 150

Is this still a good value nowadays? Right after the question was released newer version of ControllerX with transition functions, I don’t know if that changed anything to these values.

One more question:

with the example above, because there is no 4 click recognition in E1744, but I want ‘moodlight’ mode more than changing color temperature, how it would be possible to call the following service when double click is recognized:

  - service: yeelight.set_mode
    data:
      mode: moonlight
    target:
      entity_id:
      - light.ceiling1
      - light.ceiling2
      - light.ceiling3

and when double click again change mode ‘normal’.

Thank you.

Edit2:

In my head I have something like this:

example_app5:
  module: controllerx
  class: E1744LightController
  controller: symfonisk_sound_controller
  integration: deconz
  light: light.yeelight_lights_1
  mapping:
    1002: toggle # 1 clicks
    1004: # 2 clicks
      - service: input_select.select_next
        data:
          entity_id: input_select.yeelight1_mode
      - service: yeelight.set_mode
          data:
            mode: "{{ states('input_select.yeelight1_mode') }}"
          target:
            entity_id:
            - light.ceiling1
            - light.ceiling2
            - light.ceiling3    
    1005: # empty

…but for some reason it is not working. When double click I am calling input_select.select_next service to change between (‘moonlight’, ‘normal’) and in the next step I am calling yeelight.set_mode to set mode by template.

Unfortunately this code not working at this moment, even the single click toggle and my HA logs are empty.

Still not OK, it won’t accept it…

Master_Light:
  module: controllerx
  class: W2049LightController
  controller: sensor.schakelaar_master_bedroom_action
  integration: z2m
  light: light.master_bedroom
  smooth_power_on: true
  mapping:
    on$2:
      data:
        entity_id: light.master_bedroom
        color_name: purple
        transition: 25
        brightness: 62 

I get the error
ValueError: Not able to parse
{'data': {'entity_id': 'light.master_bedroom', 'color_name': 'purple', 'transition': 25, 'brightness': 62}}. Available keys are: [‘action’, ‘service’, ‘scene’, ‘delay’]

@xaviml , can you help me out, please? I’m missing something, I think.

I don’t think double click is supported on this model…

https://www.zigbee2mqtt.io/devices/E2001_E2002.html#ikea-e2001-e2002

Hi, looking for some help with this. I’m using it for an Aurora Aone battery double dimmer and the toggle function is working but not the dim up and down.

My configuration is as follows:

KD_dimmer_left:
  module: controllerx
  class: AUA1ZBR2GWLightController
  controller: "00:0d:6f:ff:fe:c1:ad:b5"
  light: light.dining_room_sofa_lights
  integration: zha
  actions:
    - 2_toggle
    - 2_step_up
    - 2_step_down
    - 2_step_color_temp_up
    - 2_step_color_temp_down

KD_dimmer_right:
  module: controllerx
  class: AUA1ZBR2GWLightController
  controller: "00:0d:6f:ff:fe:c1:ad:b5"
  light: light.dining_room_table_lights
  integration: zha
  actions:
    - 1_toggle
    - 1_step_up
    - 1_step_down
    - 1_step_color_temp_up
    - 1_step_color_temp_down

I notice in the logs that toggling triggers a “service” action whereas dimming doesn’t:

2022-01-27 17:41:58.146769 INFO KD_dimmer_left: 🤖 Service: e[1mlight.togglee[0m - entity_id: light.dining_room_sofa_lights
2022-01-27 17:41:58.142417 INFO KD_dimmer_left: 🏃 Running `Predefined (toggle)` now
2022-01-27 17:41:58.135821 INFO KD_dimmer_left: 🎮 Button event triggered: `2_toggle`
2022-01-27 17:41:56.128843 INFO KD_dimmer_left: 🤖 Service: e[1mlight.togglee[0m - entity_id: light.dining_room_sofa_lights
2022-01-27 17:41:56.124548 INFO KD_dimmer_left: 🏃 Running `Predefined (toggle)` now
2022-01-27 17:41:56.118320 INFO KD_dimmer_left: 🎮 Button event triggered: `2_toggle`
2022-01-27 17:41:54.276279 INFO KD_dimmer_left: 🏃 Running `Predefined (click_brightness_down)` now
2022-01-27 17:41:54.268296 INFO KD_dimmer_left: 🎮 Button event triggered: `2_step_down`
2022-01-27 17:41:53.379990 INFO KD_dimmer_left: 🏃 Running `Predefined (click_brightness_up)` now
2022-01-27 17:41:53.373209 INFO KD_dimmer_left: 🎮 Button event triggered: `2_step_up`

The lights being controlled are actually Z-wave devices (Fibaro Dimmer 2), not sure if that makes a difference?

Home Assistant and ControllerX are both installed in dockers and are obviously managing to talk to each other as the toggle action is working. I’m sure I’m missing something obvious but I can’t spot it.

On a separate note: I can see that if I twist the dial rapidly it doesn’t generate as many events as I would expect, can I play with lowering the “delay” setting to get it to recognise more? Ideally a rapid twist of 5 ‘notches’ would trigger a 50% increase in brightness (e.g 5 events) but it only recognises 1-2 events.

Thanks!

Hi @erwin.fiten,

@Canaletto gave you the right configuration for you to start, however, you missed the service attribute as the logs are indicating. So configuration should look like this:

Master_Light:
  module: controllerx
  class: W2049LightController
  controller: sensor.schakelaar_master_bedroom_action
  integration: z2m
  light: light.master_bedroom
  smooth_power_on: true
  merge_mapping:
    on$2:
      action: "on"
      attributes:
        color_mode: hs
        hs_color: [319.663, 70.999]
        brightness: 61 

You can also do it with the service like:

Master_Light:
   ...
  merge_mapping:
    on$2:
      service: light.turn_on
      data:
        hs_color: [319.663, 70.999]
        brightness: 61 

Both option should work. Consider that I am not sure those attributes will work with your light. At least the brightness should since I have it on my configurations.

Also, just a small note on @Canaletto comment:

This is not true. The multi-clicking feature works with all integrations and devices since it is a virtual layer added in ControllerX.

@erwin.fiten , if you want to learn more about multi-clicking feature, please read here.

Hope this helps and let me know if you have further questions :slight_smile:

Regards,
Xavi M.

I had not seen that you had virtualized the multiclic, bravo !

1 Like

Hi @madrian,

Yes, those attributes are the ones I would recommend. delay is the time between requests, so if you do not want to do more than 60 req/minute, the minimum delay you need is 1000ms, which is 1 req per second (making a total of 60 per minute). Considering you are not going to do 60 request per minute, you can probably lower it down to 500. Then, the automatic_steps will need to be adjusted accordingly to your liking. I recommend something low since delay is quite high. So, probably something between 5 or 8 as you pointed out. If the light allows it, you can lower the delay until you see the light struggling.

That is how I would do it, but could you please check the AppDaemon logs? In there, you will probably see some errors if not even the toggling is working. One thing I noticed is that is not indented properly, so it should be:

example_app5:
  module: controllerx
  class: E1744LightController
  controller: symfonisk_sound_controller
  integration: deconz
  light: light.yeelight_lights_1
  mapping:
    1002: toggle # 1 clicks
    1004: # 2 clicks
      - service: input_select.select_next
        data:
          entity_id: input_select.yeelight1_mode
      - service: yeelight.set_mode
        data:
          mode: "{{ states('input_select.yeelight1_mode') }}"
          entity_id:
            - light.ceiling1
            - light.ceiling2
            - light.ceiling3

I have also removed the target since it seems it is not needed according to documentation.

In case of seeing that the input_select is changing, but the next call is not picking up its value, it is because the value has not changed when running the second action, so you can add between both services:

...
    - delay: 0.5 # Delay in seconds
...

Regards,
Xavi M.

1 Like

It is pretty good! It allows you to use multiple clicks for controllers that do not even support it! I use it on my E1810 remote to turn on full brightness when double clicking the brightness up:

livingroom:
  module: controllerx
  class: E1810Controller
  controller: livingroom_controller
  integration:
    name: z2m
    listen_to: mqtt
  light: light.livingroom_lamp
  smooth_power_on: true
  multiple_click_delay: 300
  merge_mapping:
    toggle$2:
      service: light.toggle
      entity_id: light.livingroom_fairylights
    toggle$3:
      service: light.toggle
      entity_id: light.bedroom
    arrow_right_click$2:
      service: light.turn_on
      entity_id: light.bathroom_wled
      data:
        effect: "{{ state_attr('light.bathroom_wled', 'effect_list') | random }}"
    brightness_up_click$2: on_full_brightness
    brightness_down_click$2: on_min_brightness
    arrow_left_click$2: on_min_color_temp

Highly recommended :ok_hand:

Hi @mjombly,

It seems strange to me that it shows the 🏃 Running Predefined (click_brightness_up) now message, but not the service message. Could you add log_level: DEBUG to your configuration?

KD_dimmer_left:
  log_level: DEBUG
  module: controllerx
  class: AUA1ZBR2GWLightController
  controller: "00:0d:6f:ff:fe:c1:ad:b5"
  light: light.dining_room_sofa_lights
  integration: zha
  actions:
    - 2_toggle
    - 2_step_up
    - 2_step_down
    - 2_step_color_temp_up
    - 2_step_color_temp_down

Then, do the same and see if any new logs are shown. Please share that with me.

Regarding the delay option, this controller does not support hold-release actions, so there is no way for ControllerX to know when the user stopped moving the dial, so the delay attribute will not do anything, unfortunately. What ControllerX does is call a click action every time the dial is moved.

Regards,
Xavi M.

Thanks for the quick response Xaviml, I’ve added that line and restarted the docker container but I’m not seeing any extra lines in the log when I use the toggle or dim on the controller.

Just done some more playing and it seems like it’s user error on my part - the light has to be on for the dim command to work. I was trying to dim up from off which was working on my manual automation but doesn’t seem to be standard behaviour for controllerx.

Is there any way to change this behaviour?

Also - understood about the Delay variable but is there any other way to let the switch send multiple events in a short(er) space of time?

Edit: I think I’ve achieved this by adding the following 2 arguments:

  action_delta: 100
  transition: 0

Seems to be working but I guess I might flood my zigbee network?

Thank you Xavi, it works perfectly now.

1 Like