ControllerX. Bring full functionality to light and media player controllers

IKEA E2001/E2002 I had a nice fight putting this one at work… My config finally worked as this:

mando_flexo:
  module: controllerx
  class: W2049LightController
  controller: sensor.****_action # Entity id from entity menu in configuration.
  integration: z2m
  light: light.**** # Entity id from entity menu in configuration.

Hope it helps! and Thanks for all the work!!!

1 Like

This a a fantastic app - helped remove much frustration from HA Automation and Node-Red attempts to get my switches working. Thank you.

I am using Hue Dimmer Switch and IKEA E1524/E1810 in standard config BUT there is one tweak I would like to implement but don’t know how / if its possible - can you help.

For HUE. I would like the " * Hold “I” → Color temp up / Right color wheel" to cycle a handful of Z2M scenes instead of the colour wheel, and likewise with the IKEA E1524/E1810, I’d like the " * Click < → Color temp down / Left color wheel (1 step)" to do the same - cycle Z2M scenes. I am assuming the respective controllers colour wheel in the other direction will continue to work, as is …

Or, if there is a better way - some other idea of how I can control colour wheel and scenes from the same controller…

Is this possible please?

Hi @jastan1971,

If what you mean is to hold the button and loop while holding until button is release, that is not possible. However, you could set it up to cycle every time is held, but a release will need to happen. First, you will need to create an input_select through UI or YAML in HA:

input_select:
  scenes:
    options:
      - scene.my_scene_1
      - scene.my_scene_2
      - scene.my_scene_3

Note that the options are the scenes you want to loop through. Then, assuming you want the default behaviour for the “I” when holding, you could do:

example_app:
  module: controllerx
  class: HueDimmerController
  controller: sensor.my_controller_action
  integration: z2m
  light: light.my_light
  merge_mapping:
    on-hold:
      - service: input_select.select_next
        data:
          entity_id: input_select.scenes
      - scene: "{{ states('input_select.scenes') }}"
      - hold_color_up

Similarly for the E1810 controller, it would be:

example_app:
  module: controllerx
  class: E1810Controller
  controller: sensor.my_controller_action
  integration: z2m
  light: light.my_light
  merge_mapping:
    arrow_left_click:
      - service: input_select.select_next
        data:
          entity_id: input_select.scenes
      - scene: "{{ states('input_select.scenes') }}"
      - click_color_down

Alternatively, you can also leverage multiple clicks to achieve the same. So loop through scenes when a double click is pressed for example. You can read more about multiple clicks in here.

I hope this helps you understand how you can implement this and tune it if needed. Let me know if you have any questions.

Regards,
Xavi M.

2 Likes

Thank you, will give it a go :slight_smile:

1 Like

Quick question:

I currently use the E1812 button, next to my frontdoor, so I with the push of one button can turn off all lights in my home.

The code looks like this:

hall_controller2:
  module: controllerx
  class: E1812SwitchController
  controller: 68:0a:e2:ff:fe:34:c4:65
  integration: zha
  switch: light.all_lights
  mapping:
    "on": "off"

I want to change the behavior so I can also use it to turn on lights in the common rooms, when I return to my home. But I am a bit confused how to make that specific mapping, so it targets light.common_room, with on at one press and light.all_lights with off on a second press.

Hi @bjorn.sivertsen,

I am not 100% what you mean by “second press”. I will assume you want to turn on the light.common_room with 1 click, and turn off light.all_lights with 2 clicks. For this, you will need to leverage the multiple click functionality, which allows you to virtually manage multiple clicks without your controller supporting them.

There are different ways to do this, but I will show you the one similar to the configuration you already have:

hall_controller2:
  module: controllerx
  class: E1812SwitchController
  controller: 68:0a:e2:ff:fe:34:c4:65
  integration: zha
  switch: light.all_lights
  multiple_click_delay: 500 # default value
  mapping:
    "on": "off"
    on$2:
      service: light.turn_on
      entity_id: light.common_room

You might need to tweak the multiple_click_delay value to something higher if the double click does not work properly, or as expected. If you don’t want to use the double click, you can leverage the hold action that is not being used in this configuration, so you could turn on the common room lights by holding the button:

hall_controller2:
  module: controllerx
  class: E1812SwitchController
  controller: 68:0a:e2:ff:fe:34:c4:65
  integration: zha
  switch: light.all_lights
  mapping:
    "on": "off"
    move_with_on_off:
      service: light.turn_on
      entity_id: light.common_room

I hope this helps you understand how it works and how you can make it work to your liking.

Regards,
Xavi M.

2 Likes

The second option is actually really nice, I will use that!

Thanks Xavi!

1 Like

Hi @xaviml, is ControllerX compatible with the latest AppDaemon 0.7.0? There a couple of breaking changes, just wondering if it’s save to upgrade AppDaemon?

It is running here since a few days (?) without any problem!

Hi @Emphyrio,

As @carsten_h said, it is totally fine. The breaking changed is that is currently running in Python 3.9, and I already made sure a month ago that ControllerX works on that Python version.

I have installed it, and I have not noticed problems.

