ControllerX. Bring full functionality to light and media player controllers

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.

Hi @sebul0n,

I see a mistake that I did not see last time, sorry. The thing is that you are using E1743Controller which is a device controller, so the mapping attribute will be ignore. If you want to use the mapping attribute, you wither need to use CustomLightController, CustomMediaPlayerController or CallServiceController. These three are Custom Controllers and they do take a mapping attribute where the key is the button event (depending on the integration) from the controller that you have(this one in your case) and the value will depend on the class that you use. In case of CallServiceController you can put a service as you did in the configuration you sent.

If you want to learn more about Custom Controllers I recommend you to take a look to this section of the documentation: https://xaviml.github.io/controllerx/others/custom-controllers

I also recommend you to take a look to the Real Examples section from the documentation. You will be able to see in here some real use cases on how you can use ControllerX.

If you still do not see how to configure your controller to your liking, let me know of your use case and I will help you out.

Regards,
Xavi M.

Hi Everyone,

i am a pretty new user to HA (so sorry for dumb questions), and i am trying to get my zigbee2mqtt/TRADFRI setup to work.
so what i’ve done so far is installed: Appdaemon 4, HACS, controllerX, Zigbee2mqtt and mosquitto.
i can see the actions of my TRADFRI in the zigbee2mqtt logs, and i also see the TRADFRI in the “devices” section.

i’ve tried adding config like this to the /config/appdaemon/apps/apps.yaml:
i’ve used this page to find the contoller:

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: sensor.0x14b457fffed434d5_action
  integration: z2m
  light: light.livingroom
  actions:
    - toggle
    - brightness_up_click
    - brightness_down_click

but i am stuck now, how can i get a working item on my lovelace dashboard for this controller?
i googled and searched this topic, but i think i am missing some knowledge/information.
can someone help me, or point me too some good documentation that i can use to make it work?

Regards
Ferry

Hi @blankf welcome to the community!

Firstly, does the controller do what you expect it to do?

If I understand correctly, it sounds like you want to replicate the controller’s actions in lovelace?
Typically, in HA, we don’t add controllers to the UI, but instead use the services directly to achieve the same thing as the controller does. ControllerX is just a super convenient method for integrating controllers.
You can place a card with the entity that will allow you to toggle and adjust brightness. Using different cards, you can make the UI look like anything you want.
For example, something like this using vertical and horizontal stacks with entities:


OR something similar using a stack of custom:slider-entity-row
image

Let me know if I’ve misunderstood…