controllerx: [BUG] ControllerX and Appdeamon

Bug report

After migrating to the new version of Appdeamon, I get the error attached, appdeamon crashes, see log attached, see https://github.com/AppDaemon/appdaemon/issues/2286

Description

Add a description of the bug. Detail the expected behaviour in contrast with the behaviour you’re observing.

Additional information

ControllerX installed as HACS component

CircularDependency: Visited […] already, but cx_core.type.switch_controller depends on {‘cx_const’, ‘cx_core.type_controller’, ‘cx_core.controller’}

This seems to be a structural import cycle in cx_core, which is now explicitly detected by AppDaemon’s new dependency graph logic.

Steps to reproduce:

Use AppDaemon 4.5.2

Install ControllerX 4.29 via HACS

Configure basic ControllerX apps in apps.yaml

Workarounds tried:

Added disable: true dummy apps for all cx_devices.* modules

AppDaemon still crashes due to internal cx_core cycle

Downgrade to AppDaemon 4.4.4 works fine

Expected: ControllerX should be structured in a way that does not lead to circular import chains detectable by AppDaemon >= 4.5.

Request: Can you consider refactoring or deferring imports in the relevant modules (like switch_controller, controller, type_controller) to break the dependency loop?

AppDaemon app configuration

apps.yaml:

cx_devices___init___dummy:
  module: cx_devices.__init__
  class: Dummy
  disable: true

cx_devices_adeo_dummy:
  module: cx_devices.adeo
  class: Dummy
  disable: true

cx_devices_aqara_dummy:
  module: cx_devices.aqara
  class: Dummy
  disable: true

cx_devices_aurora_dummy:
  module: cx_devices.aurora
  class: Dummy
  disable: true

cx_devices_homematic_dummy:
  module: cx_devices.homematic
  class: Dummy
  disable: true

cx_devices_ikea_dummy:
  module: cx_devices.ikea
  class: Dummy
  disable: true

cx_devices_legrand_dummy:
  module: cx_devices.legrand
  class: Dummy
  disable: true

cx_devices_linkind_dummy:
  module: cx_devices.linkind
  class: Dummy
  disable: true

cx_devices_livarno_dummy:
  module: cx_devices.livarno
  class: Dummy
  disable: true

cx_devices_lutron_dummy:
  module: cx_devices.lutron
  class: Dummy
  disable: true

cx_devices_muller_licht_dummy:
  module: cx_devices.muller_licht
  class: Dummy
  disable: true

cx_devices_osram_dummy:
  module: cx_devices.osram
  class: Dummy
  disable: true

cx_devices_philips_dummy:
  module: cx_devices.philips
  class: Dummy
  disable: true

cx_devices_prolight_dummy:
  module: cx_devices.prolight
  class: Dummy
  disable: true

cx_devices_rgb_genie_dummy:
  module: cx_devices.rgb_genie
  class: Dummy
  disable: true

cx_devices_robb_dummy:
  module: cx_devices.robb
  class: Dummy
  disable: true

cx_devices_sengled_dummy:
  module: cx_devices.sengled
  class: Dummy
  disable: true

cx_devices_shelly_dummy:
  module: cx_devices.shelly
  class: Dummy
  disable: true

cx_devices_smartkontakten_dummy:
  module: cx_devices.smartkontakten
  class: Dummy
  disable: true

cx_devices_smartthings_dummy:
  module: cx_devices.smartthings
  class: Dummy
  disable: true

cx_devices_sonoff_dummy:
  module: cx_devices.sonoff
  class: Dummy
  disable: true

cx_devices_tasmota_dummy:
  module: cx_devices.tasmota
  class: Dummy
  disable: true

cx_devices_terncy_dummy:
  module: cx_devices.terncy
  class: Dummy
  disable: true

cx_devices_trust_dummy:
  module: cx_devices.trust
  class: Dummy
  disable: true

