ControllerX with PTM215XLightController and multiple independent lights
Opened this issue ยท 2 comments
Question
Hi Xavi,
I've got this PTM215XL light controller, currently configured with 2 paddles. This provides the 4 buttons (press_1, press_2, press_3 and press_4 and their corresponding release events). I've successfully configured the switch when controlling a single light (which we've previously discussed). However, now I'm trying something different. I'd like press_1/press_2 to control 1 set of HUE light bulbs, and press_2/press_3 to control a different (non Hue, non zigbee2mqtt) light. Based on the examples, I thought the following would work
office_dimmer:
module: controllerx
#class: RunlesswireClickLightController
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_lights
merge_mapping:
press_1:
action: click
attribute: on
press_2:
action: click
attribute: off
office_cabinet:
module: controllerx
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_cabinet
merge_mapping:
press_3:
action: click
attribute: on
press_4:
action: click
attribute: off
However, the result was that press_1/press_2 turned on/off both lights, and press_3/press_4 did dim/bright for both lights.
Do you have any recommendations for achieving my goal?
I'm on the latest of Home Assistant Core 2023.2.1, AppDaemon 0.11.0, and ControllerX 4.25.0.
Thanks,
Sean
Add here your question.
Additional information
- Devices involved:
- Model: [ eg. IKEA 1744 ] as [ Light | Media Player | Controller ]
- ...
- Integration: Choose from
z2m | deconz | zha
- AppDaemon version: [ eg. v4.0.1 ]
- ControllerX version: [ eg. v2.2.1 ]
- HACS version (if installed from there): [ eg. v0.21.5 ]
- Home Assistant Core version: [ eg. v0.105.4 ]
AppDaemon app configuration
(optional) Insert your appdaemon app configuration here (apps.yaml content).
Insert only the configuration relative to the controllerx app you're asking the question for.
Logs
(optional) Add relevant AppDaemon / Home Assistant logs which could help answering the question.
Additional Context
Add any other context or screenshots about the question here.
I'm still having an issue. I studied the examples, and based on the examples, I tried the following code as well (use mapping instead of merge mapping, and "quote" the on/off attributes.
office_dimmer:
module: controllerx
#class: RunlesswireClickLightController
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_lights
mapping:
press_1:
action: click
attribute: "on"
press_1_release:
action: release
press_2:
action: click
attribute: "off"
press_2_release:
action: release
office_cabinet:
module: controllerx
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_cabinet
mapping:
press_3:
action: click
attribute: "on"
press_3_release:
action: release
press_4:
action: click
attribute: "off"
press_4_release:
action: release
Press_1/Press_2 appear to work ok. But Press_3/Press_4 don't seem to do anything.
When looking at the logs, in the appdaemon "main" log, things look OK for both sets of buttons
2023-02-05 19:23:09.854707 INFO office_cabinet: ๐ Running `Predefined (click)` now
2023-02-05 19:23:09.849668 INFO office_cabinet: ๐ฎ Button event triggered: `press_4`
2023-02-05 19:23:08.827025 INFO office_cabinet: ๐ Running `Predefined (click)` now
2023-02-05 19:23:08.822430 INFO office_cabinet: ๐ฎ Button event triggered: `press_3`
2023-02-05 19:23:07.347458 INFO office_dimmer: ๐ Running `Predefined (click)` now
2023-02-05 19:23:07.336429 INFO office_dimmer: ๐ฎ Button event triggered: `press_2`
2023-02-05 19:23:05.908983 INFO office_dimmer: ๐ Running `Predefined (click)` now
2023-02-05 19:23:05.897396 INFO office_dimmer: ๐ฎ Button event triggered: `press_1`
2023-02-05 19:18:20.856919 INFO office_cabinet: ๐ Running `Predefined (click)` now
But I see these messages in the "error" log. Messages seem to show an error for both office_cabinet and office_dimmer, but office_light does appear to work while office_cabinet doesn't.
2023-02-05 19:26:31.112988 WARNING office_cabinet: ------------------------------------------------------------
--
2023-02-05 19:26:31.112772 WARNING office_cabinet: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 115, in run positional, action_args = _get_arguments( File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 63, in _get_arguments raise ValueError("\n".join(error_msg)) ValueError: `click` action is missing some parameters. Parameters available: attribute: str (value given: off) direction: str (missing) mode: str [default: stop] steps: Union [default: None]
2023-02-05 19:26:31.112289 WARNING office_cabinet: ------------------------------------------------------------
2023-02-05 19:26:31.112084 WARNING office_cabinet: Worker Ags: {'id': '1191321ceb544856a1e4cc281b74fbdb', 'name': 'office_cabinet', 'objectid': 'f6ef87316b8346a5b0b3f212fdaea14b', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7f18206a9b70>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_4', 'old_state': '', 'pin_app': True, 'pin_thread': 2, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 19:26:31.111805 WARNING office_cabinet: Unexpected error in worker for App office_cabinet:
2023-02-05 19:26:31.111535 WARNING office_cabinet: ------------------------------------------------------------
2023-02-05 19:26:29.715695 WARNING office_cabinet: ------------------------------------------------------------
2023-02-05 19:26:29.715387 WARNING office_cabinet: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 115, in run positional, action_args = _get_arguments( File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 63, in _get_arguments raise ValueError("\n".join(error_msg)) ValueError: `click` action is missing some parameters. Parameters available: attribute: str (value given: on) direction: str (missing) mode: str [default: stop] steps: Union [default: None]
2023-02-05 19:26:29.714827 WARNING office_cabinet: ------------------------------------------------------------
2023-02-05 19:26:29.714536 WARNING office_cabinet: Worker Ags: {'id': '1191321ceb544856a1e4cc281b74fbdb', 'name': 'office_cabinet', 'objectid': 'f6ef87316b8346a5b0b3f212fdaea14b', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7f18206a9b70>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_3', 'old_state': '', 'pin_app': True, 'pin_thread': 2, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 19:26:29.714224 WARNING office_cabinet: Unexpected error in worker for App office_cabinet:
2023-02-05 19:26:29.713929 WARNING office_cabinet: ------------------------------------------------------------
2023-02-05 19:26:28.593629 WARNING office_dimmer: ------------------------------------------------------------
2023-02-05 19:26:28.593421 WARNING office_dimmer: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 115, in run positional, action_args = _get_arguments( File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 63, in _get_arguments raise ValueError("\n".join(error_msg)) ValueError: `click` action is missing some parameters. Parameters available: attribute: str (value given: off) direction: str (missing) mode: str [default: stop] steps: Union [default: None]
2023-02-05 19:26:28.592918 WARNING office_dimmer: ------------------------------------------------------------
2023-02-05 19:26:28.592657 WARNING office_dimmer: Worker Ags: {'id': 'de9d70841b1d4538a6e64319c7ff2618', 'name': 'office_dimmer', 'objectid': '928cb5da6332421cadb514dab0109593', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7f18211f8610>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_2', 'old_state': '', 'pin_app': True, 'pin_thread': 1, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 19:26:28.592325 WARNING office_dimmer: Unexpected error in worker for App office_dimmer:
2023-02-05 19:26:28.592025 WARNING office_dimmer: ------------------------------------------------------------
2023-02-05 19:26:27.322191 WARNING office_dimmer: ------------------------------------------------------------
2023-02-05 19:26:27.321980 WARNING office_dimmer: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 115, in run positional, action_args = _get_arguments( File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 63, in _get_arguments raise ValueError("\n".join(error_msg)) ValueError: `click` action is missing some parameters. Parameters available: attribute: str (value given: on) direction: str (missing) mode: str [default: stop] steps: Union [default: None]
2023-02-05 19:26:27.321467 WARNING office_dimmer: ------------------------------------------------------------
2023-02-05 19:26:27.321239 WARNING office_dimmer: Worker Ags: {'id': 'de9d70841b1d4538a6e64319c7ff2618', 'name': 'office_dimmer', 'objectid': '928cb5da6332421cadb514dab0109593', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7f18211f8610>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_1', 'old_state': '', 'pin_app': True, 'pin_thread': 1, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 19:26:27.320959 WARNING office_dimmer: Unexpected error in worker for App office_dimmer:
2023-02-05 19:26:27.320486 WARNING office_dimmer: ------------------------------------------------------------
Both paddles seem to generate the same error/warning, but one of them actually works, while the other doesn't switch the light on/off. One other thing to note is that the light that works is controlled by z2m (hue bulbs), while the other is a generic light controlled by HA (via ISY994 integration).
Sean
@xaviml
Hi Xavi,
Some more progress...
NOTE: I didn't see this mentioned in the documentation. If you "define" a new "app"/controller, I need to restart appdaemon for the changes to be "seen", but if I modify attributes to an already defined "app" (e.g. experiment with the various options), I can just modify and save the text file, and the changes apply immediately. This is much easier than restarting appdaemon each time. It might be useful to let other people know this in the documentation.
Calling the light service directly instead of defining the attributes seemed to allow me to get press_3/press_4 to work correctly. I'm not sure why it didn't work without this. The warnings about missing attributes in the prior tests went away for these presses.
However, I still note the warnings on press_1/press_2. Strangely, they seem to refer to direction and mode "attributes" that are missing. So, I tried defining them, and then got a different message.
office_sw_left:
module: controllerx
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_lights
mapping:
press_1:
action: click
attribute: "on"
direction: "up"
mode: "stop"
press_1_release:
action: release
press_2:
action: click
attribute: "off"
#direction: "down"
#mode: "stop"
press_2_release:
action: release
office_sw_right:
module: controllerx
class: PTM215XLightController
controller: sensor.officeswitch_action
integration: z2m
light: light.office_cabinet
mapping:
press_3:
service: light.turn_on
data:
entity_id: light.office_cabinet
brightness: 255
transition: 0.35
press_3_release:
action: release
press_4:
service: light.turn_off
data:
entity_id: light.office_cabinet
#brightness: 255
press_4_release:
action: release
Here are the "errors". Note the difference between press_1/press_2. Press_2 complains that some attributes are not provided (since I commented them out), while press_1 says that "on" is not a valid option to the "click" action, even though it complained about it missing in a prior message
2023-02-05 20:07:50.527372 WARNING office_sw_left: ------------------------------------------------------------
--
2023-02-05 20:07:50.527158 WARNING office_sw_left: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 118, in run await action(*positional, **action_args) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 62, in _action_impl await method(controller, *args, **kwargs) File "/config/appdaemon/apps/controllerx/cx_core/type/light_controller.py", line 823, in click attribute = self.get_option( File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 202, in get_option raise ValueError( ValueError: `click` action - `on` is not an option. The options are ['brightness', 'white_value', 'color', 'color_temp', 'xy_color']
2023-02-05 20:07:50.526587 WARNING office_sw_left: ------------------------------------------------------------
2023-02-05 20:07:50.526384 WARNING office_sw_left: Worker Ags: {'id': 'f1c71a021e4b4f0fbcae983215062e1b', 'name': 'office_sw_left', 'objectid': '46b6f830660a4447b5b1a064450fe014', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7fabcc5b8250>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_1', 'old_state': '', 'pin_app': True, 'pin_thread': 1, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 20:07:50.526122 WARNING office_sw_left: Unexpected error in worker for App office_sw_left:
2023-02-05 20:07:50.525868 WARNING office_sw_left: ------------------------------------------------------------
2023-02-05 20:07:45.403646 WARNING office_sw_left: ------------------------------------------------------------
2023-02-05 20:07:45.403440 WARNING office_sw_left: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 826, in async_worker await funcref( File "/config/appdaemon/apps/controllerx/cx_core/integration/z2m.py", line 71, in state_callback await self.controller.handle_action(new, previous_state=old) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 404, in handle_action await self.call_action(action_key, extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 478, in call_action await self.action_timer_callback({"action_key": action_key, "extra": extra}) File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 516, in action_timer_callback await task File "/config/appdaemon/apps/controllerx/cx_core/controller.py", line 532, in call_action_types await action_type.run(extra=extra) File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 115, in run positional, action_args = _get_arguments( File "/config/appdaemon/apps/controllerx/cx_core/action_type/predefined_action_type.py", line 63, in _get_arguments raise ValueError("\n".join(error_msg)) ValueError: `click` action is missing some parameters. Parameters available: attribute: str (value given: off) direction: str (missing) mode: str [default: stop] steps: Union [default: None]
2023-02-05 20:07:45.402960 WARNING office_sw_left: ------------------------------------------------------------
2023-02-05 20:07:45.402715 WARNING office_sw_left: Worker Ags: {'id': 'f1c71a021e4b4f0fbcae983215062e1b', 'name': 'office_sw_left', 'objectid': '46b6f830660a4447b5b1a064450fe014', 'type': 'state', 'function': <bound method Z2MIntegration.state_callback of <cx_core.integration.z2m.Z2MIntegration object at 0x7fabcc5b8250>>, 'attribute': 'state', 'entity': 'sensor.officeswitch_action', 'new_state': 'press_2', 'old_state': '', 'pin_app': True, 'pin_thread': 1, 'kwargs': {'__thread_id': 'MainThread'}}
2023-02-05 20:07:45.402454 WARNING office_sw_left: Unexpected error in worker for App office_sw_left:
2023-02-05 20:07:45.402214 WARNING office_sw_left: ------------------------------------------------------------
Thanks,
Sean