ControllerX. Bring full functionality to light and media player controllers

Hi @xaviml,

I seen it on the github Post so gave if a try I only really posted the config so that anyone else here could see how it was fixed…

No need for you to apologise! With everything you are doing, this is nothing! Thank you for all your hard work!

Yeah I purposely changed the buttons as I’m using the speaker as a radio so I’m scrolling through radio stations.

1 Like

Hi,

I’ve just installed ControllerX and started playing with it, and I must say that it’s awesome. Thank you @xaviml for your hard work and this excellent library.

I use ControllerX with an Aqara double switch and a Deconz Conbee II. It works great, but I’m trying to achieve something that I can’t find in the documentation.

I would like the left button to toggle the light, and the right button to cycle through brightness level :

  • Right button click :
If  first click, go to half brightness
else if second click, go to min brightness
else if third click, go to max brightness
go back to the first condition

Do you think that it’s possible ? I’m new to HASS, so I might have missed something :wink:

Hi @aixki,

That is a tricky use case, but definitely possible. I would do it with an input_select like:

input_select:
  light_state:
    options:
      - half_brightness
      - full_brightness
      - min_brightness

Then, your ControllerX config would look like:

example_app:
  module: controllerx
  class: WXKG02LMLightController
  integration: deconz
  controller: my_controller
  light: light.my_light
  mapping:
    1002: toggle
    2002:
      service: input_select.select_next
      data:
        entity_id: input_select.light_state

example_app_half_brightness:
  module: controllerx
  class: WXKG02LMLightController
  integration: deconz
  controller: my_controller
  light: light.my_light
  mapping:
    2002: set_half_brightness
  constrain_input_select: input_select.light_state,half_brightness

example_app_full_brightness:
  module: controllerx
  class: WXKG02LMLightController
  integration: deconz
  controller: my_controller
  light: light.my_light
  mapping:
    2002: on_full_brightness
  constrain_input_select: input_select.light_state,full_brightness

example_app_min_brightness:
  module: controllerx
  class: WXKG02LMLightController
  integration: deconz
  controller: my_controller
  light: light.my_light
  mapping:
    2002: on_min_brightness
  constrain_input_select: input_select.light_state,min_brightness

As you can see, you need to define each of the clicks as a separate config.

This controller also has double click support, so you can use:

  • 1 left click: toggle
  • 2 left clicks: haf_brightness
  • 1 right click: full brightness
  • 2 right clicks: min brightness

And this will be easier to set up in a single config, but it is not as intuitive as the cycle configuration you suggested.

Anyway, let me know if this works as expected :slight_smile:

Regards,
Xavi M.

1 Like

Thanks @xaviml for your fast and detailed answer!! I got the idea and will try this. It’s cumbersome, but it gets the job done :wink:

Another way would be to call a script, giving it the light entity id as a parameter AND the input_select value. Then the script would set the brightness value based on the input_select parameter. I don’t know if it’s clear what I say :wink:

Indeed @aixki, that is another way you could do it too. Probably much cleaner. You would not need to send the input_select value from ControllerX (which you would need templating support for that, and it is not supported yet), so you could get the value of the input_select from the script itself.

Hi,

I am using ControllerX with the RaspBee 2, and Ikea controller and it’s working well in the “default” mode. However, I would like to do some customisation of button actions and I do not succeed to get the mapping or merge_mapping working. If I uncomment mapping section the controler does not work anymore. What am I doing wrong?

module: controllerx
  class: E1810Controller
  controller: tradfri_remote_control
  integration: deconz
  multiple_click_delay: 500

  light: light.birou_cosmin
  # mapping:
  #   toggle: toggle
  #   brightness_up_click: on_full_brightness
  #   brightness_down_click: on_min_brightness
  #   brightness_up_hold: on_full_brightness
  #   brightness_down_hold: on_min_brightness
  #   arrow_right_click: on_full_color_temp
  #   arrow_left_click: on_min_color_temp
  #   arrow_right_hold: on_full_color_temp
  #   arrow_left_hold: on_min_color_temp

Thank you