Regards,
Xavi M.

Hi everyone,

I just released ControllerX v4.15.0. This version contains new predefined actions volume_set and tts. These new predefined actions already come with parameters, which was something released in v4.14.0.

In this post, I just want to show how I am currently using them for my alarm system, in case someone is looking for something similar. At my place, I have an E1812 button to turn on/off the alarm before I leave and enter home. At times the button didn’t work, so I didn’t have a way to know if the alarm was on or not. It was then when I decided to just set up HA automation to make the Google device speak and say if the alarm was activated or not when the state changes.

This new release allowed get rid off of those automations and simplify it with the following configuration:

button_alarm:
  module: controllerx
  class: E1812SwitchController
  controller: button_alarm
  integration:
    name: z2m
    listen_to: mqtt
  switch: input_boolean.safe_mode
  

alarm_on:
  module: controllerx
  class: MediaPlayerController
  integration: state
  controller: input_boolean.safe_mode
  media_player: media_player.livingroom_speaker
  mapping:
    "on":
      - action: volume_set
        volume_level: 0.5
      - action: tts
        message: The alarm is armed
    "off":
      - action: volume_set
        volume_level: 0.5
      - action: tts
        message: The alarm is disarmed

The first one switches the input boolean input_boolean.safe_mode, and the second one listens to that input boolean to change the volume to 0.5 and say if the alarm is armed or not.

For the alarm system I am using Home Alarm, which works great if you want an alarm system with a couple of sensor and a media player device like Google Home. This is the AppDaemon configuration for it:

home_alarm:
  module: home_alarm
  class: HomeAlarm
  sensors:
    - binary_sensor.entrance_detector_contact
  safe_mode: input_boolean.safe_mode
  activation_delay: 30
  stop_delay: 120
  alerts:
    - id: media_player
      sound: http://192.168.0.111:8123/local/alarm.mp3
      loop_delay: 31
      volume: 1
      media_players:
        - media_player.office_speaker
        - media_player.livingroom_speaker
    - id: notifier
      notifiers:
        - notify.telegram
      title: "ALARM ALERT!"
      message: "Someone/something triggered your alarm!"

It listens to my binary_sensor.entrance_detector_contact, and if the state of input_boolean.safe_mode is on and the binary sensor has been triggered, then it executes the alerts by making noise with Google device and send a Telegram notification. Documentation is great too: Home Alarm

2 Likes

Looking forward to use controllerX, just got it working. Fantastic work you have done!

Got it fully working with bulbs on my HUE bridge, but not does bulbs I have on my Conbee2 stick.
The HUE dimmers i use is on the Conbee2 in deCONZ are working just fine, just not with the bulbs on Conbee2 network/deCONZ. Weirdly enough it works on bulbs on the HUE bridge…

Btw. where can I find the version no. I have on my system?

Hi @Jano1959,

Glad you like ControllerX and that is useful for you :slight_smile:

What do you mean by the version number of your system? AppDaemon, Home Assistant, ControllerX, device firmware?

Also, the problems you have with your lights, do you also have it when working with Home Assistant? Do they work from there?

Regards,
Xavi M.

1 Like

error 40cm… 100% My own fault, found that I have been using names and aliases all over the place…
So I am in the process of correcting them back to a more aligned naming system.

1 Like

Hi,

I’ve got multiple hue dimmer switches which I have bound to different zigbee groups so they work even if HA is down. Is there a way to combine direct binding and controllerx. I would have loved direct bind + multi-click “on” button for hue dimmer v1, or direct bind + multi-click scene button on hue dimmer v2.

Controllerx looks really nice and sort of exactly how I would like to define my remotes. Just I would really like to have the direct bind backup as well :confused:

Hi @jonasjeeliasson,

I am afraid, ControllerX does not provide yet a full solution to work without HA being up and running.

The closest ControllerX will get to this state is with Zigbee2MQTT integration. It is now able to read from MQTT directly without HA, however, the connection for the lights and media players are binded with HA.

I have planned add an option to the LightController to control lights directly with MQTT, the same way it listens to controllers through MQTT, but it will require big change to the source code.

I hope this answers your question.

Regards,
Xavi M.

Hi there,

one question. Can I use a E1812 (IKEA) to set a light brightness with one click to value x? I’m using deconz.

Thx!

Greetings

Hi @flirtysanchez,

Yes, that is possible. The configuration would look like this:

example_app:
  module: controllerx
  class: E1812LightController
  integration: deconz
  controller: your_controller
  light: light.your_light
  merge_mapping:
    1002:
      action: toggle
      attributes:
        brightness: 150 # change this

This uses the “toggle” predefined action, which is the default, but it sets the brightness to 150 when turning on.

Regards,
Xavi M.

1 Like

Thanks it kinda works. But what is the value 150? Is the light value between 0-255?

I tried 128 for ~50 % but I only get full brightness. I want to controll a group of light.

Hi @flirtysanchez,

Yes, brightness value goes from 1 to 255.

Could you show in here your configuration and the AppDaemon logs when pressing the controller?

Regards,
Xavi M.