ControllerX. Bring full functionality to light and media player controllers

Has something changed with the IKEA Symfonisk Sound controller? It doesn’t work with Controller X suddenly. It used to work, then I stopped using it for a few weeks (due to moving to a new address) and now it won’t register anything through Controller X.

  • I have removed and paired the device through z2m again.
  • I restarted App Daemon
  • I updated Controller X to latest version (and after that restarted App Daemon again)
  • I restarted MQTT Add-on
  • The button does work within HA: actions are published/logged and z2m also logs the mqtt commands.

This is the mqtt publish:
INFO: MQTT publish: topic 'zigbee2mqtt/Woonkamer Salon Symfonisk/action', payload 'play_pause'

This is what I have in apps.yaml

woonkamer_salon_symfonisk:
  module: controllerx
  class: E1744MediaPlayerController
  controller: Woonkamer Salon Symfonisk
  integration:
    name: z2m
    listen_to: mqtt
  media_player: media_player.woonkamer_lms
  update_supported_features: true
  volume_steps: 100
  delay: 200 

I also use multiple E1743’s and they all work fine, with below code:

woonkamer_ikea_switch_muziek:
  module: controllerx
  class: E1743MediaPlayerController
  controller: Woonkamer IKEA Switch
  integration:
    name: z2m
    listen_to: mqtt
  media_player: media_player.woonkamer_lms
  update_supported_features: true
  volume_steps: 50
  delay: 200 

Am I missing something simple?

Hi @ASNNetworks,

Everything seems fine from the configuration. Could please also share AppDaemon logs when initializing and when clicking? Please add log_level: DEBUG at the same level as module and class.

I can confirm that mine is working with everything at its latest version, and with z2m listening to MQTT as you. So we must be missing something, this is why I would like to see the logs.

Regards,
Xavi M.

Hi @xaviml , here is the log where I pressed the button:

2021-01-15 18:41:03.376260 DEBUG woonkamer_salon_symfonisk: Calling listen_event for woonkamer_salon_symfonisk
2021-01-15 18:41:06.823869 DEBUG woonkamer_salon_symfonisk: MQTT data event: {'topic': 'zigbee2mqtt/Woonkamer Salon Symfonisk', 'payload': '{"action":"play_pause","battery":0,"brightness":238,"last_seen":"2021-01-15T18:41:01+01:00","linkquality":51,"rate":195,"update":{"state":"available"},"update_available":true}', 'wildcard': None}
2021-01-15 18:41:06.827654 DEBUG woonkamer_salon_symfonisk: 🎮 Button event triggered, but not registered: `play_pause`
2021-01-15 18:41:06.845475 DEBUG woonkamer_salon_symfonisk: MQTT data event: {'topic': 'zigbee2mqtt/Woonkamer Salon Symfonisk', 'payload': '{"action":"","battery":0,"brightness":238,"last_seen":"2021-01-15T18:41:01+01:00","linkquality":51,"rate":195,"update":{"state":"available"},"update_available":true}', 'wildcard': None}
2021-01-15 18:41:06.850331 DEBUG woonkamer_salon_symfonisk: 🎮 Button event triggered, but not registered: ``

So it somehow does link it, but yest says button event is not registered?

oh! Sorry @ASNNetworks, I think your problem is in the note from the device documentation: https://xaviml.github.io/controllerx/controllers/E1744.html

I totally missed it the first time, but this device only works if legacy: false is set in the devices.yaml from Zigbee2MQTT configuration. This is why it does not register play_pause, this is why that is the legacy action, now for toggle should report toggle.

Hope this helps :slight_smile:

Regards,
Xavi M.

1 Like

Hi xaviml,

I’m having a strange behavior : I passed two days having all installed including appdaemon on a raspberry pi with raspbian / Homeassistant and a Conbee II stick

All looks fine and I have appdaemon / HACS integrated and made few scripts for all of that.

I have an IKEA 5 button knob and a light, I set the button ID via deconz Event listener and also the light.

Now the issue : I can toggle On/off the light, but no more action.

I was supposign the default behavior is also with brightness / hue adjustement with other button, but it does not work :frowning:

here is my script config in apps.yaml :

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: sensor.ikeabutton_constance
  integration: deconz
  light: light.LConstance
  log_level: DEBUG

check_config:
  module: checkconfig
  class: CheckConfig

Where can I find the debug output ? looks like I dont see it in appdaemon log via journalctl

Thanks !

Hi @cyberom,

Strange that the Toggle is working for you. What I can ensure is that is not working with ControllerX, it might be working because controller and light are linked in the same Zigbee group.