cx_devices_tuya_dummy:
  module: cx_devices.tuya
  class: Dummy
  disable: true

nachttisch_links:
  module: controllerx
  class: E1743Controller
  integration: mqtt
  controller: zigbee2mqtt/DIM-Nachttisch-links/action
  light: light.hue_color_lamp_1

nachttisch_rechts:
  module: controllerx
  class: E1743Controller
  integration: mqtt
  controller: zigbee2mqtt/DIM-Nachttisch-rechts/action
  light: light.schlafzimmer_nachttisch_rechts

wohnzimmer_dim:
  module: controllerx
  class: E1743Controller
  integration: mqtt
  controller: zigbee2mqtt/DIM-Wohnzimmer/action
  light: light.wohnzimmer_decke
  
flur_dim:
  module: controllerx
  class: E1743Controller
  integration: mqtt
  controller: zigbee2mqtt/DIM-Flur3/action
  light: light.hue_flur_gruppe
  merge_mapping:
    "on":
      - scene: scene.flur_tagszene

kueche_dim:
  module: controllerx
  class: E1743Controller
  integration: mqtt
  controller: zigbee2mqtt/DIM-Kueche/action
  light: light.unterschranke_kuche
  
flur_dim2:
  module: controllerx
  class: E2002LightController
  integration: mqtt
  controller: zigbee2mqtt/DIM-Flur2/action
  light: light.hue_flur_gruppe
  merge_mapping:
    "on":
      - scene: scene.flur_tagszene

esszimmer_dim:
  module: controllerx
  class: E1743CoverController
  integration: mqtt
  controller: zigbee2mqtt/DIM-Esszimmer/action
  cover: cover.esszimmer
  
wohnzimmer_dim_vorhang:
  module: controllerx
  class: E1743CoverController
  integration: mqtt
  controller: zigbee2mqtt/DIM-Wohnzimmer-Vorhang/action
  cover: cover.wohnzimmer_fenster

Logs

2025-05-28 08:21:31.989236 INFO AppDaemon: ------------------------------------------------------------

2025-05-28 08:21:31.989577 INFO AppDaemon: AppDaemon Version 4.5.2 starting

2025-05-28 08:21:31.989670 INFO AppDaemon: Additional version info: dev

2025-05-28 08:21:31.989732 INFO AppDaemon: ------------------------------------------------------------

2025-05-28 08:21:31.989815 INFO AppDaemon: Python version is 3.12.10

2025-05-28 08:21:31.990037 INFO AppDaemon: Configuration read from: /conf/appdaemon.yaml

2025-05-28 08:21:31.990204 INFO AppDaemon: Added log: AppDaemon

2025-05-28 08:21:31.990283 INFO AppDaemon: Added log: Error

2025-05-28 08:21:31.990367 INFO AppDaemon: Added log: Access

2025-05-28 08:21:31.990446 INFO AppDaemon: Added log: Diag

2025-05-28 08:21:31.991086 INFO AppDaemon: Using /conf/apps as app_dir

2025-05-28 08:21:31.991996 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module appdaemon.plugins.hass.hassplugin

2025-05-28 08:21:31.992225 INFO HASS: HASS Plugin initialization complete

2025-05-28 08:21:31.992421 INFO AppDaemon: Loading Plugin MQTT using class MqttPlugin from module appdaemon.plugins.mqtt.mqttplugin

2025-05-28 08:21:31.992579 INFO MQTT: MQTT Plugin Initializing

2025-05-28 08:21:31.992682 INFO MQTT: Using 'appdaemon_mqtt_client/status' as birth topic with payload 'online'

2025-05-28 08:21:31.992772 INFO MQTT: Using 'appdaemon_mqtt_client/status' as will topic with payload 'offline'

2025-05-28 08:21:31.996831 INFO AppDaemon: Initializing HTTP

2025-05-28 08:21:31.996995 INFO AppDaemon: Using 'ws' for event stream

