Controllerx: New device: Aqara - Double rocker

Created on 28 Jan 2020  路  43Comments  路  Source: xaviml/controllerx

HI

Is there any possibility that you can add Xiaomi Aqara devices? like the Double rocker etc.

Would be greate. having problem with the "dimming" control and if it would work like the ikea tr氓dfri controllers i would be very glad

//Christoffer

All 43 comments

Hii @Sluden,

Is the device you are mentioning, this one. If so, are you using it with deCONZ or z2m? If you leave the mapping that the controller sends for each click (and hold), I will be able to integrate the device. Thank you!

Hi.
im using it with z2m.
Do you mean this: (or else pls explain what you mean :) )
both
both_double
both_hold
right
right_double
right_hold
left
left_double
left_hold

Im thinking if its possible like right single click toggle lamps, hold right dimming lights?

Is it possible to do something like that

Thanks so very much

//Christoffer

So is this list the state that your switch takes every time the buttons are pressed? I will add it and I will ask you to try if you are willing to. Thanks!

Yes it is.
Of course i can try. Thank you so very much

Hey @Sluden,

I see that you included left/right/both_hold, but I do not see the left/right/both_release. Could it be possible that you missed it or it does not report the release action?

Hi

I dont think it reports that.
Havent seen it in the log

If that's so, dimming will not work since there is no way to tell HA to stop dimming a light

EDIT:
I see that it does not say anything about that in the oficial z2m documentation. It also makes sense since if you hold the button, it will reset for pairing. What I can do is double click to turn up brightness and long for dimming.

I see. Im not at home at the moment. I will ser when im home. I have read somewhere people that wrote the dimming as an "automation". I will look for it.
And check for the release action in the log.
Is it possible to maybe dim like 15% at double click or something, if it doesnt work with the hold/release

Okay, keep me posted with it. I will look for some info as well. Regarding the percentage of the dimming, that is configurable from the apps.yaml. Once it's ready to test, I will create the template for you.

Hi again. there is no "release". here麓s the log:

zigbee2mqtt:info 2020-02-03 17:08:21: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":34,"click":"right_long"}'
zigbee2mqtt:info 2020-02-03 17:08:21: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":34,"click":""}'

The empty "click" i dont know where it comes from. it has been so for a couple of months with every click.

Yes that template would be nice of course.

//Christoffer

Hey @Sluden,

I have created the integration for Aqara double key wireless controller for zigbee2mqtt. The states that listen to are: both, both_double, both_long, right, right_double, right_long, left, left_double, left_long. Is this correct? I have created a new pre-release v2.2.0b3, you can download it from HACS by marking "Show beta". Here is a template for your use case:

controller_left_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id1>
  light: light.light1
  integration: z2m
  manual_steps: 7
  actions:
  - left
  - left_double
  - left_long

controller_right_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id2>
  light: light.light2
  integration: z2m
  manual_steps: 7
  actions:
  - right
  - right_double
  - right_long

controller_both_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id3>
  light: light.light3
  integration: z2m
  manual_steps: 7
  actions:
  - both
  - both_double
  - both_long

I have added the both option, although is not something I would recommend, but good to know that you are able to do it. The option manual_steps indicates how many steps needs to be done to go from min to max. Since you wanted 15%, with manual_steps 7 is roughly 15%. You can adjust it to your liking. Please let me know if this works for you.

Thank you so very much.
Im gonna try it now, just a question, does it only dim up. or does it go down aswell. or else maybe like double will go up and long go down or something?

very glad for this

Sorry, just read the comment that you edited before.... so the brigtness up and dimming are fixed. thx

got this msg:

2020-02-03 20:40:41.305808 INFO AppDaemon: Initializing app controller_left_switch using class DoubleKeyWirelessAqaraController from module controollerx
2020-02-03 20:40:41.309533 WARNING AppDaemon: Unable to find module module controollerx - 'controller_left_switch' is not initialized
2020-02-03 20:40:41.324433 WARNING AppDaemon: Unable to find module controller_left_switch - initialize() skipped

That is my mistake, the module is controllerx . I edited the previous comment.

sorry. saw that...

will try again.

2020-02-03 21:16:00.050608 WARNING controller_left_switch: ------------------------------------------------------------
2020-02-03 21:16:00.053593 WARNING controller_left_switch: Unexpected error running initialize() for controller_left_switch
2020-02-03 21:16:00.056809 WARNING controller_left_switch: ------------------------------------------------------------
2020-02-03 21:16:00.061507 WARNING controller_left_switch: Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 145, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 276, in run_in_executor
response = future.result()
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/config/appdaemon/apps/controllerx/core/type/light_controller.py", line 69, in initialize
super().initialize()
File "/config/appdaemon/apps/controllerx/core/controller.py", line 166, in initialize
super().initialize()
File "/config/appdaemon/apps/controllerx/core/controller.py", line 45, in initialize
integration = self.get_integration(self.args["integration"])
KeyError: 'integration'
2020-02-03 21:16:00.065462 WARNING controller_left_switch: ------------------------------------------------------------
2020-02-03 21:16:00.075247 INFO AppDaemon: App initialization complete

