ControllerX. Bring full functionality to light and media player controllers

Apologies for the off topic question, but do you have any tips on pairing the Ikea dial with HUSBZB-1? I tried several combos of 4 taps on the dial and hitting the add device button in the ZHA config but with no luck. The red light on the dial blinks a couple of times after the first few presses, is it supposed to turn solid red?

Sorry, I do not have any of the 2 devices, but the only advice I can give you is to approach the device the HUSBZB-1.

v2.2.0 is now released :partying_face:

:warning: This minor change contains breaking changes. Check README.md or here

:pencil2: Features

  • Support to add ZHA devices
  • Internal refactor (classes split into files)
  • Tests added for robustness
  • sensor and event_id removed from parameters and replaced with controller
  • New parameter: integration. Currently supported integration z2m, deconz and zha.
  • Each controller type has its own list of actions.
  • New documentation page

:video_game: New devices

  • E1743 for ZHA integration
  • E1810 (light and media player) for ZHA integration
  • E1744 (symfonisk) for ZHA integration
  • Aqara double key switch for Z2M
  • ICTC-G-1 for ZHA integration @sreknob

Thank you to everyone who have helped me for this release.

Where is apps folder on hass.io?

It should be in: /config/appdaemon/apps, but you need AppDaemon installed.

Thanks to ControllerX, I have found Appdaemon. I already removed few flows from Node red, ControllerX is just easier. I’m using ikea and Hue remotes, but also have the Xiaomi Aqara cube.

Would it be possible to add support for Aqara cube?

For z2m, these are the actions

"state": "wakeup",
"state": "flip90",
"state": "flip180",
"state": "rotate_right",
"state": "rotate_left",
"state": "slide",
"state": "shake",
"state": "tap",
"state": "fall",

Thanks

1 Like

I am conflicted with the aqara cube, it does not have an specific use like the IKEA controllers. It’s more like a DIY controller. This is why I am also working on a custom controller where you will be able to map states to actions, which will have more sense for for the cube. Thanks for the possible actions. I will keep you updates with it :slight_smile:

Installed AppDaemon, copied controllerx folder inside apps, add a example configuration to configuration.yaml but controllerx doesn’t appear as an app running on appdaemon, only hello world app.

livingroom_controller:
    module: controllerx
    class: E1743Controller
    controller: sensor.0xec1bbdfffe25593f
    integration: z2m
    light: light.0xccccccfffe7dfcc2

AppDaemon has its own yaml configuration for apps isntances. You should have a apps.yaml. There is where you should put that configuration.

1 Like

Thank you :slight_smile:
I was wondering whether a option to bright up from off should be added :thinking:

2 Likes

There is an option that brights to the minimum when the light is off and you press “bright up” button. You just need to add ‘smooth_power_on: true’ to the configuration of your controller.

1 Like

Fantastic add on :slight_smile:

Is there a way to chose a different set of lights to turn off (when selecting the ‘off’ button on a controller) from the ones you turned on (when selecting the ‘on’ button on the controller).

My use case is that when I come home I want to switch on some default lights, but over the course of an evening I might turn on other lights, when I leave I want the ‘off’ button on my controller to switch off all the lights.

I guess I could exclude the switches on state from the controllerx config using actions: and then handle the on state separately with a normal automation (ie. turn on all light in a light group except these ones). But it would be nice to be able do it all in the one controllerx config.

If anyone has a neat solution to this the do please post it, I can’t be the only person wanting to do this.

Hi @jamieu,

I think what you want is out of the scope for controllerx. ControllerX aims to bind 1 or more controllers to a light or group of lights. For the moment all controller have their default behaviour, however, I am working on being able to customise the controller, but it will still act for a light or group of lights.

I think what you are looking for is this, callback constraints. This will allow you to make a controllerx instance work for a period of time. If you have the E1743 with z2m for example, you could do the following:

# This will at all times turn off the lights
general_controller:
  module: controllerx
  class: E1743Controller
  controller: sensor.sensor1
  integration: z2m
  light: group.all_lights
  actions:
    - off

morning_behaviour:
  module: controllerx
  class: E1743Controller
  controller: sensor.sensor1
  integration: z2m
  light: group.some_lights
  constrain_start_time: "08:00:00"
  constrain_end_time: "17:00:00"
  actions:
    - on
  