2025-05-28 08:21:31.997249 INFO AppDaemon: HTTP Listening on port 5050

2025-05-28 08:21:31.999338 INFO AppDaemon: Starting API

2025-05-28 08:21:32.000499 INFO AppDaemon: Starting Admin Interface

2025-05-28 08:21:32.000654 INFO AppDaemon: Starting Dashboards

2025-05-28 08:21:32.009564 INFO HASS: Connected to Home Assistant 2025.5.3 with aiohttp websocket

2025-05-28 08:21:32.010281 INFO HASS: Authenticated to Home Assistant 2025.5.3

2025-05-28 08:21:32.011257 INFO HASS: Waiting for Home Assistant to start

2025-05-28 08:21:32.011583 INFO MQTT: Connected to MQTT broker at URL 192.168.1.191:1883 with paho-mqtt

2025-05-28 08:21:32.017891 INFO MQTT: MQTT Plugin initialization complete

2025-05-28 08:21:32.050830 INFO AppDaemon: Starting Apps with 8 workers and 8 pins

2025-05-28 08:21:32.054465 INFO AppDaemon: Running on port 5050

2025-05-28 08:21:32.054626 INFO AppDaemon: Waiting for plugins to be ready

2025-05-28 08:21:32.056067 INFO AppDaemon: All plugins ready

2025-05-28 08:21:32.057453 INFO AppDaemon: Scheduler running in realtime

2025-05-28 08:21:32.064480 WARNING HASS: Disconnected from Home Assistant, retrying in 5 seconds

2025-05-28 08:21:32.269105 INFO MQTT: Unable to decode MQTT message from topic home/OMG_lilygo_rtl_433_ESP_FSK/RTL_433toMQTT/Fineoffset-WH51/0dbd49, ignoring message

2025-05-28 08:21:32.269341 ERROR MQTT: Unable to decode MQTT message from topic home/OMG_lilygo_rtl_433_ESP_FSK/RTL_433toMQTT/Fineoffset-WH51/0dbd49, with error: 'utf-8' codec can't decode byte 0xd6 in position 247: invalid continuation byte

2025-05-28 08:21:32.511604 INFO AppDaemon: New app config: nachttisch_links

2025-05-28 08:21:32.511772 INFO AppDaemon: New app config: nachttisch_rechts

2025-05-28 08:21:32.511897 INFO AppDaemon: New app config: wohnzimmer_dim

2025-05-28 08:21:32.511989 INFO AppDaemon: New app config: flur_dim

2025-05-28 08:21:32.512088 INFO AppDaemon: New app config: kueche_dim

2025-05-28 08:21:32.512187 INFO AppDaemon: New app config: flur_dim2

2025-05-28 08:21:32.512271 INFO AppDaemon: New app config: esszimmer_dim

2025-05-28 08:21:32.512392 INFO AppDaemon: New app config: wohnzimmer_dim_vorhang

2025-05-28 08:21:32.668853 WARNING AppDaemon: ------------------------------------------------------------

2025-05-28 08:21:32.669062 WARNING AppDaemon: Unexpected error during run()

2025-05-28 08:21:32.669183 WARNING AppDaemon: ------------------------------------------------------------

Traceback (most recent call last):

  File "/usr/local/lib/python3.12/site-packages/appdaemon/__main__.py", line 157, in run

    loop.run_until_complete(asyncio.gather(*pending))

  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete

    return future.result()

           ^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 144, in loop

    await self.AD.app_management.check_app_updates(mode=UpdateMode.INIT)

  File "/usr/local/lib/python3.12/site-packages/appdaemon/app_management.py", line 809, in check_app_updates

    await self._import_modules(update_actions)

  File "/usr/local/lib/python3.12/site-packages/appdaemon/app_management.py", line 1055, in _import_modules

    load_order = self.dependency_manager.python_sort(modules)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/appdaemon/dependency_manager.py", line 210, in python_sort

    order = [n for n in topo_sort(self.python_deps.dep_graph) if n in modules]

                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/usr/local/lib/python3.12/site-packages/appdaemon/dependency.py", line 261, in topo_sort

    raise CircularDependency(f"Visited {visited} already, but {node} depends on {deps}")