Hi @cosmin,

If you check the device page you are using, you will see that the mapping you are using is for Zigbee2MQTT, but the integration you put is deCONZ. So instead of “toggle”, you should put 1002; instead of brightness_click_up, you should put 2002, etc.

Then, you will be able to use mapping and merge_mapping.

Regards,
Xavi M.

Thank you! It works.
Is my understanding correct that the equivalent of toggle$2 does not exist for deCONZ?

Hi @cosmin,

toggle is a Z2M action, the equivalent for deCONZ is 1002, so for double click in the middle: 1002$2.

Regards,
Xavi M.

Thank you @xaviml for helping. I am still missing something:

birou_remote:
  module: controllerx
  class: E1810Controller
  controller: tradfri_remote_control
  integration: deconz
  multiple_click_delay: 500

  light: light.birou_cosmin
  mapping:
    1002$2:
      - service: light.toggle
        data:
          entity_id: light.color_temperature_light_20
    1002:
      - service: light.toggle
        data:
          entity_id: light.color_temperature_light_21

light.color_temperature_light_21 works as expected (toggled by mid button) but light.color_temperature_light_20 does not work

Hi @cosmin,

I would recommend you to start the multiple_click_delay at 1000 and see if it is working. If so, you can start lowering it down up to the point that it is working with a normal double click speed. If not working with 1000, try something bigger.

EDIT: If it is still not working, please add the AppDaemon logs for when you are double clicking, as well as checking in “Developer Tools > Events” the fired events when listening to “deconz_event”.

Regards,
Xavi M.

Thank you. It works with multiple_click_delay at 1000

1 Like

For anyone willing to help me with this project:

I have released ControllerX 4.4.0b1. This is a pre-release of the next stable version (v4.4.0). I have included a new feature to allow calling actions in different ways, similar to Syntax Script from Home Assistant. This new feature should not add any breaking changes to any configuration.

It would help me if you could install the new pre-release through HACS and see if your current setup with ControllerX keeps working as expected, and no errors are thrown in the AppDaemon logs.

If you are using WXKG11LMLightController, you will need to change it to WXKG11LMRemoteLightController if it supports hold-release events, and WXKG11LMSensorSwitchLightController if it does not support hold-release events.

Note that some links from the release notes might not be working because the documentation has not been deployed yet.

Cheers,
Xavi M.

hi’ @xaviml

You’ve been busy again I can see :wink:
Just updated and no breaking changes in my 23 active apps as far as I can see :+1:
Only a click namespace warning (Thought I HAD changed them all. Nice with the warning though)

Have to check the new scripting features with the ability to pass on data :sunglasses::rocket:

2021-01-10 23:56:17.662437 INFO controller_switchmode11_on_utility: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.681366 INFO controller_switchmode11_off_utility: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.706001 INFO controller_switchmode11_on_hallway: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.716505 INFO controller_switchmode11_off_hallway: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.727359 INFO controller_switchmode11_on_koekken: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.736931 INFO controller_switchmode11_off_koekken: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.746803 INFO controller_switchmode11_on_office: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.753848 INFO controller_switchmode11_off_office: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.760732 INFO office1_controller: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.768063 INFO office2_controller: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.775348 INFO exampe_app_off: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.787039 INFO office4_controller: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.794457 INFO controller_switchmode11_on_master_bedroom: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.801754 INFO controller_switchmode11_off_master_bedroom: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.808268 INFO controller_switchmode11_on_rasmus: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.815026 INFO controller_switchmode11_off_rasmus: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.821502 INFO rasmus_controller: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.828534 INFO controller_switchmode11_on_mikkel: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.835314 INFO controller_switchmode11_off_mikkel: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.841770 INFO mikkel_controller: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.848797 INFO sonos_speaker: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.873130 WARNING office2_controller: office2_controller: Entity sensor.0x00158d0002af8c8d_click not found in namespace default
2021-01-10 23:56:17.881658 INFO sonos_speaker_1: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.900150 INFO controller_left_switch: 🎮 ControllerX v4.4.0b1
2021-01-10 23:56:17.905554 INFO AppDaemon: App initialization complete

