ControllerX. Bring full functionality to light and media player controllers

Thanks @dede34fr, but I will need the states that the controller sends when each button is pressed. I only see it supports click and not hold, but I would need to know which clicks are supported.

OK will look a that when I get it

Hi @xaviml

Thanks for the reply!

I tried the transition attribute with the HA services homeassistant.turn_on and even with homeassistant.turn_off. The only difference was that bulb lighted up a little later (~2 seconds) with transition: 100, but it did remember the last brightness state.

Additionally, I tried to change controllers and bulbs between together and noticed that E1810Controller (the round one with 5 buttons) did remembered the ikea E27 806lumen brightness value. However the E1743Controller (the square one with 2 buttons) behavior didnā€™t changed with ikea E27 1000lumen, meaning that it did not remember the brightness value when the light was turned on.

Ikea E27 806lumen supported_features state value ā€œ41ā€ (please notice that this bulb doesnā€™t support color change if it affects something).
Ikea E27 1000lumen supported_features state value ā€œ43ā€ (does support color_temp)

This is getting very interestingā€¦=)

Sure, I could use only ControllerXā€™s dim_up and dim_down features for E1743 and do simple HA automations to turn on/off the light, but of course it would be nice to have it all in one place.

Is there any change that the method Light.ON_FULL_BRIGHTNESS from light_controller.py is executed in my situation?

I got it working with the following temporary configuration:

kitchen_light_controller:
  module: controllerx
  class: E1743Controller
  controller: sensor.MY_SENSOR_click
  integration: z2m
  light: light.MY_LIGHT_light
  mapping:
    on:
      service: homeassistant.turn_on
      data:
      entity_id: light.MY_LIGHT_light

Would be still nice to solve the issue/root cause :slightly_smiling_face: Not sure could I debug somehow the code when the ā€œonā€-button is pressed from E1743.

Hiā€™ sebul0n

Welcome to ā€˜the land of endless possibilitiesā€™ with your remotes :slight_smile:
As Xavi pointed out, there been a recent change in which calls include the transition attribute.

Iā€™ve spend MANY hours testing various setups, regarding Ikea bulbs on z2m and Ikea/Hue bulbs on Hue bridge integration. Itā€™s NOT an easy task for Xavi to get everything right, as bulbs react diffently on same HA calls - depending on individual fw in bulbs and which integration is used.
If youā€™re REALLY bored :wink:, you can take a look at my latest bug report on this issue at Github: https://github.com/xaviml/controllerx/issues/58

Anyway, the E1743 (square) and the E1810 (round 5 button) remote do not use same HA calls.
The E1810 uses HA ā€˜toggleā€™ call for on/off and the E1743 uses HA on/off calls.
And as latest ControllerX v2.4.3 uses transition with both on/off and toggle calls, it brings issues when turning on after off with a transition.

This is not a fault from ControllerX side, but a bug in the way the Zigbee converter acts. This issue has been solved in latest zigbee2mqtt-edge (dev.) version and will according to Koenkk be pushed with next ordinary z2m update in a week or two.

So, if I, Xavi or anyone else should be able to nail your specific issue, we need to know which zigbee2mqtt version yourā€™re on and which ControllerX version your using :blush:

It CAN work with Ikea bulbs on z2m - even when using transition attributes. For now, you need to ā€˜tweakā€™ a bit, but when next z2m is released and Xavi has adapted ControllerX code a bit, then hopefully all HA calls, with or without transition, will work flawlessly from ControllerX :+1:

I have one Ikea White bulb only dimmable somewhere in the house :slight_smile:
Iā€™ll locate it and test this as well here with my setup. Iā€™ve only tested 2 different types of WS Ikea bulbs and Ikeaā€™s color bulb. All three had exact same behaviour/issues here.

Ciao !

Hiā€™ sebul0n

Had to read your post several times before (I think) I understand your problem :slight_smile:

Controllerx standard lightcontroller app fails to turn on light at previous brightness, but direct HA calls from custom controller works.

  • Even if you have no transition period specified in app, it will send ā€˜defaultā€™ transition period from ControllerX code.
  • Even if you specify transition: 0, ControllerX will still send the attribute.

I assume your on ControllerX v2.4.3 then and has ā€˜stableā€™ z2m v1.12.0 installed ?

If yes, I believe your problem will be solved if you switch to edge version of z2m (developers version)
Alternatively, wait it out till next scheduled stable z2m release.
After that, only one issue left (I know off) with sync function from on position.

Ciao !

I switched to CallServiceController already :-).

Thanks for help anyway
Be safe

1 Like

Hi Xavi,

few days ago i installed a ControllerX and it is awesome! Thanks for your time spent on this project.
Although, i got a question.
I am using a deconz (conbee2) and i got E1810Controller (aka the puck) and i am trying to control two lamps with 1 puck - do you think it is possible? Like brightness up and down will turn on/off lamp1, arrow left and arrow right will turn on/off lamp2 and middle button will be called from customcontroller to turn off everything in house?

Thanks for replu.

Hi @slamkalukas,

Indeed, it is possible. Thanks to AppDaemon, you can create different app instances. In your case you will need 3 ControllerX app instances:

  • One with CustomLightController to map on/off with brightness buttons lamp1
  • One with CustomLightController to map on/off with arrow buttons lamp2
  • Another one with either CustomLightController if what you want is turn off all lights with the center button or CallServiceController to turn off anything else.

I recently answer someone with similar needs that you have.

I hope this makes sense, if you have any problems, I can help you with the configuration :slight_smile:

1 Like

Hi @slamkalukas,

I happened to add in the examples of ControllerX documentation a configuration that matches what you want. It is not yet into the oficial doc, but it will be once I do the next release.

