xaviml / controllerx

Create controller-based automations with ease to control your home devices and scenes.
https://xaviml.github.io/controllerx/
MIT License
335 stars 70 forks source link

Error while adding Jung FoH switch (enOcean PTM215Z) #719

Closed AlexZuiderwijk closed 1 year ago

AlexZuiderwijk commented 1 year ago

Hi, I try to add a Hue Dimmer Switch and some FoH switches based on the PTM215Z, and added them in the config according to the documentation for Zigbee2MQTT (HA entity). Adding the Hue Dimmer Switch went OK, but after adding the FoH switch and restarting AppDeamon I get the following error message on the Jung FoH switch config (also when just adding only "the left or right part of the FoH 4-button switch" ):

“Querying a specific attribute is only possible for a single entity".format(name))”.

Wondering if I made some kind of mistake (although I could not find it in documentation or when searching around) and/or if this is a ControllerX issue or related to some other configuration..... Any advice is very welcome, if more information is required please tell me.

Additional information

AppDaemon app configuration

FoH_Jung_3_Left:
  module: controllerx
  class: PTM215XLightController
  integration: z2m
  controller: sensor.0x000000000172bbe0_action
  min_brightness: 1
  automatic_steps: 20
  manual_steps: 7
  mapping:   
    press_1: "on"
    press_2: "off"
    press_1_and_3:
      service: input_select.select_next
      entity_id: input_select.controller_state
  constrain_input_select: input_select.controller_state,state_0
  light: aa testlamp via mqtt

FoH_Jung_3_Right:
  module: controllerx
  class: PTM215XLightController
  integration: z2m
  controller: sensor.0x000000000172bbe0_action
  min_brightness: 1
  automatic_steps: 20
  manual_steps: 7
  mapping:   
    press_1: hold_brightness_up
    release_1: release
    press_2: hold_brightness_down
    release_2: release
    press_1_and_3:
      service: input_select.select_next
      entity_id: input_select.controller_state
  constrain_input_select: input_select.controller_state,state_1
  light: aa testlamp via mqtt

Logs

2023-02-09 16:39:17.417338 WARNING FoH_Jung_3_Left: ------------------------------------------------------------
2023-02-09 16:39:17.417694 WARNING FoH_Jung_3_Left: Unexpected error running initialize() for FoH_Jung_3_Left
2023-02-09 16:39:17.417926 WARNING FoH_Jung_3_Left: ------------------------------------------------------------
2023-02-09 16:39:17.418696 WARNING FoH_Jung_3_Left: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 163, in initialize_app
    await init()
  File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 104, in initialize
    await self.init()
  File "/config/appdaemon/apps/controllerx/cx_core/type/light_controller.py", line 146, in init
    await super().init()
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 57, in init
    self.entity = await self._get_entity(self.args[self.entity_arg])
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 100, in _get_entity
    entities = await self._get_entities(entity_name) if self.domains else None
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 73, in _get_entities
    entities: Optional[Union[str, List[str]]] = await self.get_state(
  File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 375, in get_state
    return await super().get_state(
  File "/usr/lib/python3.10/site-packages/appdaemon/adapi.py", line 1511, in get_state
    return await self.get_entity_api(namespace, entity_id).get_state(attribute, default, copy, **kwargs)
  File "/usr/lib/python3.10/site-packages/appdaemon/entity.py", line 149, in get_state
    return await self.AD.state.get_state(self.name, namespace, entity_id, attribute, default, copy)
  File "/usr/lib/python3.10/site-packages/appdaemon/state.py", line 500, in get_state
    raise ValueError("{}: Querying a specific attribute is only possible for a single entity".format(name))
ValueError: FoH_Jung_3_Left: Querying a specific attribute is only possible for a single entity
2023-02-09 16:39:17.419027 WARNING FoH_Jung_3_Left: ------------------------------------------------------------
2023-02-09 16:39:17.421157 INFO FoH_Jung_3_Right: 🎮 ControllerX v4.25.0
2023-02-09 16:39:17.426306 WARNING FoH_Jung_3_Right: ------------------------------------------------------------
2023-02-09 16:39:17.426697 WARNING FoH_Jung_3_Right: Unexpected error running initialize() for FoH_Jung_3_Right
2023-02-09 16:39:17.426958 WARNING FoH_Jung_3_Right: ------------------------------------------------------------
2023-02-09 16:39:17.427607 WARNING FoH_Jung_3_Right: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 163, in initialize_app
    await init()
  File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 104, in initialize
    await self.init()
  File "/config/appdaemon/apps/controllerx/cx_core/type/light_controller.py", line 146, in init
    await super().init()
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 57, in init
    self.entity = await self._get_entity(self.args[self.entity_arg])
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 100, in _get_entity
    entities = await self._get_entities(entity_name) if self.domains else None
  File "/config/appdaemon/apps/controllerx/cx_core/type_controller.py", line 73, in _get_entities
    entities: Optional[Union[str, List[str]]] = await self.get_state(
  File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 375, in get_state
    return await super().get_state(
  File "/usr/lib/python3.10/site-packages/appdaemon/adapi.py", line 1511, in get_state
    return await self.get_entity_api(namespace, entity_id).get_state(attribute, default, copy, **kwargs)
  File "/usr/lib/python3.10/site-packages/appdaemon/entity.py", line 149, in get_state
    return await self.AD.state.get_state(self.name, namespace, entity_id, attribute, default, copy)
  File "/usr/lib/python3.10/site-packages/appdaemon/state.py", line 500, in get_state
    raise ValueError("{}: Querying a specific attribute is only possible for a single entity".format(name))
ValueError: FoH_Jung_3_Right: Querying a specific attribute is only possible for a single entity
2023-02-09 16:39:17.427870 WARNING FoH_Jung_3_Right: ------------------------------------------------------------
Flight777 commented 1 year ago

Following, have the same issue with Busch Jeager switch

AlexZuiderwijk commented 1 year ago

Yes ("glad" I'm not the only one with this problem ;-) ) , probably related to all PTM215Z 4-button switches, I also tried a Senic / Gira switch and adding this one also results in same error message

xaviml commented 1 year ago

Hi @AlexZuiderwijk and @Flight777 ,

Sorry for the logs not being clear, but the problem is that you are using a Light Controller (PTM215XLightController), so the light attribute is expecting to have an entity like light.XYZ, and you are passing aa testlamp via mqtt. This controller does not support Zigbee2MQTT Light Controller.

I will try to improve logging for this case, but I hope this solved your issues.

Regards, Xavi M.

AlexZuiderwijk commented 1 year ago

Hi @xaviml ,

Thanks for explaining, I had impression the error was referring to the PTM215Z but apparently the error was referring to the wrong name/definition of the entity being controlled :-)

I changed aa testlamp via mqtt to the right entityname in HA 'light.aa_testlamp_via_mqtt' and now it works!

Thanks again, Alex