My fault again. I updated the previous comment again by adding integration: z2m which is a new parameter

I just realised there is a bug in there. Could you try with just one app instance (one of the three) and remove the parameter actions with the list? Then the left, right and both will do the same. If this happens is that it works, but I will need to fix the bug on the actions, it won't work otherwise. Sorry for that.

i inly have the left one in apps.yaml. i now removed the actions: now it gives me:

2020-02-03 21:34:40.581231 INFO AppDaemon: Terminating controller_left_switch
2020-02-03 21:34:40.590919 INFO AppDaemon: Initializing app controller_left_switch using class DoubleKeyWirelessAqaraController from module controllerx
2020-02-03 21:34:40.610783 WARNING controller_left_switch: ------------------------------------------------------------
2020-02-03 21:34:40.614182 WARNING controller_left_switch: Unexpected error running initialize() for controller_left_switch
2020-02-03 21:34:40.617262 WARNING controller_left_switch: ------------------------------------------------------------
2020-02-03 21:34:40.622347 WARNING controller_left_switch: Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 145, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 276, in run_in_executor
response = future.result()
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/config/appdaemon/apps/controllerx/core/type/light_controller.py", line 69, in initialize
super().initialize()
File "/config/appdaemon/apps/controllerx/core/controller.py", line 166, in initialize
super().initialize()
File "/config/appdaemon/apps/controllerx/core/controller.py", line 45, in initialize
integration = self.get_integration(self.args["integration"])
KeyError: 'integration'
2020-02-03 21:34:40.625921 WARNING controller_left_switch: ------------------------------------------------------------

an input from my apps.yaml:


hello_world:
module: hello
class: HelloWorld

ikea_light4:
module: controllerx
class: E1810Controller
sensor: sensor.0x000d6ffffe208165_action
light: light.0xccccccfffe622409_light

Toa_nere:
module: controllerx
class: E1743Controller
sensor: sensor.0xec1bbdfffeb45bcb_click
light: light.0xccccccfffead8483_light

Sovrum:
module: controllerx
class: E1743Controller
sensor: sensor.0xccccccfffe933296_click
light: group.sovrum

controller_left_switch:
module: controllerx
class: DoubleKeyWirelessAqaraController
controller: sensor.0x00158d00027bfbff_click
light: light.0x90fd9ffffe2a654f_light
manual_steps: 4

i have suddenly starting to receive errors from the "toa nere", "sovrum" and the "ikea_light4" also. didnt receive any errors before. the "sovrum can maybe be explained with a lamp that is turned to off but not the other ones

The new release replace sensor with controller and it adds a new parameter to indicate how the device is integrated (integration). So it should look like:

ikea_light4:
  module: controllerx
  class: E1810Controller
  controller: sensor.0x000d6ffffe208165_action
  light: light.0xccccccfffe622409_light
  integration: z2m

Toa_nere:
  module: controllerx
  class: E1743Controller
  controller: sensor.0xec1bbdfffeb45bcb_click
  light: light.0xccccccfffead8483_light
  integration: z2m

Sovrum:
  module: controllerx
  class: E1743Controller
  controller: sensor.0xccccccfffe933296_click
  light: group.sovrum
  integration: z2m

controller_left_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.0x00158d00027bfbff_click
  light: light.0x90fd9ffffe2a654f_light
  integration: z2m
  manual_steps: 4

now its starting to work. But the switch often thinks the "hold" is "single" now and dont dim the light, it turns them off. Is that hardware related or is it something you can fix you think?

Could you check the logs of z2m and see if the single click is send when the button is held?

hmm.... yes it looks it does that sometimes.

What about the double click?

it looks like the double sends "single" sometimes. heres the log

not exactly but 99% its one click single and one double and hold...
zigbee2mqtt:info 2020-02-03 22:01:25: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left_double"}'
zigbee2mqtt:info 2020-02-03 22:01:25: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:26: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":205}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":"left_double"}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left_double"}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:28: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:29: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left_double"}'
zigbee2mqtt:info 2020-02-03 22:01:29: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:30: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:33: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":"left_long"}'
zigbee2mqtt:info 2020-02-03 22:01:33: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:33: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:35: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:35: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:35: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"OFF","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:37: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:37: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:37: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:38: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:38: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:39: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"OFF","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:40: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:40: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:41: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:44: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left_double"}'
zigbee2mqtt:info 2020-02-03 22:01:44: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:44: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:46: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:46: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:46: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"OFF","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:48: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:48: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:49: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":255}'
zigbee2mqtt:info 2020-02-03 22:01:54: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":"left_long"}'
zigbee2mqtt:info 2020-02-03 22:01:54: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":49,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:54: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:56: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":55,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:56: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":55,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:57: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"OFF","brightness":192}'
zigbee2mqtt:info 2020-02-03 22:01:59: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":"left"}'
zigbee2mqtt:info 2020-02-03 22:01:59: MQTT publish: topic 'zigbee2mqtt/0x00158d00027bfbff', payload '{"battery":100,"voltage":3045,"linkquality":52,"click":""}'
zigbee2mqtt:info 2020-02-03 22:01:59: MQTT publish: topic 'zigbee2mqtt/0x90fd9ffffe2a654f', payload '{"state":"ON","brightness":192}'

