ControllerX. Bring full functionality to light and media player controllers

Thanks for the tip, I’ve edited my original post with more details.

Hello, I love controllerX, thanks a lot! I was wondering if it was possible to integrate this tuya smart knob for Z2M compatibility. TuYa ERS-10TZBVK-AA control via MQTT | Zigbee2MQTT

I probably need to file a request but I wonder if this is possible at all. I’d love to help out as i’m running them on my z2m network right now.

Hi @BoKKeR,

You can configure 1 config per action_group. It would be something like:

livingroom_controller:
  log_level: DEBUG
  module: controllerx
  class: ZYCT202LightController
  controller: sensor.0x00158d00038e6108_action
  integration:
    name: z2m
    listen_to: mqtt
    action_group: 1
  light: light.livingroom

When action group is 1, it will control light.livingroom, then you can create other configs for other action groups. Note that for this to work, you need to have the MQTT broker configure in AppDaemons since it needs to read the MQTT payloads. You can read more about this here.

Regards,
Xavi M.

1 Like

Hi @rickdtc,

It sounds like something that ControllerX could handle, but for now, it does not support zwave integration (no one has requested it so far), but we can work together to add support for it. How can one check the events for Zwave integration? Are the events sent with HA events? Similar to ZHA or deCONZ for example?

Then, regarding the lights, which integration are you using for them? Is it Zigbee2MQTT? Or Hue integration?

Regards,
Xavi M.

Hi @stevevanhoyweghen ,

Thank you for the detailed logs. The not found in namespace default warnings are somehow “expected”. Not sure why AppDaemon shows those warnings on debug logs, but that does not mean that is not working.

May I know what it is that is not working from the testing configuration? Is the controller not doing anything when interacting with the light? The config looks good to me as well as the logs you shared, but if it is not working I would check:

  • sensor entity is the correct one and its state changes when the button is pressed.
  • light entity is the correct one and it works through HA dashboard.

Also, are there any logs once you start interacting with the controller?

Regards,
Xavi M.

Hi @sentur,

I see you are using ControllerX v4.18.2 (latest is v4.22.0). On version v4.21.0, this controller was renamed from W2049 to E2002. So you have 2 options:

  • Change your class from E2002LightController to W2049LightController
  • Update ControllerX to latest, restart AppDaemon, and no need to change configuration.

Regards,
Xavi M.

1 Like

Hi @Beanbeans ,

Yes, it is possible. Please, fill in the “New device support” form when creating an issue. You will need to indicate the actions triggered by this controller, although I already see that they are in here, it will help me to know what is that you did for those actions to trigger ( toggle , brightness_step_up , brightness_step_down , color_temperature_step_up , color_temperature_step_down , saturation_move , hue_move , hue_stop , single , double , hold , rotate_left , rotate_right).

Regards,
Xavi M.

Hi @xaviml,

Thanks to take the time to look into my message.
I can confirm that the light entity light.tradfri_bulb_e27_1055lm_white_spectrum_1 is the correct one. It works using the Zigbee2MQTT dashboard in HA. So this is working as expected.
The sensor entity sensor.tradfri_styrbar_remote_control_N2_1 is correct as well. To be sure I copied/pasted and saved once again from the Zigbee2MQTT devices list in the apps.yaml file. When pushing the switch buttons, I can see the expected messages in the Zigbee2MQTT logs. Here an example …