What you are missing from the configuration is that controller is the deCONZ device ID. You can find this when listening for the event deconz_event in the Developer Tools page. What you placed is a sensor, and the deCONZ integration is listening for a controller with an ID sensor.ikeabutton_constance, which I doubt that is the name of your controller. You can find more about the controller attribute extraction in here.

Regarding the logs, if I understood correctly, you have installed AppDaemon via docker, right? You can find in here how to set up the logs in the appdaemon.yaml file.

Let me know if anything needs clarifying :slight_smile:

Regards,
Xavi M.

Hi,

Yes I have used the deconz event listening to get the deconz id, see example below :frowning:

Event 22 fired 6:39 PM:
{
    "event_type": "deconz_event",
    "data": {
        "id": "ikeabutton_constance",
        "unique_id": "cc:cc:cc:ff:fe:27:45:e3",
        "event": 2003,
        "device_id": "e1833ca7b012a7d4d5f16d15b6377c36"
    },
    "origin": "LOCAL",
    "time_fired": "2021-01-15T17:39:39.499983+00:00",
    "context": {
        "id": "b86833aeaa29eb0b3473b047fd7d6881",
        "parent_id": null,
        "user_id": null
    }
}

Maybe the toggle is working from a previous link with phoscon ?

I will have a look in the logs

Hi @cyberom

Then your config should look like:

livingroom_controller:
  module: controllerx
  class: E1810Controller
  controller: ikeabutton_constance
  integration: deconz
  light: light.LConstance
  log_level: DEBUG

Regards,
Xavi M.

Great !

I was able to see it under debug and to track other error.

Now I can use the button and control the lamp, but there is a weird situation with the ON/OFF switch : its hard to see how its working :confused:

I can barely light on or off.

Hi @cyberom,

As I mentioned before, your switch is already turning on/off the light.

I would first stop AppDaemon or remove the config for the moment, and you will see that it is turning on/off when toggling. This could be either because:

  • You already have an automation to do so in HA
  • The controller and the light are bound together in the same Zigbee Group. I am not 100% suro how to fix this in deCONZ, but try to investigate through Phoscon or search in the forum for this problem. I bet you are not the first of having it.

Also, what you can do is exclude the toggle button from the ControllerX config so, it ignores it. This why will toggle the light because of the external factor, for this, you can add exlcuded_actions: [1002] in your config at the same level as the log_level.

Regards,
Xavi M.

Hi, I’m trying to use an if statement to control which entity is chosen. (If home is in sleep mode, I only want to turn on a smaller light, rather than the entire room.) It seems to successfully call homeassistant.turn_on, but I don’t think it’s getting the entity id at all.

bedroom_control:
  module: controllerx
  class: E1743Controller
  controller: ------
  integration: zha
  light: light.bedroom
  merge_mapping:
    "on":
      service: homeassistant.turn_on
      data_template:
        entity_id: >-
          {% if is_state('sensor.home_status', 'Sleep') %}
            light.bedroom 
          {% else %} 
            group.bedroom_group
          {% endif %}
    "off":
      service: homeassistant.turn_off
      entity_id: group.bedroom_group
2021-01-18 15:12:06.022933 INFO bedroom_control: 🎮 Button event triggered: `on`
2021-01-18 15:12:06.032212 INFO bedroom_control: 🏃 Running `Service (homeassistant.turn_on)` now
2021-01-18 15:12:06.036159 INFO bedroom_control: 🤖 Service: homeassistant.turn_on
2021-01-18 15:12:06.319022 INFO bedroom_control: 🎮 Button event triggered: `off`
2021-01-18 15:12:06.327614 INFO bedroom_control: 🏃 Running `Service (homeassistant.turn_off)` now
2021-01-18 15:12:06.332094 INFO bedroom_control: 🤖 Service: homeassistant.turn_off
2021-01-18 15:12:06.335262 INFO bedroom_control:   - entity_id: group.bedroom_group

Hi @xaviml,

Could you add the following controllers to ControllerX. I think I got all the button presses figured out below.

RGBgenie ZB-5121

  • Click On → “on”
  • Click Off → “off”
  • Click brighten → “step_with_on_off” args: [0,32,0]
  • Hold brighten→ “move_with_on_off”, “args”: [0, 50]
    Release brighten→ “stop”
  • Click Dim → “step_with_on_off” args: [1,32,0]
  • Hold Dim → “move_with_on_off”, “args”: [1, 50]
    Release Dim→ “stop”
  • Click scene → “recall”, “args”: [0,1]