"Controlling different lights with the E1810 controller. Using brightness buttons for one light, arrows for another one and the center to turn off a group of lights.

light1_controller:
  module: controllerx
  class: CustomLightController
  controller: e1810_controller
  integration: deconz
  light: light.light1
  mapping:
    2002: "on"
    3002: "off"
    2001: hold_brightness_up
    2003: release
    3001: hold_brightness_down
    3003: release

light2_controller:
  module: controllerx
  class: CustomLightController
  controller: e1810_controller
  integration: deconz
  light: light.light2
  mapping:
    4002: "on"
    5002: "off"
    4001: hold_brightness_down
    4003: release
    5001: hold_brightness_up
    5003: release

all_lights_controller:
  module: controllerx
  class: CustomLightController
  controller: e1810_controller
  integration: deconz
  light: group.all_lights
  mapping:
    1002: "off"

"

Thanks!

Thats exactly what i have done except all_lights_controller (i got also a wled led strip, so i am using an script for that).

One more question: for ā€œonā€ function - is it possible to send also some data as well? My usecase is for remote which i got next to my bed and i usually use it only in the evening, so it would be nice if i can pass a brightness level as well. What do you think?

Hi @slamkalukas,

There is no way to send specific data to the ā€œonā€ action in the CustomLightController. This Controller just allows to map button events to predefined actions. It has the advantage of using difficult actions such as hold_color_up, but it does not allow to add data to those actions.

However, I created a CallServiceController for this purpose, to customise the events with HA call services. This allows to bind button events to services + attributes. You can check the documentation about it in here and some examples in here.

1 Like

Thank you for a really good app! Very useful and easy to get started with.

Something I would like to accomplish is that when I call a HOLD_BRIGHTNESS_UP and the light is off I would like the light to be turned on and then start to increase brightness(without first clicking the button and then clicking and holding).

I am pretty new to the whole object oriented python thing. But is wondering if you could guide me into the right direction to accomplish this?

Hi @karstensson,

Thank you for the appreciation :slight_smile: and I am glad you find it useful.

What you are looking for is for an attribute from Light Controllers called smooth_power_on. If you add this attribute and mark it to true (itā€™s false by default), then the light will turn on to minimum brightness when hold and clicked. However, you will need to hold again to start dimming up.

Summary, there is no way to start dimming up the light by just holding the button when the light is off, you will need to click or hold twice the brightness up button for that with the smooth_power_on option.

This made me think that I could add a new option to the smooth_power_on that would allow continuing dimming up the light when holding.

1 Like

Actually, this was something which my friend mentioned yesterday! And maybe you can do also smooth_power_off? When i will be holding hold_brightness_down and i reach minimum brightness, after additional 1s it will turn off the lamp.

1 Like

Thanks for the anser, Ill try smooth_power_on :slight_smile:

1 Like

Hi @htvekov

Thank you for your time. I agree with the ā€œthe land of endless possibilitiesā€! :smile:

Totally understand, that itā€™s not an easy task to test and debug everything with all different bulbs and setups. I really do appreciate the work you had done, this have saved lots of hours and nerves of my life. I will consider checking the bug if have excess freetime :grinning:

Sorry for the unclear description of my issue. Yes, you understood correctly the issue.
And you guessed the version numbers correctly, here they are:
zigbee2mqtt version: 1.12.0
ControllerX version: 2.4.3

I would say that no need to check the issue deeper. I got the working solution (in above post) by adding the mapping config (somehow it will work with it). And like you stated, I will wait the newer zigbe2mqtt and ControllerX and try then again.

Cheers!

Hi, I could not get ā€œshakeā€ or ā€œflip90ā€ or ā€œflip180ā€ or ā€œfallā€ work with the Xiaomi Cube, a light bulb and z2m. Tap works with ā€œtoggle lightā€, rotate left/right work with brightness_step_pct.
I also tried scenes or even scripts calling scenes but no success. Is there because of the cube default behaviour?
Using last versions of z2m and ControllerX / appdaemon addon (HA 107.7)

---
cube_bedroom:
  module: controllerx
  class: CallServiceController
  controller: sensor.cube_chambre_martin_action
  integration: z2m
  mapping:
    fall:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_pct: 10
        color_temp: white
    flip90:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_pct: 40
        color_temp: orange
    flip180:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_pct: 100
        color_temp: white
    rotate_left:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_step_pct: -25
    rotate_right:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_step_pct: +25
    shake:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_pct: 80
        color_temp: red
    slide:
      service: light.turn_on
      data:
        entity_id: light.ampoule_martin_plafond_light
        brightness_pct: 80
        color_temp: white
    tap:
      service: light.toggle
      data:
        entity_id: light.ampoule_martin_plafond_light

Any clue?

Hi htvekov and xaviml,

I take back what I said about the mapping ā€“ It did worked for me few days back but somehow it does not work anymore.

I will wait the new versions of z2m and ControllerX.

However, I would like to understand how the mapping works. Can I use it for any service and for any buttons which are supported by controller?

Let say I have the following mapping:

kitchen_light_controller:
  module: controllerx
  class: E1743Controller
  controller: sensor.MY_SENSOR_click
  integration: z2m
  light: light.MY_LIGHT1_light
  mapping:
    on:
      service: light.turn_on
      data:
        entity_id: light.MY_LIGHT2_light

I assume that this would turn on my both lights 1 & 2 OR just my light 2, but in reality it only turned on my light 1.

Hi @dede34fr,

ControllerX just maps the state of the sensor with services, so I would try first if ā€œflip90ā€, ā€œflip180ā€ and ā€œfallā€ appear on z2m logs. If they do, then I would check to call the HA services through Developer Tools. If that also works then, you could check the logs for AppDaemon.

I do not see any mistakes in the configuration you sent.

Regards,
Xavi M.