debug 2022-08-28 22:09:52Received Zigbee message from 'tradfri_styrbar_remote_control_N2_1', type 'commandOn', cluster 'genOnOff', data '{}' from endpoint 1 with groupID 0
info 2022-08-28 22:09:52MQTT publish: topic 'zigbee2mqtt/tradfri_styrbar_remote_control_N2_1', payload '{"action":"on","battery":100,"device":{"applicationVersion":1,"dateCode":"20200708","friendlyName":"tradfri_styrbar_remote_control_N2_1","hardwareVersion":1,"ieeeAddr":"0x540f57fffe1dc28b","manufacturerID":4476,"manufacturerName":"IKEA of Sweden","model":"E2001/E2002","networkAddress":63797,"powerSource":"Battery","softwareBuildID":"1.0.024","stackVersion":103,"type":"EndDevice","zclVersion":3},"last_seen":"2022-08-28T22:09:52+02:00","linkquality":43,"update":{"state":"idle"},"update_available":false}'
info 2022-08-28 22:09:52MQTT publish: topic 'zigbee2mqtt/tradfri_styrbar_remote_control_N2_1', payload '{"action":"","battery":100,"device":{"applicationVersion":1,"dateCode":"20200708","friendlyName":"tradfri_styrbar_remote_control_N2_1","hardwareVersion":1,"ieeeAddr":"0x540f57fffe1dc28b","manufacturerID":4476,"manufacturerName":"IKEA of Sweden","model":"E2001/E2002","networkAddress":63797,"powerSource":"Battery","softwareBuildID":"1.0.024","stackVersion":103,"type":"EndDevice","zclVersion":3},"last_seen":"2022-08-28T22:09:52+02:00","linkquality":43,"update":{"state":"idle"},"update_available":false}'
info 2022-08-28 22:09:52MQTT publish: topic 'zigbee2mqtt/tradfri_styrbar_remote_control_N2_1/action', payload 'on'
debug 2022-08-28 22:09:55Received Zigbee message from 'hue_dimmer_switch_1', type 'commandQueryNextImageRequest', cluster 'genOta', data '{"fieldControl":0,"fileVersion":1107324829,"imageType":265,"manufacturerCode":4107}' from endpoint 2 with groupID 0

So, I cannot see any issue so far.

For your reference, all HA related software is updated to the latest version and the other 3 switches I have (1 Ikea / 2 Philips) work as expected since several months. I even updated my Zigbee coordinator to be sure.

Finally, ControllerX is great! Thank you for your work and support!

Hi @stevevanhoyweghen ,

Do you see anything in the logs when pressing the buttons? If not, this means that ControllerX (and AppDaemon) is not reading from the sensor. Could you check if the sensor state is changing when you oress the buttons? You can check this in the developer tools from Home Assistant. You will see the state changing really quick, or you can check in the entity panel for the last time the state changed, which should be seconds if you are pressing the buttons.

Normally, the sensor name for Z2M finishes with _action. Did you change the entity name or is that part missing in the entity name?

Regards,
Xavi M.

Hi @xaviml,

Breaking down your message trying to match your expectations :wink:

Do you see anything in the logs when pressing the buttons?

No. Nothing in the appdaemon.log. Logging for the other buttons. access.log and error.log remain empty as expected.

If not, this means that ControllerX (and AppDaemon) is not reading from the sensor.
Could you check if the sensor state is changing when you press the buttons? You can check this in the developer tools from Home Assistant.
You will see the state changing really quick, or you can check in the entity panel for the last time the state changed, which should be seconds if you are pressing the buttons.

Developer Tools; States; Filter entities = syrbar.
I see the state changing for ‘sensor.tradfri_styrbar_remote_control_n2_1_action’.
Action is reflecting the keys pressed correctly: on, off, arrow_left_click, arrow_right_click, etc. Long presses as well.

Normally, the sensor name for Z2M finishes with _action. Did you change the entity name or is that part missing in the entity name?

No, it is not missing.
Entity:
sensor.tradfri_styrbar_remote_control_n2_1_action

State: ass described above

Attributes:

action:
battery: 100
device:
applicationVersion: 1
dateCode: '20200708'
friendlyName: tradfri_styrbar_remote_control_N2_1
hardwareVersion: 1
ieeeAddr: '0x540f57fffe1dc28b'
manufacturerID: 4476
manufacturerName: IKEA of Sweden
model: E2001/E2002
networkAddress: 63797
powerSource: Battery
softwareBuildID: 1.0.024
stackVersion: 103
type: EndDevice
zclVersion: 3

last_seen: 2022-08-29T15:51:25+02:00
linkquality: 83
update:
state: idle

update_available: false
device_class: update
friendly_name: tradfri_styrbar_remote_control_N2_1_update_available

Conclusion: Status changes are as expected, but somewhere it got lost. I also tried removing the switch and pairing again. Still no success.

So, something is blocking the expected processing … I am clueless. Any other idea?