appdaemon.dependency.CircularDependency: Visited ['cx_devices.sengled', 'cx_core', 'cx_core.type.z2m_light_controller', 'cx_const', 'collections.abc', 'typing', 'cx_core.controller', 'ast', 'appdaemon.adapi', 'time', 'cx_version', 'appdaemon.plugins.hass.hassapi', 'cx_core.action_type.base', 'abc', 'cx_core.integration', 'cx_helper', 'pkgutil', 'importlib', 'os', 'functools', 'appdaemon.plugins.mqtt.mqttapi', 'asyncio', 'cx_core.action_type', 'cx_core.action_type.delay_action_type', 'cx_core.action_type.call_service_action_type', 'cx_core.action_type.scene_action_type', 'cx_core.action_type.predefined_action_type', 'inspect', 're', 'collections', 'appdaemon.utils', 'cx_core.integration.z2m', 'json', 'cx_core.type_controller', 'cx_core.feature_support', 'cx_core.stepper', 'dataclasses', 'cx_core.type.cover_controller', 'cx_core.feature_support.cover', 'cx_core.type.media_player_controller', 'cx_core.stepper.index_loop_stepper', 'cx_core.stepper.stop_stepper', 'cx_core.feature_support.media_player', 'cx_core.release_hold_controller', 'cx_core.type.switch_controller', 'cx_core.type.light_controller', 'cx_core.stepper.bounce_stepper', 'cx_core.feature_support.light', 'cx_core.stepper.loop_stepper', 'cx_core.integration.deconz', 'cx_core.integration.zha', 'cx_core.color_helper'] already, but cx_devices.sengled depends on {'cx_core', 'cx_const'}

2025-05-28 08:21:32.671808 INFO AppDaemon: Previous message repeated 1 times

2025-05-28 08:21:32.671945 INFO AppDaemon: AppDaemon Exited

Additional Context

Add any other context or screenshots about the bug here.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 17
  • Comments: 74 (30 by maintainers)

Commits related to this issue

Most upvoted comments

Thank you @meetyourlaser ,

I will release new code for the sync_decorator, and mention in documentation about exclude_dirs. This would do as a workaround, and I will try to find a solution that would not imply adding the exclude_dirs.

Thanks, Xavi M.

Hi @i4mr000t ,

Could you go to this line within your instance:

https://github.com/xaviml/controllerx/blob/main/apps/controllerx/cx_core/controller.py#L350

And change it for:

@utils.sync_decorator

Somehow, I cannot install the new addon version for some reason, this is why I am asking you to try it out.

EDIT: This is the reason why I cannot install new AppDaemon addon: https://www.home-assistant.io/blog/2025/05/22/deprecating-core-and-supervised-installation-methods-and-32-bit-systems/

I have to install HA again.

P.S.: keep the exclude_dirs as well.

Thanks,

Hi @fir3drag0n ,

Thank you for opening this ticket. I am currently exploring what the issue is and if there is any workaround we can apply.

Regards,

@steveof2620 No - this is a different issue.

topo_sort raise CircularDependency exception

Solution:

Ensure you have modified appdeamon.yaml that’s used by AppDeamon - this is not under homeassistant - this is in the AppDaemon configuration mount; you’ll need the File Editor Add On. Ensure you have:

enforce_basepath: false

This allows you to navigate to / and you’ll find it typically in: /addon_configs/a0d7b954_appdaemon/appdaemon.yaml

You need these:

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

The app_dir entry is to ensure it picks up ControllerX that’s installed by HACS, and the exclude_dirs fixes the CircularDependency exception.

You will need to restart the AppDaemon add-on to pick up these changes.

