ControllerX. Bring full functionality to light and media player controllers

You can switch it off in the App-Daemon settings.

After the last update (appdeamon 0.17.3) ControllerX stops working here. i subscribed to github on this issue: [BUG] ControllerX and Appdeamon Β· Issue #1184 Β· xaviml/controllerx Β· GitHub
So maybe this helps other users when the experiencing problems, that they are not alone and there’s work in progress (i’ll hope)

3 Likes

Yep, same here. I restored v 0.16.7 from a backup and now all is well, until the contributor has a chance to fix and update it. Not throwing stones, it’s a great add-on. I think Frenck mentioned that it’s actually due to a change from the Appdaemon coders and not the add-on contributor.

I should know better but I had auto-updates on for all my add-ons (now changed). Much better to give the updates a chance to settle before updating my system.

Thanks, have the same issue.

If it is the same that you mentioned on github, I think you have missed adding exclude_dirs into appdaemon.yaml file.

1 Like

Yes, thanks for that. That appears to the issue. I have made the changes suggested in the GitHub thread.

I added:

appdaemon:
  app_dir: /homeassistant/appdaemon/apps
  exclude_dirs:
    - cx_core

I have the controllerx directory located at /config/appdeamon/apps/controllerx

I take it that is the location of the app_dir entry. That is where HACS is installing the beta update as far as I can see. However, I noticed this in the Appdeamon add-on log:

025-06-09 23:49:40.768905 WARNING AppDaemon: No apps found in /homeassistant/appdaemon/apps. This is probably a mistake

Not sure what the mistake is.

I have to confess that I am confused about the directory structure since we made the change to moving appdaemon to the addon_configs directory. I see that appdaemon.yaml is in the addon_configs directory, and I should make any changes to the configuration there. And I know the a0d7b954_appdaemon/apps/apps.yaml is where I add/edit my devices. Can I now delete the old appdaemon directory under homeassistant? Is that directory just a leftover from the previous install and now unused?

Here’s what I see in my tree:
/
β”œβ”€ addon_configs/
β”‚ β”œβ”€ a0d7b954_appdaemon/
β”‚ β”‚ β”œβ”€ appdaemon.yaml
β”‚ β”‚ β”œβ”€ apps/
β”‚ β”‚ β”‚ β”œβ”€ controllerx/
β”‚ β”‚ β”‚ β”‚ β”œβ”€ controllerx.py
β”‚ β”‚ β”‚ β”‚ β”œβ”€ cx directories & files/
β”‚ β”‚ β”‚ β”œβ”€ hello.py
β”‚ β”‚ β”‚ β”œβ”€ apps.yaml
β”‚ β”‚ β”œβ”€ compiled/
β”‚ β”‚ β”œβ”€ dashboards/
β”‚ β”‚ β”œβ”€ namespaces/
β”‚ β”‚ β”œβ”€ www/
β”œβ”€ homeassistant/
β”‚ β”œβ”€ appdaemon/
β”‚ β”‚ β”œβ”€ apps/
β”‚ β”‚ β”‚ β”œβ”€ controllerx/
β”‚ β”‚ β”‚ β”‚ β”œβ”€ controllerx.py
β”‚ β”‚ β”‚ β”‚ β”œβ”€ cx directories & files

Oh! I think I found my own answer in the thread https://github.com/xaviml/controllerx/discussions/874

My understanding from that thread is that ControllerX has to he in the homeassistant folder in order to be distributed by HACS, but appdaemon is installed directly under config as best practices.

So you do need both directory locations (?)

Here you find the answer to your question:
https://community.home-assistant.io/t/controllerx-bring-full-functionality-to-light-and-media-player-controllers/148855/1499

1 Like

My money is on hello.py:

ModuleNotFoundError: No module named 'hello'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/appdaemon/exceptions.py", line 158, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/appdaemon/app_management.py", line 1126, in safe_import
    raise ade.FailedImport(module_name, self.AD.app_dir) from e
appdaemon.exceptions.FailedImport: Failed to import 'hello'
Import paths:
  /homeassistant/appdaemon/apps
  /homeassistant/appdaemon/apps/controllerx
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/appdaemon/__main__.py", line 157, in run
    loop.run_until_complete(asyncio.gather(*pending))
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/usr/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 148, in loop
    await self.AD.app_management.check_app_updates(mode=UpdateMode.INIT)
  File "/usr/lib/python3.12/site-packages/appdaemon/app_management.py", line 839, in check_app_updates
    await self._import_modules(update_actions)
  File "/usr/lib/python3.12/site-packages/appdaemon/app_management.py", line 1128, in _import_modules
    await safe_import(self)
  File "/usr/lib/python3.12/site-packages/appdaemon/exceptions.py", line 160, in wrapper
    user_exception_block(logger, e, app_dir, header)
  File "/usr/lib/python3.12/site-packages/appdaemon/exceptions.py", line 94, in user_exception_block
    file = Path(frame.filename).relative_to(app_dir.parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 682, in relative_to
    raise ValueError(f"{str(self)!r} is not in the subpath of {str(other)!r}")
ValueError: '<frozen importlib._bootstrap>' is not in the subpath of '/homeassistant/appdaemon'
2025-06-30 23:40:55.035664 INFO AppDaemon: Previous message repeated 1 times
[23:40:55] INFO: Service AppDaemon exited with code 0 (by signal 0)
[23:40:56] INFO: Starting AppDaemon...

I have an interesting issue with one controller Ikea TrΓ₯dfri E2002. I have four of these but for one of them the behavior is not as expected on double pression.

Instead of pressing twice for the second option I have to press three to four times to get the desired result

stue_kntkt_app:
  module: controllerx
  class: E2002LightController
  controller: sensor.sofa_ny_action
  integration: z2m
  light: light.sofagruppe
  multiple_click_delay: 500 # default
  merge_mapping:
    on$2: 
      service: light.turn_on
      data:
         entity_id: light.spisebord
    off$2: 
      service: light.turn_off
      data:
         entity_id: light.spisebord
    arrow_left_click$2: 
      service: switch.toggle
      data:
         entity_id: switch.innr_2
    arrow_right_click$2: 
      service: switch.toggle
      data:
         entity_id: switch.innr_1

Have anyone else had this issue and if so what was the solution.
I have tried replacing the unit - same result, which for me indicates it’s an issue in the code.

A similar setup that works:

iris_standerlampe_app: 
  module: controllerx
  class: E2002LightController
  controller: sensor.iris_kontakt_standerlampe_z2m_action
  integration: z2m
  light: light.iris_standerlampe_z2m
  multiple_click_delay: 500 # default
  merge_mapping:
    on$2: 
      service: light.turn_on
      data:
         entity_id: light.iris_hyggelampe
    off$2: 
      service: light.turn_off
      data:
         entity_id: light.iris_hyggelampe

There is a problem with version 0.17.11 of the AppDaemon add-on; ControlerX does not start. Restore to 0.17.10 and it is OK.