Hi @stevevanhoyweghen ,

In the configuration you sent in your first comment the sensor entity is missing the _action at the end, and the sensor you checked has the _action at the end (sensor.tradfri_styrbar_remote_control_n2_1_action)

That would explain why you do not see anything in your logs.

Regards,
Xavi M.

Hi xavimI,

Indeed the ‘_action’ was missing, but this was probably introduced after numerous changes, late hours … However, I added ‘_action’ but still no luck. So I started to play around with several changes and I finally found it!
‘sensor.tradfri_styrbar_remote_control_N2_1_action’ was not working, but when I renamed the ‘Friendly Name’ to ‘sensor.tradfri_styrbar_remote_control_n2_1_action’ and changed my apps.yaml to align with this renaming … tadaaa!!! It works.
So, my question is, is this upper/lowercase thing on purpose, or is this an error?
Anyway, it works, but it is a potential trap that could bring poor souls to despair :hot_face:.
Thanks for your support!

Best regards,

Steve

1 Like

Thank you. Updating to the 4.22+ has fixed the issue.

1 Like

Hi Steve,

Home Assistant does that automatically, yes. It transforms the friendly names to entity names on snake case. Snake case changes the name to have underscore ( _ ) as spaces and first word letters as lowercase.

Anyway, this is a Home Assistance feature, and what it is important is that the same entity name (being case sensitive) needs to be used in ControllerX. But it seems that you had to luck with copying and pasting and something else was needed in HA, which is not normal. Maybe you found a HA bug, but I am not sure what exactly happened.

Glad you got it working now :slight_smile:

Regards,
Xavi M.

Hi Xavi,

Thank you for your response. I’ve filled in the request now and hope it contains enough information.

Hi Xavi,

thanks for this amazing app. I’m probably doing something wrong but I cannot make it work. I get:

appdaemon        | 2022-09-17 22:19:03.118412 INFO AppDaemon: Reading config
appdaemon        | 2022-09-17 22:19:03.122167 INFO AppDaemon: /appdaemon/apps/apps.yaml added or modified
appdaemon        | 2022-09-17 22:19:03.122288 INFO AppDaemon: /appdaemon/apps/apps.yaml added or modified
appdaemon        | 2022-09-17 22:19:03.122518 INFO AppDaemon: App 'mando_dormitorio' added
appdaemon        | 2022-09-17 22:19:03.122973 INFO AppDaemon: Adding /appdaemon/apps to module import path
appdaemon        | 2022-09-17 22:19:03.123382 INFO AppDaemon: Adding /appdaemon/apps/controllerx to module import path
appdaemon        | 2022-09-17 22:19:03.123784 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core to module import path
appdaemon        | 2022-09-17 22:19:03.124169 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core/stepper to module import path
appdaemon        | 2022-09-17 22:19:03.124616 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core/action_type to module import path
appdaemon        | 2022-09-17 22:19:03.125055 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core/feature_support to module import path
appdaemon        | 2022-09-17 22:19:03.125506 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core/integration to module import path
appdaemon        | 2022-09-17 22:19:03.125967 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_core/type to module import path
appdaemon        | 2022-09-17 22:19:03.126411 INFO AppDaemon: Adding /appdaemon/apps/controllerx/cx_devices to module import path
appdaemon        | 2022-09-17 22:19:03.133623 WARNING AppDaemon: No app description found for: /appdaemon/apps/utils.py - ignoring
appdaemon        | 2022-09-17 22:19:03.133780 WARNING AppDaemon: No app description found for: /appdaemon/apps/motion.py - ignoring
appdaemon        | 2022-09-17 22:19:03.133922 WARNING AppDaemon: No app description found for: /appdaemon/apps/fritzboxguestwifi.py - ignoring
appdaemon        | 2022-09-17 22:19:03.134068 WARNING AppDaemon: No app description found for: /appdaemon/apps/climate.py - ignoring
appdaemon        | 2022-09-17 22:19:03.134208 WARNING AppDaemon: No app description found for: /appdaemon/apps/presence.py - ignoring
appdaemon        | 2022-09-17 22:19:03.134341 INFO AppDaemon: Loading App Module: /appdaemon/apps/controllerx/controllerx.py
appdaemon        | 2022-09-17 22:19:03.137688 WARNING AppDaemon: ------------------------------------------------------------
appdaemon        | 2022-09-17 22:19:03.137838 WARNING AppDaemon: Unexpected error loading module: /appdaemon/apps/controllerx/controllerx.py:
appdaemon        | 2022-09-17 22:19:03.137948 WARNING AppDaemon: ------------------------------------------------------------
appdaemon        | 2022-09-17 22:19:03.139541 WARNING AppDaemon: Traceback (most recent call last):
appdaemon        |   File "/usr/local/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 2026, in check_app_updates
appdaemon        |     self.read_app(mod["name"], mod["reload"])
appdaemon        |   File "/usr/local/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 1809, in read_app
appdaemon        |     self.modules[module_name] = importlib.import_module(module_name)
appdaemon        |   File "/usr/local/lib/python3.5/importlib/__init__.py", line 126, in import_module
appdaemon        |     return _bootstrap._gcd_import(name[level:], package, level)
appdaemon        |   File "<frozen importlib._bootstrap>", line 985, in _gcd_import
appdaemon        |   File "<frozen importlib._bootstrap>", line 968, in _find_and_load
appdaemon        |   File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
appdaemon        |   File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
appdaemon        |   File "<frozen importlib._bootstrap_external>", line 697, in exec_module
appdaemon        |   File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
appdaemon        |   File "/appdaemon/apps/controllerx/controllerx.py", line 6, in <module>
appdaemon        |     from cx_core import (
appdaemon        |   File "/appdaemon/apps/controllerx/cx_core/__init__.py", line 1, in <module>
appdaemon        |     from cx_core.controller import Controller, action
appdaemon        |   File "/appdaemon/apps/controllerx/cx_core/controller.py", line 87
appdaemon        |     args: Dict[str, Any]
appdaemon        |         ^
appdaemon        | SyntaxError: invalid syntax
appdaemon        |
appdaemon        | 2022-09-17 22:19:03.139775 WARNING AppDaemon: Removing associated apps:
appdaemon        | 2022-09-17 22:19:03.139900 WARNING AppDaemon: mando_dormitorio

This is my apps.yaml:

mando_dormitorio:
  module: controllerx
  class: HueDimmerController
  integration: z2m
  controller: sensor.mando_salon_action
  light: light.lampara_cocina  

Any clue on what I might be doing wrong? I’m running Home Assistant 2022.9.4

thanks,
Ignacio.

Never mind, I was using the wrong container for appdaemon which was probably outdated :slight_smile:

thanks!

1 Like

I wonder if someone could help me here… I had a few Ikea switches working through this to control a few socket switches and lights (socket switches are controlling lamps on/off) but for some reason they are no longer working (no idea why there is nothing in the logs that i can see)

here is my apps.yaml

end_light_switch_controller:
  module: controllerx
  class: E1743SwitchController
  controller: end_light
  integration: deconz
  switch: switch.end_light

the switch switch.end_light works if I go into developer tools —> states and turn it on/off from there,
if I go into developer tools ----. events and enter deconz_event then listen… when the remote button is pushed I have.

event_type: deconz_event
data:
  id: end_light
  unique_id: bc:33:ac:ff:fe:0f:9b:f1
  event: 2002
  device_id: 43e070260de57918b83316de6477e564
origin: LOCAL
time_fired: "2022-09-18T14:27:37.791029+00:00"
context:
  id: 01GD8FYRNZCKMM2WD1XQS79YQ3
  parent_id: null
  user_id: null

but the switch (or lamp) wont turn off or on…

any ideas???

thanks

Robin

Hi!

I’m using Hue Dimmers and I’d like to have the on button activating a scene using time constrains on the first push and cycle through scenes on the subsequent clicks.

I understand according to this comment that the only way would be to repeat the whole app (including the cycling) as many times as scenes I have, right?

thanks!

Found my problem. Despite rebooting my pi and pulling the power a few times, I needed to press restart on the apdamon integration. That was it. So all working now and I’ve learned another place to check if I have a problem again :grin:

1 Like