ControllerX. Bring full functionality to light and media player controllers

Hi @xaviml - I have a bit of a weird issue with a symfonisk controller. When rotating the controller slightly to increase the volume the action will continue after I have stopped physically turning the controller and the volume will turn up to full

It is as if controllerx doesn’t recognise that the symfonisk has stopped being turned and carries on responding to the clockwise command. Is this behaviour that you’ve seen before and related to a parameter, or do you think it is more likely to be an issue with my symfonisk link to HA/Deconz?

Figured it out.:blush:
automations.yaml

- id: '1601143465533'
  alias: Turn Off CL Switch
  description: Disable CL when brightness or color temp is manually adjusted
  trigger:
  - platform: event
    event_type: deconz_event
    event_data:
      id: ikea_5bremote1
  condition:
  - condition: state
    entity_id: switch.circadian_lighting_circadian_lighting
    state: 'on'
  - condition: and
    conditions:
    - condition: template
      value_template: '{{ trigger.event.data.event in [2002, 2001, 2003, 3002, 3001,
        3003, 4002, 5002] }}'
  action:
  - service: switch.turn_off
    data: {}
    entity_id: switch.circadian_lighting_circadian_lighting
  mode: single

Hi @pitoganzado,

I see you have stated in the integration to use z2m, but you have the MQTT broker configured in the appdaemon.yaml. If you want to use z2m with MQTT directly, then your configuration will need to be different. You can read more about it in here.

Even so, the default z2m integration should also work, although I have experienced some delays. This is why I created the MQTT option. Could you let me know what you are trying to achieve and also past the relevant AppDaemon logs related to this problem? Otherwise, I am not able to see what the problem is.

Cheers,
Xavi M.

Hi @Brkie,

which version of zigbee2mqtt are you currently using? There has been a change in the action mapping for this controller from zigbee2mqtt, this is why the mapping does not match. I only maintain the mapping of the latest version on the integration and the firmware. If you want to keep using the legacy mapping, then I recommend you to override the mapping on the yaml configuration and not the Python code, since the Python code will be overridden when you upgrade ControllerX. You will need to add the mapping attribute with the desired mapping, like:

example_app:
  module: controllerx
  class: XXXX
  ...
  mapping:
    rotate_left: hold_volume_down
    rotate_right: hold_volume_up
    rotate_stop: release
    play_pause: play_pause
    skip_forward: next_track
    skip_backward: previous_track

Cheers,
Xavi M.

1 Like

Hi @allen024,

I am glad you could figure it out. If you have any other question, just let me know :slight_smile:

Cheers,
Xavi M.

Hi @colincliff,

As you mentioned, this controller fires a rotation start event and a stop event. The same as other switches when holding and releasing. This is why I created ControllerX mainly because I wanted to gradually change the brightness of a light gradually between the starting event and the stop event.

So ControllerX calls HA to change the brightness (or volume, or other attributes) periodically when the start event is fired (“hold”), and stops calling HA when the stop is fired (“release”). This means that is the release action is missed (i.e. not fired), then the loop won’t stop unless:

  • It reached the top or bottom(if any)
  • Or, it reached a maximum number of loops (max_loops; default is 50)

Knowing this then, there are few things that can be happening:

  • The release event is not captured by ControllerX.
  • The release event is not released from the integration.
  • A hold event is released after the release event.

The first one is just unlikely, specially if this happens to you sometimes and not always. It is more likely to face the 2nd or the 3rd, and to know better about it I would need to see the AppDaemon logs and the deconz events.

I have faced something like this before some times, and it was because I was testing the controller in a hard mode, going up and down quickly. This confused the events that were fired by mixing hold and release altogether. But if used normal, I did not see this behaviour.

As an action point for you, I would recommend you to check the deCONZ events on HA developer tools and see if the release event is fired at all and if so, is it fired after the rotation is stopped?

Let me know about it, I am happy to help you further.

Cheers,
Xavi M.

Chances are I’m a complete idiot, but I can’t find this wonderful piece of software anywhere in Hacs. What Am I doing wrong? I looked in alle 3 categories (even frontend - as if) , tried the + sign and tried adding a custom repository.

Hi @Eelco_Anneveldt,

ControllerX is in the “Automation” tab. To activate this, you will need to enable AppDaemon on HACS integration options. So you can go to Configuration > Integrations > HACS > Options and click Enable AppDaemon apps discovery & tracking. Then you should be able to see the new “Automation” tab.

Cheers,
Xavi M.

Thank you very much! I had Hacs installed before it was available as an integration. It showed up in integrations, but there was no ‘options’ option. Uninstalled - reinstalled. And hey presto! Installing now.

1 Like

Hey @Brkie again,

Just for clarity, you just need to add legacy: false in the devices.yaml from zigbee2mqtt. If you are running zigbee2mqtt as addon, then you will find it on /share/zigbee2mqtt/devices.yaml. Mine looks like:

'0xXXXXXXXXXXXXX':
  friendly_name: livingroom_speaker_controller
  legacy: false

then you will need to restart the addon and that’s it.

Cheers,
Xavi M.

Hey, thanks for info. Thats wierd, I`m on last version 1.14.4… how can I disable legacy and use new mapping?

Thx for great support :metal:t3:

Hey, you read my mind, I just posted at the same time clarifying on how to disable the legacy. Let me know if this helped :slight_smile:

Now we talking. Worked well, now it is brightness instead :slight_smile: should i use volume_steps and delay? Currently using

volume_steps: 20
delay: 250

but not so optimal, whats your setup for the symfonisk controller? Thx alot :slight_smile:

The name of the action is called brightness, but that is not related to what the controller will be used for. It is just the name of the action that z2m gave to that controller. What is that you what to achieve? Control a light or a media player? I use the symfonisk for media player and the configuration is like:

livingroom_speakers:
  module: controllerx
  class: E1744MediaPlayerController
  controller: livingroom_mplayer_controller
  integration:
    name: z2m
    listen_to: mqtt
  media_player: group.livingroom_current_media_player
  update_supported_features: true
  volume_steps: 15
  delay: 150

If you want to use if for a light, it could be something like this if you have the MQTT broker configured in the appdaemon.yaml, which I recommend if you want to use this controller. You can read in here how to set it up.

light:
  module: controllerx
  class: E1744LightController
  controller: livingroom_mplayer_controller
  integration:
    name: z2m
    listen_to: mqtt
  light: light.your_light
  automatic_steps: 15
  delay: 150

Cheers,
Xavi M.

Thx :slight_smile: Got it, it’s not related to what the controller will be used for but it is related to legacy: false, when I edited that file, now I can restore the python file ikea.py and my device does not call the old action mapping :slight_smile: Controlling a media player and want to make the controller “smoth” and not laggy but I will play around with the delay :smiley: thx for the help and take care

1 Like

Hi @spudje,

A new beta version of ControllerX (v.4.0.0b1) has been released with the multiple click functionality. You can read more about the use in here.

Let me know if you give it a try.

Cheers,
Xavi M.

1 Like

Cool, thanks, I will, hopefully somewhere this weekend.

Got my E1743 connected and controlling my mi-lights Gu10 bulbs which are controlled through MQTT. On and off work, but hold - brightness up and down doesn’t. Do I need to configure anything additionally?

Hi @Eelco_Anneveldt,

Could you share the apps.yaml configuration for the mentioned controller and the logs from AppDaemon?

Cheers,
Xavi M.

apps.yaml:

eetkamer_dimmer:
  module: controllerx
  class: E1743Controller
  controller: sensor.dimmer_woonkamer_action
  integration: z2m
  light: light.spotjes_eetkamer

and the log-part:

2020-09-29 22:47:52.807819 INFO eetkamer_dimmer: 🎮 Button event triggered: `off`
2020-09-29 22:47:52.814972 INFO eetkamer_dimmer: 🏃 Running `off` now
2020-09-29 22:47:52.819421 INFO eetkamer_dimmer: 🤖 Service: light.turn_off
2020-09-29 22:47:52.823861 INFO eetkamer_dimmer:   - entity_id: light.spotjes_eetkamer
2020-09-29 22:47:53.203508 INFO eetkamer_dimmer: 🎮 Button event triggered: `off`
2020-09-29 22:47:53.210299 INFO eetkamer_dimmer: 🏃 Running `off` now
2020-09-29 22:47:53.215396 INFO eetkamer_dimmer: 🤖 Service: light.turn_off
2020-09-29 22:47:53.220145 INFO eetkamer_dimmer:   - entity_id: light.spotjes_eetkamer
2020-09-29 22:47:53.534292 INFO eetkamer_dimmer: 🎮 Button event triggered: `off`
2020-09-29 22:47:53.539034 INFO eetkamer_dimmer: 🏃 Running `off` now
2020-09-29 22:47:53.545261 INFO eetkamer_dimmer: 🤖 Service: light.turn_off
2020-09-29 22:47:53.551189 INFO eetkamer_dimmer:   - entity_id: light.spotjes_eetkamer
2020-09-29 22:47:54.012331 INFO eetkamer_dimmer: 🎮 Button event triggered: `on`
2020-09-29 22:47:54.016468 INFO eetkamer_dimmer: 🏃 Running `on` now
2020-09-29 22:47:54.025044 INFO eetkamer_dimmer: 🤖 Service: light.turn_on
2020-09-29 22:47:54.029605 INFO eetkamer_dimmer:   - entity_id: light.spotjes_eetkamer
2020-09-29 22:47:57.885132 INFO eetkamer_dimmer: 🎮 Button event triggered: `brightness_stop`
2020-09-29 22:47:57.889364 INFO eetkamer_dimmer: 🏃 Running `release` now