Ciao !

Hi @htvekov,

23 active apps? Wow! And here I was, happy with my 5 active apps… I gotta admit that I do develop feature that I do not end up using sometimes.

Thank you for reporting back, this gives me the confidence to deploy the stable version, which I will do either today or tomorrow.

For the moment, I did a few changes on how actions are being called, but the predefined actions cannot yet be passed with parameters. However, the changes I made will help me out changing this for next release. For each release I try to refactor things out to give room for bigger feature request that require a more mature and stable codebase.

Cheers,
Xavi M.

Hi’ @xaviml

Remember I’ve loads of (almost) identical apps for my Tasmotized wall switches (2 apps for each) :wink::grin:
Just tried the action/event possibility, but I simply can’t figure out the proper syntax ?
Simply can’t get syntax example used in #173 to work.

Could you post a mini 5-6 line action/event example ?
It must be me that’s daft… :roll_eyes:

Ciao !

Hi @htvekov,

The new way of calling action is called Action types, and these are the different ones:

  • predefined actions: This is what we had already with “toggle”, “on_min_brightness”, etc
  • call service: We already had this, but I improved it by adding the entity_id, so you don’t have to put the entity_id inside the data attribute.
  • Scene activation: a shortcut to turn on a scene
  • Delay: Way to wait before keep the execution

Now the mapping accepts a list of action types (mixed or not).

The documention I wrote up can be found in here.

This is a dummy example:

example_app:
  module: controllerx
  class: E1743Controller
  controller: sensor.livingroom_controller_action
  integration: z2m
  light: light.livingroom
  merge_mapping:
    "off":
      - scene: scene.night
      - delay: 5 # in seconds
      - service: light.turn_off
        entity_id: light.my_other_light

Regards,
Xavi M.

Thanks, @xaviml.

Well, I might as well watch some TV instead ir go to bed now… :tired_face::roll_eyes:
I’ve punched in the actual word “event” in front of every event… :crazy_face:

I’ll do some sequence testing and some attribute data passing and get back to you.
Initial small tests worked 100% as expected.

Nice work, Xavi :+1::sunglasses:

Ciao !

Hi @htvekov,

I didn’t want to put any specific event on it because that part depends on the device and the integration. In fact, I changed some other parts of the documentation to clarify what goes in the key (the devicrle event) and what in the value (action type(s)). However, I could change event into <event>, which makes it more clear that is a placeholder for the device event.

Thank you for the feedback anyway! :slight_smile:

Regards,
Xavi M.

v4.4.0 is now released :partying_face:

downloads

:warning: This minor change contains a breaking change.
Note: Remember to restart the AppDaemon addon/server after updating to a new version.

:pencil2: Features

  • Add action types, a new way to define actions to be executed. [ #173 ]
  • Add functionality to ring color button from MLI-404011 (Müller Licht) for deCONZ. [ #111 ]

:hammer: Fixes

  • Fix Z2M mapping for WXKG01LMLightController to use action and not the deprecated click [ #206 ] @htvekov
  • Add missing actions for the E1810MediaPlayerController with deCONZ and ZHA. The missing actions where the hold actions to change source. [ #215 ]
  • Add missing stop event for E1766CoverController when using deCONZ, so hold-release can be used. [ #71 ]
  • Log ControllerX version when app is initialized before doing anything else

:scroll: Docs

:video_game: New devices

  • HG06323 - add light controller support for Z2M [#208 ] @poorting
  • E1766 - add light, media player and switch controller support for Z2M [#214 ]
  • WXKG11LM-remote - In favor of the old WXKG11LM with mixed mappings. If you were using the WXKG11LMLightController with hold-release actions, then you need to change it to WXKG11LMRemoteLightController [ #216 ] * BREAKING CHANGE *
  • WXKG11LM-sensor_switch - In favor of the old WXKG11LM with mixed mappings. If you were using the WXKG11LMLightController with NO hold-release actions, then you need to change it to WXKG11LMSensorSwitchLightController [ #216 ] * BREAKING CHANGE *