evening_behaviour:
  module: controllerx
  class: E1743Controller
  controller: sensor.sensor1
  integration: z2m
  light: group.other_subset_of_lights
  constrain_start_time: "17:00:00"
  constrain_end_time: "08:00:00"
  actions:
    - on

With this set up, you can turn on some different lights with the same controller in different times of the day and then being able to turn off the lights at all times with the “off” button. This is just a simple example to show the power of constraint callbacks. You can check the documentation since time it’s not the only constraint callback available. Also in this example I constrained the controller E1743 to just use the on and off actions.

You can PM me if you want and I can help you with the configuration for your needs.

Hi @xaviml,

Thank you for getting back so quickly with a well thought out response and I totally understand the desire to keep ControllerX lean and clean :slight_smile:

It’s less about the time of day, although your solution is an elegant one and I didn’t know about ‘callback constrains’ so I’ve already learnt something new today.

Maybe it’s more a general issue with home automation, lighting, groups and switches. For example my living room has a ceiling lamp which I don’t normally turn it on as it’s a bit overpowering, but sometimes we turn it on to eat dinner (via software) and then leave it on. Later on when we leave the room— and this could be early evening or late at night, hence why the time-of-day conditional doesn’t really solve the issue - it would be nice to be able to turn off all the lamps in that room/light-group regardless of how they were turned on. Otherwise I am stuck with a single light that can only be turned off via an app.

I guess the solution would be some kind of callback/filter that let you conditional limit which lights in a light group were controlled by the on and dim actions, with the whole group always being switched off. Maybe that is actually more a feature/extension to how light groups work than your extension per. se.

I’m going to have another attempt myself to see if I can make a hybrid option work or even use some kind of conditional logic in a light group ie. don’t turn this light on as part of the group, but if it is already on then turn it off or allow it to be dimmed (maybe this is in fact just a variation on your time-of-day solution above), as if it does work without issue then that fine for me. But thanks again for your offer of help via PM.

Hi,

I did try your solution but appdaemon does not load it. Your support is very appreciated.

I’m using following configuration in apps.yaml:

hello_world:
module: hello
class: HelloWorld

test_controller:
module: controllerx
class: E1810Controller
controller: sensor.test_tradfri_remote_control
integration: deconz
light: light.or_ceiling_lamp_5

Trace after restarting AppDaemon4:
Hass.io Add-on: AppDaemon 4
Python Apps and Dashboard using AppDaemon 4.x for Home Assistant