argument of type 'NoneType' is not iterable or similar exceptions

Solution

Keep it simple and install ControllerX beta (version: v5.0.0b0) via HACS and follow the above. This looks like it’s caused by a bad patch of the PR associated with this issue, or might be something else - but so far only one report of this. If there are more, then raise it as a separate issue, complete with your apps.yaml and appdaemon.yaml files.

Just the exception isn’t much help, and apart from going on a schnitzel hunt guessing what is in these files, including them gives folks a fighting chance to investigate. 😄

Summary

This is a beta release and requires additional work as ControllerX is tripping up the AppDaemon dependency manager with a suspected false positive.

Work is being done to document this, but the exclude_dirs is a recommended fix by AppDaemon developers, as the directory for ControllerX doesn’t have to be watched for hot reloading.

This is because the ControllerX is unique, as it has modules in subdirectories, but only a single apps.yaml.

Edit: If things are still funky, then restart the AppDaemon add-on, or reboot. Just restarting home assistant isn’t sufficient.

Hi @i4mr000t ,

Could you go to this line within your instance:

https://github.com/xaviml/controllerx/blob/main/apps/controllerx/cx_core/controller.py#L350

And change it for:

@utils.sync_decorator P.S.: keep the exclude_dirs as well.

Confirmed working.

Hi @acockburn ,

Thank you for your hard work and dedication to AppDaemon, really appreciated!

There are 3 main issues we had to fix:

* ControllerX used a decorator used in get_state for making async functions non-async and the name changed, so we change the name of the function decorator (sync_decorator)

* ControllerX overwrites the get_state function and the signature changes, so we changed it to be the same.

* The dependency manager seems to be more strict now. For now, the solution is to exclude the "cx_core" directory to avoid cyclical dependencies. ControllerX relies in AppDaemon in a different way AppDaemon is thought of since it contains dependencies between internal modules, and AppDaemon sees those directories as modules to be consumed for apps. I would like to put more time into this to see if I can avoid putting the exclude_dir attribute in the appdaemon.yaml.

@charrus , correct me or add any point if necessary.

Thanks, Xavi M.

I’d just like to echo @xaviml sentiment, and thank you for all the hard work, but also point 2 about the get_state method in AppDaemon.

Looking at the commit history, it looks like namespace has moved from **kwargs into its own positional and named argument in between default and copy.

What was happening here are positional arguments were used, and due to its position copy (a bool) was going into namespace, which resulted in the entity not being found. Maybe some validation on namespace and an explicit log entry could’ve helped if the namespace didn’t exist.

If namespace was placed after copy then this would have been backwardly compatible where positional arguments were used.

Having said that, it’s more robust to use named arguments, so there’s no ambiguity and this is the fix I used.

Edit: Added the sentiment about being grateful for all of @acockburn and team for the work on this new AppDeamon release.

Thanks, Charlie

Hi everyone! 😃

I just released a beta version of ControllerX v5.0.0b0. This version includes @charrus changes (Thank you for your support!), so this new version only works with the new AppDaemon addon.

In addition, you should all include the “exclude_dirs” like specified here: https://github.com/xaviml/controllerx/issues/1184#issuecomment-2917412699

Everything is working on my setup, but I would like to hear from you all and see if there are any other issues. I will also explore further the possibility of avoiding the “exclude_dirs” workaround.

Regards, Xavi M.

I’m sorry for asking so bluntly without reading everything. Is it safe to update ControllerX and AppDaemon now? I really don’t want to edit appdaemon.yaml and controller.py.

What is the current status? I’m luckily still running AppDaemon 0.16.7 and looks like ControllerX 4.29.0.

Thx a lot for all the hard work.

No biggy - I got what I wanted out of it, and that was troubleshooting new large code bases and finding solutions with the aim to be confident and better at coding tests. I’ll defer to @xaviml since this is his baby.