Would it be possible for you to send a video (maybe WeTransfer or my email xaviml.93( a t )gmail.com) showing the controller and the light? If it's not too stable, I will not integrate this on the release. However, I am also working on a custom controller that users will be able to custom their controllers through the apps.yaml.

Of course. think the mail would be the easiest way. i can share a video with you.

But how do you mean with the controller and the light. do you want me to record when im pushing the controller?

Yes, I would like to see the action you do and how the light reacts. So focus the controller and show the light in the background maybe. Thanks!

it will be hard to show those in the same picture but i will do the best as i can or fix it in some other way.

thank you so very much, this helps me alot.
I would buy you a beer in sweden :)

Hi

I think its working pretty good now.
But now its controlling the same light with both buttons. is there a way to change that. The right button would be nice to handle via the automations.yaml. because the right one is going to have the config:

Right click - toggle a switch (no dimming)
Right double - toggle another lamp
Right hold - toggle another lamp.

Both click - state ON the "left click" and the right click
Both double - sate OFF the left click and the right click
Both hold - not in use at the moment.

is this possible. I can control it in automations and the controllerx just uses the left button. Can the left button control 3 lights?

Hi

I am glad that it works better now. For that specific use of the switch, I would recommend you to do it through custom controller, but that is not implemented yet.

Regarding the case that the three buttons work, it is a bug that needs to be fixed on my side and then you will be able to use the yaml config I gave you.

Can the left button control 3 lights?

Yes, you can create a group of lights through HA and instead of passing the light entity on the "light" parameter, you can pass the entity group id.

I will keep you updated with the fixed bug so you can use just the left one.

thanks alot. i will be waiting.
After the last update my E1743CONTROLLER dont work with dimming (change brightness) anymore. Just toggle on/off.

Can I see the configuration on apps.yaml? And did it use to work with the same configuration?

I just tried the E1743Controller with z2m and I don't see any problems, My configuration is the following:

test_controller:
  module: controllerx
  class: E1743Controller
  controller: sensor.your_sensor_click
  integration: z2m
  light: light.light1

Hi again, the bug related to actions parameter is now fixed and it's on the v2.2.0b4. You can try now the following configuration:

controller_left_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id>
  light: light.light1
  integration: z2m
  manual_steps: 7
  actions:
  - left
  - left_double
  - left_long

controller_right_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id>
  light: light.light2
  integration: z2m
  manual_steps: 7
  actions:
  - right
  - right_double
  - right_long

controller_both_switch:
  module: controllerx
  class: DoubleKeyWirelessAqaraController
  controller: sensor.<your sensor_id>
  light: light.light3
  integration: z2m
  manual_steps: 7
  actions:
  - both
  - both_double
  - both_long

Then each switch will manage a different light. Let me know if you try it.

Hi.

Im away at work for two days but i will try it as soon as im coming home and i will report back to you. thank you for the fast work.

Yes it used to work, im thinking if this maybe an issue; i have it as a group and one of the lights it temporarily disconnected so its always off, maybe thats why?

Then another question, the remotes feels like they are going to sleep if you dont uses them and then you have to wake them up by pushing a button a couple of times (nothing works when you do this) then wait a couple of seconds and then it works for normal again. Is there a way to remove this?

//Christoffer

Hi @Sluden

No worries, I am working on the documentation before I release the code, so you have time to try. That could be the problem. Probably the light that doesn't work is the first one in the list group and this is why it does not change the brightness. Try to connect it to the light that it works and see if the controller works and then you can try to change the group and put the light that works in the first place.

Then another question, the remotes feels like they are going to sleep if you dont uses them and then you have to wake them up by pushing a button a couple of times (nothing works when you do this) then wait a couple of seconds and then it works for normal again. Is there a way to remove this?

This is because of the zigbee protocol. Each end device (e.g. the controllers) is connected to a router (smart plug, lights, ...) or coordinator. If the router or coordinator is down or far away (it cannot be reached) when the controller needs to communicate its state, then it tries to finds for another router or coordinator and while this happens you notice that the controller does not work until it finds another path to communicate the state. The recommendation is to not move the controller far away from where it normally is and not to leave the router that is connected to without power.

Hi.

Tried to try the new changes. it seems to work. The "left" now controlles the one i want and the right is controlled via the automations.yaml. will try to add to apps.yaml just to try.

Thank you thank you

//Christoffer

I just released v2.2.0 with this device added on it.

Was this page helpful?
0 / 5 - 0 ratings