Add-on version: 0.1.2
You are running the latest version of this add-on.
System: HassOS 3.10 (armv7 / raspberrypi4)
Home Assistant version: 0.105.3
Supervisor version: 200

Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing…
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] appdaemon.sh: executing…
[cont-init.d] appdaemon.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[10:50:06] INFO: Starting AppDaemon…
2020-02-12 10:50:08.238299 INFO AppDaemon: AppDaemon Version 4.0.1 starting
2020-02-12 10:50:08.238819 INFO AppDaemon: Python version is 3.8.1
2020-02-12 10:50:08.239523 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-02-12 10:50:08.240055 INFO AppDaemon: Added log: AppDaemon
2020-02-12 10:50:08.240577 INFO AppDaemon: Added log: Error
2020-02-12 10:50:08.241099 INFO AppDaemon: Added log: Access
2020-02-12 10:50:08.241631 INFO AppDaemon: Added log: Diag
2020-02-12 10:50:08.277083 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-02-12 10:50:08.332184 INFO HASS: HASS Plugin Initializing
2020-02-12 10:50:08.332735 INFO HASS: HASS Plugin initialization complete
2020-02-12 10:50:08.333962 INFO AppDaemon: Initializing HTTP
2020-02-12 10:50:08.334905 INFO AppDaemon: Using ‘ws’ for event stream
2020-02-12 10:50:08.358185 INFO AppDaemon: Starting API
2020-02-12 10:50:08.370891 INFO AppDaemon: Starting Admin Interface
2020-02-12 10:50:08.372007 INFO AppDaemon: Starting Dashboards
2020-02-12 10:50:08.395752 INFO HASS: Connected to Home Assistant 0.105.3
2020-02-12 10:50:08.424335 INFO AppDaemon: App ‘hello_world’ added
2020-02-12 10:50:08.425501 INFO AppDaemon: App ‘test_controller’ added
2020-02-12 10:50:08.427214 INFO AppDaemon: Found 2 total apps
2020-02-12 10:50:08.428621 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2020-02-12 10:50:08.431777 INFO AppDaemon: Running on port 5050
2020-02-12 10:50:08.471457 INFO HASS: Evaluating startup conditions
2020-02-12 10:50:08.495565 INFO AppDaemon: Got initial state from namespace default
2020-02-12 10:50:10.442577 INFO AppDaemon: Scheduler running in realtime
2020-02-12 10:50:10.451824 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-02-12 10:50:10.453199 INFO AppDaemon: Adding /config/appdaemon/apps/hello to module import path
2020-02-12 10:50:10.454506 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx to module import path
2020-02-12 10:50:10.455996 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/core to module import path
2020-02-12 10:50:10.485497 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello/hello.py
2020-02-12 10:50:10.500227 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/controller.py - ignoring
2020-02-12 10:50:10.503449 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/const.py - ignoring
2020-02-12 10:50:10.506319 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/philips.py - ignoring
2020-02-12 10:50:10.509361 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/controllerx/controllerx.py
2020-02-12 10:50:10.513287 WARNING Error: ------------------------------------------------------------
2020-02-12 10:50:10.514046 WARNING Error: Unexpected error loading module: /config/appdaemon/apps/controllerx/controllerx.py:
2020-02-12 10:50:10.514805 WARNING Error: ------------------------------------------------------------
2020-02-12 10:50:10.518747 WARNING Error: Traceback (most recent call last):
File “/usr/lib/python3.8/site-packages/appdaemon/app_management.py”, line 788, in check_app_updates
await utils.run_in_executor(self, self.read_app, mod[“name”], mod[“reload”])
File “/usr/lib/python3.8/site-packages/appdaemon/utils.py”, line 276, in run_in_executor
response = future.result()
File “/usr/lib/python3.8/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/lib/python3.8/site-packages/appdaemon/app_management.py”, line 580, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 783, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/config/appdaemon/apps/controllerx/controllerx.py”, line 7, in
from devices.ikea import *
ModuleNotFoundError: No module named ‘devices’
2020-02-12 10:50:10.520363 WARNING Error: ------------------------------------------------------------
2020-02-12 10:50:10.520936 WARNING AppDaemon: Removing associated apps:
2020-02-12 10:50:10.521515 WARNING AppDaemon: test_controller
2020-02-12 10:50:10.525768 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/aqara.py - ignoring
2020-02-12 10:50:10.527849 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/init.py - ignoring
2020-02-12 10:50:10.530091 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/ikea.py - ignoring
2020-02-12 10:50:10.532146 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/light_controller.py - ignoring
2020-02-12 10:50:10.534210 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/zha.py - ignoring
2020-02-12 10:50:10.536210 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/minmax_stepper.py - ignoring
2020-02-12 10:50:10.538276 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/circular_stepper.py - ignoring
2020-02-12 10:50:10.540401 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/z2m.py - ignoring
2020-02-12 10:50:10.542455 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/init.py - ignoring
2020-02-12 10:50:10.544468 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/media_player_controller.py - ignoring
2020-02-12 10:50:10.546497 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/deconz.py - ignoring
2020-02-12 10:50:10.548235 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2020-02-12 10:50:10.730948 INFO hello_world: Hello from AppDaemon
2020-02-12 10:50:10.733409 INFO hello_world: You are now ready to run Apps!
2020-02-12 10:50:10.737407 INFO AppDaemon: App initialization complete

Hi @dems1f45 , you are probably using HACS 0.21.0 or 0.21.1 to download ControllerX. There has been a bug in HACS that got fixed in v0.21.2. Do as follows:

  • Uninstall ControllerX from HACS
  • Upgrade HACS to v0.21.2
  • Restart HA
  • Install ControllerX from HACS again
  • Restart AppDaemon addon.

The configuration looks good, so you should have no problems after doing so. Let me know if this solved your problem.

Hi Xavi,