Corner cases seem to always find me - last one was in ESP Home and Wi-Fi not working on an esp32s3. Shameful plug: discord link if anyone’s curious (it’s on the ESP Home discord server).

Edit: Just to be clear - I have used AppDaemon/ControllerX/ESP Home/HA for a very long time - benefiting from all the hours better and more dedicated contributors have made over the years. It’s about time I contributed back. The quality of code and documentation is fantastic and a pleasure to learn from and work with.

To mitigate the issue of having to move the files manually (and just keep everything nice and tidy in my config folder), I have included the following line in my appdaemon.yaml file: app_dir: /homeassistant/appdaemon/apps

This should still work to point AppDaemon to the initial ControllerX folder, right?

After moving the controllerx folder to the /addonn_configs folder instead of under /config, it works. It is apparently still downloading to the config folder, and not the new place for addons. I’ve tested with toggle, brightness up, down, conditional etc… so far no problems.

Confirming I had to do the same, move “controllerx” folder from \homeassistant\config\appdaemon\apps to \homeassistant\addon_configs\a0d7b954_appdaemon\apps

Steps followed:

-Updated AppDaemon to 0.17.4 -Redownloaded ControllerX in HACS, selected 5.0.0b0 -Added " exclude_dirs: - cx_core" to \homeassistant\addon_configs\a0d7b954_appdaemon\appdaemon.yaml -Restarted AppDaemon -Tested a controller, no response from attached lights -copied “controllerx” folder as above (have renamed existing “controllerx” folder already in this location just in case), controllers (at least one I’ve tested) seem to be working, switching on and off, and dimming and brightening.

Thank you!

Sorry I’m just a user, not a developer by any stretch, but I can confirm what I think has happened for others has also happened for me:

-updated AppDaemon to 0.17.2 and all ControllerX switches stopped working -made the changes above around the exclude_dirs and decorator lines, confirmed switches were now able to switch on and off, but not dim up or down, or change colour temperature of lights -Restored AppDaemon to 0.16.6 via HA Restore (the AppDaemon plug-in only) and all functionality is now working again.

Subscribing to monitor progress, thank you for all your hard work 😃

This mitigates the issue for me (using z2m and mqtt) so turning on/off and dimming work:

In controller.py, change:

    @utils.sync_wrapper  # type: ignore[misc]
    async def get_state(
        self,
        entity_id: Optional[str] = None,
        attribute: Optional[str] = None,
        default: Any = None,
        copy: bool = True,
        **kwargs: Any,
    ) -> Optional[Any]:
        rendered_entity_id = await self.render_value(entity_id)
        return await super().get_state(
            rendered_entity_id, attribute, default, copy, **kwargs
        )

to:

    @utils.sync_decorator
    async def get_state(
        self,
        entity_id: str | None = None,
        attribute: str | None = None,
        default: Any | None = None,
        copy: bool = True,
    ) -> Optional[Any]:
        rendered_entity_id = await self.render_value(entity_id)
        return await super().get_state(rendered_entity_id, attribute, default, copy)

And also add to appdaemon.yaml under appdaemon:

  exclude_dirs:
    - cx_core

Or - tl;dr version:

Change the decorator to @utils.sync_decorator and remove **kwargs from get_state in controllerx/apps/controllerx/cx_core/controller.py.

Exclude cx_core in appdaemon.yaml as before.

Edit: I’ve got a draft PR: https://github.com/xaviml/controllerx/pull/1188 if that helps anyone.

