dresden-elektronik / deconz-rest-plugin

deCONZ REST-API plugin to control ZigBee devices
BSD 3-Clause "New" or "Revised" License
1.9k stars 502 forks source link

Aqara Wireless Remote Switch H1 (Double Rocker) #4842

Closed tomillr closed 3 years ago

tomillr commented 3 years ago

Device

Screenshots

Bildschirmfoto 2021-05-06 um 12 26 51

Bildschirmfoto 2021-05-06 um 12 28 11

Bildschirmfoto 2021-05-06 um 12 26 05

tomillr commented 3 years ago

Anything I can do to help getting this devices integrated? Can I send you one of those switches perhaps?

Aqara is about to release a bunch of new Zigbee 3.0-version of their popular switches and sensors btw.

netnetaip commented 3 years ago

I'm also intrested to see H1 switch integrated in ConBee II or RaspBee II devices

SwoopX commented 3 years ago

You guys might want to give the latest firmware a try (http://deconz.dresden-elektronik.de/deconz-firmware/beta), since it has some new builtin specialties for Xiaomi. We recently discovered that the latest Xiaomi's require the coodinator to have a Xiaomi manufacturer code to eventually reveal their full set of clusters, which I feel is the case here. This is too less for a dual rocker.

With the new FW, please also make sure to reset and re-pair the device and push all buttons a couple of times while device search is running.

tomillr commented 3 years ago

Ok, so I've updated my Conbee 2 stick to the latest beta firmware andsetup a completely new and clean test system. I've only connect a single INNR smart plug as well as the Aqara H1 Wireless Double Rocker:

Bildschirmfoto 2021-05-21 um 10 47 58

Bildschirmfoto 2021-05-21 um 11 33 52

For the Aqara H1 decenz gui now presents me some additional values, which were previously missing (like the manufacture name):

Bildschirmfoto 2021-05-21 um 11 35 44

SwoopX commented 3 years ago

Have you also pushed both buttons simultaneously? I'd expect to also have an endpoint 02. Cyn you also please check if meanwhile the lumi specific cluster FCC0 has occurred?

tomillr commented 3 years ago

Have you also pushed both buttons simultaneously? I'd expect to also have an endpoint 02.

Yes, I've pushed both buttons in different combinations and length. Where should I look for endpoint 02 in the Devons GUI btw?

SwoopX commented 3 years ago

ok, 2nd screenshot of your last post. Would you be able to compile the plugin for testing?

tomillr commented 3 years ago

ok, 2nd screenshot of your last post.

So basically every possible button (left, right, left+right) should show up as its own section like "01" and "03" shown here?

Bildschirmfoto 2021-06-02 um 16 57 02

Would you be able to compile the plugin for testing?

Never done this before, but I'd gladly give it a try. Do you have some kind of guide I can work with?

SwoopX commented 3 years ago

Sure, can do. I just need 1-2 days more as I want to pass you a nice experimental gimmick to sniff the communication :wink:

tomillr commented 3 years ago

Played around with those switches a bit more and tried to connect them to a SmartThings Hub as well.

I've noticed, that the switch seems to automatically connect itself to a random Zigbee light or smart plug. This also happens when there's no Zigbee Hub connect at all and I've manually reset every device beforehand.

Could it be, that the new Aqara H1 switches are by default configured to establish a direct connection to the light source. Similar to how those TRΓ…DFRI remotes from Ikea come pre-connected to the Zigbee light bulb and work without the need for a Zigbee hub?

SwoopX commented 3 years ago

Alright, so the first code to test is ready. Please find the instructions how to compile below

git clone --branch=h1 https://github.com/swoopx/deconz-rest-plugin.git h1       # Clone repository
cd ./h1
qmake && make -j2                                                               # Compile
sudo systemctl stop deconz                                                      # Stop deCONZ headless (in case it is running)
sudo systemctl stop deconz-gui                                                  # Stop deCONZ GUI (in case it is running)
sudo cp /usr/share/deCONZ/plugins/libde_rest_plugin.so /usr/share/deCONZ/plugins/bak_libde_rest_plugin.so  # Make plugin backup
sudo cp ../libde_rest_plugin.so /usr/share/deCONZ/plugins/                      # Copy newly compiled plugin to deCONZ plugin folder
/usr/bin/deCONZ --dbg-info=2 --dbg-error=2 > h1_debug                           # Run deCONZ with GUI and debug output

Please make sure to collect around 15 mins of debug data and reset and re-pair the device as very first action. Also, be sure to try out all thinkable combination of presses (single, double, tripple, hold) for each button. When done, please share the created file h1_debug from the h1 folder.

If required, you can restore the original plugin after deCONZ has been closed:

sudo cp /usr/share/deCONZ/plugins/bak_libde_rest_plugin.so /usr/share/deCONZ/plugins/libde_rest_plugin.so

and start deCONZ again in ONE preferred mode

sudo systemctl start deconz              # Start deCONZ headless
sudo systemctl start deconz-gui          # Start deCONZ GUI

Could it be, that the new Aqara H1 switches are by default configured to establish a direct connection to the light source. Similar to how those TRΓ…DFRI remotes from Ikea come pre-connected to the Zigbee light bulb and work without the need for a Zigbee hub?

Yes, kind of. If appropriately configured, switches can control lights, etc. directly without the need of a coordinator. Switches typically get predefined groups they send their commands to. If the to be controlled devices subscribes to that group, the coordinator is not required any more.

It could be that the switch has also an alternate mode of operation. Maybe the generated debug output gives some hints about that.

SwoopX commented 3 years ago

Ah, you're missing the deconz dev package.

sudo apt-get install deconz-dev should do the trick.

Qtcreator is a bit too much, but ok πŸ˜„

tomillr commented 3 years ago

So, I've finally managed to setup a new Debian environment and try compiling you plugin. Provided I followed your instruction correctly, I wasn't able to have the switch join the the newly setup network. Maybe the log can provide some details:

https://pastebin.com/KJMZzGdV

First, I manually reset the H1 switch a couple of times and tried to pair it using the Phoscon webapp. After that didn't work, I tried to pair a INNR smart plug to check the connection with the Conbee 2 stick, which didn't show up also.

Maybe I can just have you send you one of the actually switches? Might that help?

https://www.amazon.de/WRS-R02-WIRELESS-REMOTE-SWITCH-version/dp/B094QL17GY/

SwoopX commented 3 years ago

Lemme check what you shared. I recall we recently had quite some strange reports that devices "refuse" to join. Interestingly, a restart of deconz seems to let the device appear automagically.

tomillr commented 3 years ago

@SwoopX Thanks, let me know if you need any further data.

tomillr commented 3 years ago

I've done some more testing and even got out my old Smart Thing v3 hub. But no matter what I try, the switch always seems to only establish a connection to a Zigbee 3.0 light source and not the hub itself.

For example, when using the h1 switch with the SmartThings hub, the hub doesn't detect the presence of the switch at all. Instead it automatically pairs itself to all the Zigbee 3.0 lights. So basically same behavior as when using a setup with the Conbee stick.

SwoopX commented 3 years ago

Ping me on Discord if you quickly wanna send one over πŸ˜‰

MiAutomations commented 3 years ago

Hello Team

Any news about the support of this device in the deconz plugin available on the HA Home Assistant once the device is not yet supported deCONZ Current version: 6.9.0

image

Thank you and best regards

SwoopX commented 3 years ago

This question was more a joke, right? πŸ˜„

MiAutomations commented 3 years ago

This question was more a joke, right? πŸ˜„

No, it's only to check if you have a ideia about when this is available on the deconz plugin on the HA ...

SwoopX commented 3 years ago

Support is now included in the code since 1 hour, so its generally usable if you compile the plugin yourself. I'd expect the next beta to be officially release within the next 7 days. I don't know when the next stable is planned. I guess HA just prefers to use stable versions in the addon (where we have no stakes in).

MiAutomations commented 3 years ago

Support is now included in the code since 1 hour, so its generally usable if you compile the plugin yourself. I'd expect the next beta to be officially release within the next 7 days. I don't know when the next stable is planned. I guess HA just prefers to use stable versions in the addon (where we have no stakes in).

Ok thank you for the information and for your support !! But once all must the people is using the deconz conbee II over the HA and once the people is using the HassOS and it's not possible to "compile" over this OS ... I think it's the best decrease this time or create a alternative in order to make this available for more users ...

Thank you and best regards

SwoopX commented 3 years ago

Well, I agree that it will probably make ppl happier, but's that's absolutely not in our hands. You need to suggest that to HA folks maintaining the addon, I'm afraid.

oudoulj commented 1 year ago

I run Hassio with a Conbee 2 stick and Deconz. My Conbee gateway version : 2.19.03 / 19/09/2022 and its firmware : 26780700

Screenshot - 14_01_2023 , 18_48_02

Pairing of the Aqara wireless double-rocker switch WRS-R02 aka H1 went smoothly.

I can catch the various deconz_event in the Developer Tools / Events of HA (single, double, long clicks on both buttons) but the automation screen does not expose those events for me to choose from. Only the "Battery level changes" trigger 😒 Am I missing something obvious here ?

Screenshot - 14_01_2023 , 15_38_43

More info and screenshots on the HA community. Thanks in advance for your help ! πŸ™

Mimiix commented 1 year ago

I run Hassio with a Conbee 2 stick and Deconz. My Conbee gateway version : 2.19.03 / 19/09/2022 and its firmware : 26780700

Screenshot - 14_01_2023 , 18_48_02

Pairing of the Aqara wireless double-rocker switch WRS-R02 aka H1 went smoothly.

I can catch the various deconz_event in the Developer Tools / Events of HA (single, double, long clicks on both buttons) but the automation screen does not expose those events for me to choose from. Only the "Battery level changes" trigger 😒 Am I missing something obvious here ?

Screenshot - 14_01_2023 , 15_38_43

More info and screenshots on the HA community. Thanks in advance for your help ! πŸ™

Please check the deCONZ integration documentation . It's explained there.

oudoulj commented 1 year ago

Please check the deCONZ integration documentation . It's explained there.

Can you please point me to a specific link ? Because I've been googling for a while and couldn't find anything relevant, thank you very much. _(I was able to find a workaround using the deconzevent as a trigger but it's not super straightforward)

Mimiix commented 1 year ago

That's what I'm referring to : the event triggers.

If there's no triggers like you describe you want , home assistant needs to add support for that. We can't do that.

oudoulj commented 1 year ago

deCONZ integration documentation

Ok, thank you. It's just that for such a popular and 2-year old switch, I thought it would have been supported in a more user-friendly way already (like my Aqara WXKG02LM) so I thought I was the one doing something wrong :wink:

Mimiix commented 1 year ago

As far as i know, not a lot of devices are supported that way in home assistant. Nevertheless: it's really something home assistant needs to do

yungSven commented 1 year ago

Same Issue here

oudoulj commented 1 year ago

Same Issue here

I used this method. Not super straightforward but works fine. https://community.home-assistant.io/t/aqara-h1-button-press-not-triggering-automation/389498/15?u=jeromeo