thanks for the advice. I did also reinstall AppDaemon. I have now HCAS v0.21.5 and the results look better now. According the AppDaemon log seems to be OK but the bulb does not show any reaction. Event is being fired by the remote control. Do you have an idea what could it be now?

See below the last lines from the AppDaemon log:
2020-02-12 20:02:49.362058 INFO HASS: Connected to Home Assistant 0.105.3
2020-02-12 20:02:49.442652 INFO AppDaemon: App ‘hello_world’ added
2020-02-12 20:02:49.444785 INFO AppDaemon: App ‘test_controller’ added
2020-02-12 20:02:49.447801 INFO AppDaemon: Found 2 total apps
2020-02-12 20:02:49.449817 INFO AppDaemon: Starting Apps with 2 workers and 2 pins
2020-02-12 20:02:49.454770 INFO AppDaemon: Running on port 5050
2020-02-12 20:02:49.476230 INFO HASS: Evaluating startup conditions
2020-02-12 20:02:49.513822 INFO AppDaemon: Got initial state from namespace default
2020-02-12 20:02:51.465126 INFO AppDaemon: Scheduler running in realtime
2020-02-12 20:02:51.472332 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-02-12 20:02:51.473703 INFO AppDaemon: Adding /config/appdaemon/apps/hello to module import path
2020-02-12 20:02:51.475096 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx to module import path
2020-02-12 20:02:51.476309 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/core to module import path
2020-02-12 20:02:51.477479 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/core/stepper to module import path
2020-02-12 20:02:51.478858 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/core/integration to module import path
2020-02-12 20:02:51.480337 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/core/type to module import path
2020-02-12 20:02:51.481536 INFO AppDaemon: Adding /config/appdaemon/apps/controllerx/devices to module import path
2020-02-12 20:02:51.524941 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello/hello.py
2020-02-12 20:02:51.571771 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/const.py - ignoring
2020-02-12 20:02:51.575654 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/controllerx/controllerx.py
2020-02-12 20:02:51.829655 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/controller.py - ignoring
2020-02-12 20:02:51.833104 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/init.py - ignoring
2020-02-12 20:02:51.845154 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/stepper/minmax_stepper.py - ignoring
2020-02-12 20:02:51.848057 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/stepper/circular_stepper.py - ignoring
2020-02-12 20:02:51.850791 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/stepper/init.py - ignoring
2020-02-12 20:02:51.853899 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/integration/zha.py - ignoring
2020-02-12 20:02:51.856899 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/integration/z2m.py - ignoring
2020-02-12 20:02:51.859866 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/integration/init.py - ignoring
2020-02-12 20:02:51.862723 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/integration/deconz.py - ignoring
2020-02-12 20:02:51.865917 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/type/light_controller.py - ignoring
2020-02-12 20:02:51.874257 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/type/init.py - ignoring
2020-02-12 20:02:51.876875 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/core/type/media_player_controller.py - ignoring
2020-02-12 20:02:51.879299 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/devices/philips.py - ignoring
2020-02-12 20:02:51.883766 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/devices/aqara.py - ignoring
2020-02-12 20:02:51.886800 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/devices/init.py - ignoring
2020-02-12 20:02:51.890152 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/controllerx/devices/ikea.py - ignoring
2020-02-12 20:02:51.892406 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2020-02-12 20:02:51.895631 INFO AppDaemon: Initializing app test_controller using class E1810Controller from module controllerx
2020-02-12 20:02:52.136090 INFO hello_world: Hello from AppDaemon
2020-02-12 20:02:52.139181 INFO hello_world: You are now ready to run Apps!
2020-02-12 20:02:52.158686 INFO AppDaemon: App initialization complete

I have seen again your configuration and there is something odd in it. If your controller is integrated with deconz, you need to put the id of the controller, not the sensor. You can check how to extract the id for the controller parameter in here.

Thank you. It works without “sensor.” for “controller:”
Actually I was pretty sure that I tried it before but without success.

1 Like

Is this correct?
Using zigbee2mqtt

ikea_led:
  module: controllerx
  class: E1810Controller
  controller: sensor.0x000d6ffffe343d9c_action
  integration: z2m
  light: light.0x14b457fffe2e912e_light