Second Edit: Changed “I think this mitigates” to “This mitigates” after annoying my partner and checking all light switches and dimmers. The fix will be to fix the circular dependency (new checks were introduced in https://github.com/AppDaemon/appdaemon/commit/bb98fd1fda765ad8f8e676286703c3e248d79c9e) as stated in https://github.com/xaviml/controllerx/issues/1184#issuecomment-2918568424. Had a look myself, but it looks like a more complex change.

Third Edit: Something is not quite right - it maybe my fiddling after this patch, or more work needs to be done, but it seems to have rendered HA a little funky (AddOns setting page not loading), Unrelated - this is a separate issue.

and re-read all the installation docs, and can’t see that I’m doing something wrong

Here you find a link the correct installation docs for ControllerX (this is working here with the newest versions and also with the older versions): https://community.home-assistant.io/t/controllerx-bring-full-functionality-to-light-and-media-player-controllers/148855/1499

Thank you again, @charrus. I seem to be hitting a wall here. I've installed and confirmed that I'm 
running AppDaemon 0.17.6 and ControllerX v5.0.0b0, with the required edits, several times now. Each 
time, even after repeated HA reboots and restarting Appdaemeon, I cannot get my ControllerX devices to 
respond. Each time, when I go back to AppDaemon 0.16.7 and ControllerX v4.29.0, with editing 
/addon_configs/a0d7b954_appdaemon/appdaemon.yaml to comment out the "app_dir: 
/homeassistant/appdaemon/apps" line, my devices are again immediately responsive, even without a HA 
reboot - just a simple Appdaemon restart. I've read your kind guidance and re-read all the installation docs, 
and can't see that I'm doing something wrong. I'm reverting again now because it's getting dark and a lot of our 
lights are controlled by ControllerX switches - got to watch the Spousal Approval Factor index!

/addon_configs/a0d7b954_appdaemon/appdaemon.yaml
---
secrets: /homeassistant/secrets.yaml
appdaemon:
  latitude: xx.xxxxx
  longitude: -xx.xxxxx
  elevation: 70
  time_zone: America/New_York
  exclude_dirs:
    - cx_core
  app_dir: /homeassistant/appdaemon/apps
  plugins:
    HASS:
      type: hass
      token: !env_var SUPERVISOR_TOKEN
http:
  url: http://0.0.0.0:5050
admin:
api:
hadashboard:
---

I put apps.yaml in /homeassistant/appdaemon as you suggested, but I also see the installation directions 
say to put apps.yaml in /homeassistant/appdaemon/apps. So I put the same apps.yaml in both those 
places for now (file content truncated for readability):
---
patio_light_dimmer:
  module: controllerx
  class: HueDimmerController
  controller: 00:17:88:01:08:07:c5:19
  # Patio Light Dimmer Switch, SWxx
  integration: zha
  light: light.05_hue_econic

helen_desk_light_dimmer:
  module: controllerx
  class: E1743Controller
  controller: bc:33:ac:ff:fe:13:c9:c9
  # Helen Desk Overhead Light Switch 18, SW18
  integration: zha
  light: light.14_hue_white
---

• Am I correct in thinking /addon_configs/a0d7b954_appdaemon/apps/controllerx/ is not used in any way in the new configuration?
• Am I correct in thinking /addon_configs/a0d7b954_appdaemon/apps/apps.yaml is not used in any way in the new configuration?

I agree with figuring out how to get the version updated to current - I hope I can do so!

P.S. Sorry about the formatting - I'm stumbling around in Markdown.

Thank you @charrus - I see that now, and updated to that version.

Yep - that’s what’s happened. Previously everything was under the addon directory - unavailable to VS Code etc. Since ControllerX moved to HACS that directory is now in the appdaemon directory in the HA configuration directory - so on the same level as HA’s configuration.yaml and other directories:


├─ 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

You can see above that you have two ControllerX’s - the one under homeassistant/appdaemon/controllerx is the new one.

Just move your apps.yaml over to there from addon_configs/a0d7b954_appdaemon/apps/apps.yaml to: homeassistant/appdaemon/apps.yaml.

Leave ControllerX alone - you have the old version under addon_configs, which is why commented out “app_dir: /homeassistant/appdaemon/apps” was needed for the rollback.

By the way @mietzen, turning off Auto Update on each Add-on is working for me, add-ons only update manually.

Thanks all, for your knowledge sharing!

Happy to help! Hope you get it working with the new layout and version.

Edit: Just to add, I can see sticking with an old version of AppDaemon will likely become unsupported and has the potential of causing more issues as HA evolves.

Hmm. I only see my current ControllerX (version: v4.29.0) in HACS, not ControllerX beta (version: v5.0.0b0), or any other versions. I wonder if it’s been pulled for an update.

It hasn’t been pulled. Once you click on “Download” you can change it to the pre-release version v5.0.0b0 by clicking on “Need a different version”. I’ve done this twice yesterday and today to make sure it works - but happy to help if you’re not seeing more than one version.

By default, the last production version is selected, which is v4.29.0.

@xaviml I have a better PR for the call to get_state , and wonder if it’d be easier on folks if that’s published as a proper release with a big fat “BREAKING CHANGE - YOU HAVE TO READ THIS” which documents adding cx_core to exclude_dirs:.

Another approach could be adding to AppDaemon a second mechanism for excluding directories, like an empty .dependency-exclude file. AppDaemon would then stop processing that directory and subdirectories as before, but this empty “pragma” file would be shipped wih ControllerX.

Edit Tidy up grammar, and added some random thoughts how to make this UX easier.

Yesterday HA auto updated AppDaemon to 17.4 despite having auto update disabled 😕 And apparently also updated controlerX and overwrote: apps/controllerx/cx_core/controller.py and appdaemon.yaml.

Afterwards AppDaemon was caught in a boot loop again. I was able to revert this using a backup.

@xaviml thank you! Got yelled at by my wife that the lights weren’t working again for a while, couldn’t figure it out myself from the logs but in the end I came across this thread and applying the changes in your PR resolved it for me.

OK, what happened most likely is our new stronger typing and validation caught a corner case that kind of worked - it wasn’t an intentional change but we may have eliminated something that worked - we are sensitive to breaking stuff for no reason so apologize for that, but moving forward we shouldn’t need to touch this again.

@acockburn It’s the one in adapi.py - and it’s get_state, not set_state, just in case that wasn’t a typo.

Just for the record, I’ve still got my training wheels on with AppDaemon - but enjoying the plunge into it’s and ControllerX’s code base to get up to speed.

@mietzen Ah - that’s your issue:

secrets: /homeassistant/secrets.yaml
appdaemon:
  latitude: 0
  longitude: 0
  elevation: 30
  time_zone: Europe/Berlin
  plugins:
    HASS:
      type: hass
      token: !env_var SUPERVISOR_TOKEN
http:
  url: http://0.0.0.0:5050
admin:
api:
hadashboard:
exclude_dirs:
  - cx_core

Move:

exclude_dirs:
  - cx_core

So it’s under appdaermon, like:

appdaemon:
  exclude_dirs:
    - cx_core

Thank you @charrus ,

I will checkout your branch next Monday and check on my setup.

In my local I got same changes as you, but without the kwargs from get_state, so I will check if the rest is working.

Regards,

Thank you @charrus ,

I believe the issue need to be debugged with AppDaemon more than HA since AppDaemon bumped its version and everything started failing.

I will not be able to keep debugging this issue until next week unfortunately, but if anyone finds anything, please, let me know.

Thanks, Xavi M.

@xaviml I’ve still got my HA core development environment still from when I submitted a PR for the kodi component; let me know if I can help at all.

Edit: Like @zillion42 I use z2m with listen_to mqtt, and also experience on/off not working.

Hi @charrus ,

Thank you for reporting this. I am still experiencing issues when dimming lights, but I have to debug further.

Does everything work for you?

Thanks,

@xaviml Can confirm your changes work 👍🏼 however like you mentioned I also cannot dim, but at least turning them on/off is working again! Thanks for the work so far!!!

Hi @charrus ,

Thank you for reporting this. I am still experiencing issues when dimming lights, but I have to debug further.

Does everything work for you?

Thanks,