RGBgenie ZB-5122

  • Click On → “on”
  • Hold On → “move_with_on_off”, “args”: [0, 50]
    Release On→ “stop”
  • Click Off → “off”
  • Hold Off → “move_with_on_off”, “args”: [1, 50]
    Release Off → “stop”
  • Click rgb → “move_to_color” args: [x,y,z] -----x, y, z varies with each button press
  • Hold rgb → “move_hue” args: [x,30] -----x, varies between 1 and 3 each button press
    Release rgb → “move_hue” args: [0,0]
  • Click image → “move_to_color_temp” args: [x,0] -----x, varies with each button press
  • Hold image → “move_color_temp”, “args”: [1, 60, 155, 450 ] - for some reason this button press doesn’t change the lights while holding, though it seems like it should based on the command
  • Release image → “stop_move_step”
  • Click scene → “recall”, “args”: [0,1]

These are both paired with HA right now and I am able to see all the zha events.

Hi @sgobat,

Templating is yet possible to use (see here). There is another way to achieve what you are trying to achieve. It is using callback contraints from AppDaemon. Configuration would look like:

bedroom_control_base:
  module: controllerx
  class: E1743Controller
  controller: ------
  integration: zha
  light: light.bedroom
  excluded_actions: ["on"]
  merge_mapping:
    "off":
      service: homeassistant.turn_off
      entity_id: group.bedroom_group

bedroom_control_sleep:
  module: controllerx
  class: E1743Controller
  controller: ------
  integration: zha
  light: light.bedroom
  mapping:
    "on":
      service: homeassistant.turn_on
      entity_id: light.bedroom
  constrain_input_select: sensor.home_status,Sleep

bedroom_control_not_sleep:
  module: controllerx
  class: E1743Controller
  controller: ------
  integration: zha
  light: light.bedroom
  mapping:
    "on":
      service: homeassistant.turn_on
      entity_id: group.bedroom_group
  constrain_input_select: sensor.home_status,Awake,Work,School

The first config is to define the behaviour of all actions, except for the “on”. Then we define “on” depending on the state of sensor.home_status. Note that the constrain_input_select is part of Callback Constraints from AppDaemon and it does not support the “else” functionality, so you will need to add all the states together that sensor.home_status can take. Also, see that there are no spaces when separating the different states.

Hope it helps :slight_smile:

Regards,
Xavi M.

1 Like

Hi @adamalli7,

Thank you for the information. I created 2 tickets, one for each controller:

I will integrate them for next release, I hope to do it this next weekend.

Regards,
Xavi M.

This should work! I was able to temporarily get it to work just calling a script instead and doing the templating there (but who wants a lot of scripts). Thanks!

1 Like

Hey @adamalli7,

I am currently working on integrating this controller to ControllerX. However, I have some questions that you might be able to answer about the ZB-5122:

  • The move_to_color event with [x,y,z], are the x, y, z between 0 and 255? I am guessing it sends an rgb number.
  • The move_to_color_temp event with [x,0] as args, what are the boundaries for x? Does it go from 153 to 500, or 2000 to 6500 roughly?

Thanks :slight_smile:

So below is the move_to_color [x,y,z] values. It cycles through these ten values when you single “click”
First press [17891, 46989, 0]
second press [14286,23068,0]
Third press [10878, 589, 0]
fourth press [24182, 6553, 0]
fifth press [ 32243, 28246, 0]
sixth press [25427, 24510, 0]
seventh press [21823, 21823,0]
eighth press [48103,17367, 0]
ninth press [37289, 28049,0]
tenth press [29163, 36044, 0]

Here is the move_to_color_temp [x,y] values. It cycles through these five values
first press [155,0] --> cool color temp
second press [185, 0]
third press [230, 0]
fourth press [ 304, 0]
Fifth press [450, 0]–> warmest color temp

v4.5.0 is now released :partying_face:

downloads
This minor change contains does not contain breaking changes.
Note: Remember to restart the AppDaemon addon/server after updating to a new version.

:video_game: New devices

Thanks @adamalli7, I added support for both controllers in the latest release. For the move_to_color, I just used the standard predefined action called click_xycolor_up, which cycles through xy colors. And for the move_to_color_temp ControllerX takes the values from the args and use it to change the color temperature (155, 185, 230, 304, and 450). You can read more about the default mapping for ZB-5122 here.

Hi. I’m already using the IKEA E1810 remote as a light controller with ControllerX thru deCONZ.
If I want to reverse the mapping of the < and > buttons when controlling a white spectrum bulb, is this the correct way to do it?

hall_light:
  module: controllerx
  class: E1810Controller
  controller: ikea5b_hall
  integration: deconz
  light: light.hall
  merge_mapping:
    4002: click_colortemp_up
    5002: click_colortemp_down
    4001: hold_colortemp_up
    5001: hold_colortemp_down