Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Aqara T1 wireless mini switch lumi.remote.b1acn02 #2871

Merged
merged 15 commits into from
Aug 11, 2024

Conversation

muller119
Copy link
Contributor

@muller119 muller119 commented Dec 29, 2023

still missing some button presses

dont know how to add those

B1ACN01_HOLD = 0
single =1
double =2
tripple =3
quintuple = 5
B1ACN01_RELEASE = 255
many presses = 6

i added the 1, 2, 255, 0 id's
next still todo is 3 and 6

Proposed change

Additional information

Fixes #2809
Addresses home-assistant/core#103265

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

still missing some button presses

dont know how to add those

B1ACN01_HOLD = 0
single =1
double =2
tripple =3
quintuple = 5
B1ACN01_RELEASE = 255
many presses = 6

i added the 1, 2, 255, 0 id's
next still todo is 3 and 6
Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.19%. Comparing base (d87f445) to head (8b0ec17).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #2871   +/-   ##
=======================================
  Coverage   88.18%   88.19%           
=======================================
  Files         301      301           
  Lines        9412     9416    +4     
=======================================
+ Hits         8300     8304    +4     
  Misses       1112     1112           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@muller119
Copy link
Contributor Author

@TheJulianJES if youre have some time can you take a look?

@TheJulianJES TheJulianJES changed the title Update sensor_switch_aq3.py Add Aqara T1 wireless mini switch lumi.remote.b1acn02 Dec 30, 2023
Comment on lines 69 to 72
def __init__(self, *args, **kwargs):
"""Init."""
self._current_state = None
super().__init__(*args, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed

@TheJulianJES
Copy link
Collaborator

still missing some button presses
dont know how to add those

Can you listen to zha_event in the developer tools and post the content of what you get for the missing button presses here?

@TheJulianJES TheJulianJES added the Xiaomi Request/PR regarding a Xiaomi device label Dec 30, 2023
@muller119
Copy link
Contributor Author

muller119 commented Dec 31, 2023

still missing some button presses
dont know how to add those

Can you listen to zha_event in the developer tools and post the content of what you get for the missing button presses here?

still missing some button presses
dont know how to add those

Can you listen to zha_event in the developer tools and post the content of what you get for the missing button presses here?

ok here are the button presses

single press:

event_type: zha_event
data:
  device_ieee: 54:ef:44:10:00:92:45:22
  unique_id: 54:ef:44:10:00:92:45:22:1:0x0012
  device_id: 837a257704ab9d4867023fd954e93d33
  endpoint_id: 1
  cluster_id: 18
  command: single
  args:
    value: 1
  params: {}
origin: LOCAL
time_fired: "2023-12-31T09:27:16.409569+00:00"
context:
  id: 01HJZK5WNS741C5BZ4S1N6X79G
  parent_id: null
  user_id: null

double press

event_type: zha_event
data:
  device_ieee: 54:ef:44:10:00:92:45:22
  unique_id: 54:ef:44:10:00:92:45:22:1:0x0012
  device_id: 837a257704ab9d4867023fd954e93d33
  endpoint_id: 1
  cluster_id: 18
  command: double
  args:
    value: 2
  params: {}
origin: LOCAL
time_fired: "2023-12-31T09:27:38.593009+00:00"
context:
  id: 01HJZK6JB112N6VPSJ71S0EQBX
  parent_id: null
  user_id: null

long press

event_type: zha_event
data:
  device_ieee: 54:ef:44:10:00:92:45:22
  unique_id: 54:ef:44:10:00:92:45:22:1:0x0012
  device_id: 837a257704ab9d4867023fd954e93d33
  endpoint_id: 1
  cluster_id: 18
  command: hold
  args:
    value: 0
  params: {}
origin: LOCAL
time_fired: "2023-12-31T09:27:56.482203+00:00"
context:
  id: 01HJZK73T2VJHP7MR8FVAY1PP7
  parent_id: null
  user_id: null

release

event_type: zha_event
data:
  device_ieee: 54:ef:44:10:00:92:45:22
  unique_id: 54:ef:44:10:00:92:45:22:1:0x0012
  device_id: 837a257704ab9d4867023fd954e93d33
  endpoint_id: 1
  cluster_id: 18
  command: release
  args:
    value: 255
  params: {}
origin: LOCAL
time_fired: "2023-12-31T09:27:59.416019+00:00"
context:
  id: 01HJZK76NRXR68CSDN96K0GPH3
  parent_id: null
  user_id: null

the tripple =3
and quintuple = 5
and many presses = 6

dont show up i think its not in the code but its shows up and the log of zha

like the arg value is behind the presses (3, 5, 6)

[0x512F:1:0x0012] Received ZCL frame: b'\x18I\nU\x00!\x03\x00'
[0x512F:1:0x0012] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=73, command_id=10, *direction=<Direction.Client_to_Server: 1>)
[0x512F:1:0x0012] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=3))])
[0x512F:1:0x0012] Received command 0x0A (TSN 73): Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=3))])
[0x512F:1:0x0012] Attribute report received: present_value=3

[0x512F:1:0x0012] Received ZCL frame: b'\x18K\nU\x00!\x05\x00'
[0x512F:1:0x0012] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=75, command_id=10, *direction=<Direction.Client_to_Server: 1>)
[0x512F:1:0x0012] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=5))])
[0x512F:1:0x0012] Received command 0x0A (TSN 75): Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=5))])
[0x512F:1:0x0012] Attribute report received: present_value=5

[0x512F:1:0x0012] Received ZCL frame: b'\x18L\nU\x00!\x06\x00'
[0x512F:1:0x0012] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True), tsn=76, command_id=10, *direction=<Direction.Client_to_Server: 1>)
[0x512F:1:0x0012] Decoded ZCL frame: MultistateInputCluster:Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=6))])
[0x512F:1:0x0012] Received command 0x0A (TSN 76): Report_Attributes(attribute_reports=[Attribute(attrid=0x0055, value=TypeValue(type=uint16_t, value=6))])
[0x512F:1:0x0012] Attribute report received: present_value=6

i hope you have all the info you need

@koen860
Copy link

koen860 commented Feb 13, 2024

Hey,

Just curious, is there an update on this? I've also got the newer version of this switch so if I need to test something, let me know.

@stegitto
Copy link

Same issue here... :(

@ngama75
Copy link

ngama75 commented Mar 22, 2024

Tested this quirk with the two additional changes proposed by @WilliamOConnell, it works like a charm!

@mcweba
Copy link

mcweba commented Apr 2, 2024

Tested this quirk with the two additional changes proposed by @WilliamOConnell, it works like a charm!

When will this quirk be merged and released?

@muller119
Copy link
Contributor Author

@TheJulianJES can you take a look what is needed to pass the test??? to be merged

@snuf1991
Copy link

Any updates?
Thank you! 🙏

@toogooda
Copy link

These are used by so many people I hope it can merge soon

@sadowskipawel
Copy link

Any news when this can be merged and released?

@Slattoz
Copy link

Slattoz commented Jun 2, 2024

Good work here!! Thankyou for your efforts.

I tried the latest quirk code with my new lumi.remote.b1acn02 and it seemed to work partly.

Working
Single Press
Double Press
Batttery

Not working
Long Press
Firmware version

I can't seem to get long press working but the single press, double press are working and also the battery is working now too. That got me out of trouble but keen to get the long press working. Let me know if I can help test something.

@laurentiuonac
Copy link

Any update on this? I've just bought 4 such switches and can't use them. Thank you for your great effort, guys!

I have downloaded and configured this code as a local ZHA quirk in HA and it works perfectly. Maybe u can do the same instead of waiting for official release?

Got it, thanks for pointing this out, I'll try it as well.

@alfista2600
Copy link

for a time-strapped interested party, what file do you need to edit and what do you need to add? Will give it a try and report back as well.

@kbhsn4
Copy link

kbhsn4 commented Jul 18, 2024

I have the 'SwitchAQ3B2' model. I added the file to my custom quirks folder, and my button works as expected now (short press, double press, long press and long press release triggers).

Great work! Somebody please merge this.

@reineo
Copy link

reineo commented Jul 18, 2024

for a time-strapped interested party, what file do you need to edit and what do you need to add? Will give it a try and report back as well.

Follow instructions online, i.e https://community.home-assistant.io/t/how-to-setup-local-zha-quirks/341226
Then add the python file from this branch to the specified directory (https://github.com/zigpy/zha-device-handlers/pull/2871/files)

@alfista2600
Copy link

Appreciate it, @reineo - being new to HA it would have taken me a good bit of effort to unravel this, but it looks pretty straightforward with your link.

zhaquirks/xiaomi/aqara/sensor_switch_aq3.py Outdated Show resolved Hide resolved
zhaquirks/xiaomi/aqara/sensor_switch_aq3.py Outdated Show resolved Hide resolved
zhaquirks/xiaomi/aqara/sensor_switch_aq3.py Outdated Show resolved Hide resolved
zhaquirks/xiaomi/aqara/sensor_switch_aq3.py Outdated Show resolved Hide resolved
zhaquirks/xiaomi/aqara/sensor_switch_aq3.py Outdated Show resolved Hide resolved
@muller119
Copy link
Contributor Author

muller119 commented Jul 19, 2024

@TheJulianJES thnx for the review anyone wants to test the following changes? i will try it too but i dont have much experience if it works ill wil chance the code and test it myself

@muller119
Copy link
Contributor Author

@TheJulianJES can you check why it fails on the test so we can fix it?? i adjusted the code

@muller119
Copy link
Contributor Author

muller119 commented Jul 19, 2024

anyone else can test the code i adjusted it tested it and also paired the device several times

@TheJulianJES
Copy link
Collaborator

Sorry, ignore the test failure for now. You can test it locally, but we'll try and fix it soon.
Just been quite busy.

@kbhsn4
Copy link

kbhsn4 commented Jul 20, 2024

I've tested the new code. I joined a fresh AQ3B2 device, and everything seems to work as expected. All four events are reported (single, double and long press and release). Battery is reported (100%) and the 'identify' functions works. Firmware is reported (0x00000020), but I have no way of verifying that that's correct.

@edgegit
Copy link

edgegit commented Aug 4, 2024

Tested the quirk. Working as expected. The blueprint I (and many others) used for all previous versions of the Aqara button does not detect the new device. Instead, it is recommended to use a native automation based approach, as described in this post.

Copy link
Collaborator

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing and this should be good to go IMO.

@TheJulianJES TheJulianJES added the smash This PR is close to be merged soon label Aug 4, 2024
@muller119
Copy link
Contributor Author

muller119 commented Aug 7, 2024

can anyone test the new file it works on my end

Copy link
Collaborator

@TheJulianJES TheJulianJES left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, should work fine.
Thanks again!

@TheJulianJES TheJulianJES added the ready PR should be ready to merge label Aug 7, 2024
@TheJulianJES TheJulianJES merged commit ce63e58 into zigpy:dev Aug 11, 2024
6 checks passed
@harley-codes
Copy link

Could somebody please advise if these changes will make its way into the next update for HA Core?

@ldumont
Copy link

ldumont commented Aug 20, 2024

They are in 2024.8.2 and work perfectly for me!

@DvdEnde
Copy link

DvdEnde commented Aug 29, 2024

It works great now. Thank you for your efforts to get this fixed!

@edgegit
Copy link

edgegit commented Aug 29, 2024

So I just need to remove my quirks for this and all good? Nothing more to do?

@Rhidus
Copy link

Rhidus commented Sep 1, 2024

Hi all, thanks for your efforts!

Unfortunately, for me, my lumi.remote.b1acn02 device is still not working as expected, although I am now on 2024.8.3 of HA Core and re-paired my device. I had already paired my device when this quirk was not available yet, in case that may be relevant.

What I did:

  1. Remove currently paired device.
  2. Restart Home Assistant + host system (RP4).
  3. Enable debug logging on ZigBee coordinator (Conbee III)
  4. Pair my device.
  5. Disable debug logging -> pairing_lumi-remote-b1acn02_home-assistant_zha_2024-09-01T13-00-08.023Z.log

I now have the new device "LUMI lumi.remote.b1acn02" in my device list.

Observations regarding log on device page:

  • The device's log still shows the events from before I removed it. (Probably because some device ID is still matching?)
  • When I press the button once, the log shows an entry "LUMI lumi.remote.b1acn02 Toggle event was fired".
  • When I press and hold the button, the log also shows an entry "LUMI lumi.remote.b1acn02 Toggle event was fired" (after 1 second or so of holding the button).
  • When I double press the button, the log shows an entry "LUMI lumi.remote.b1acn02 Off event was fired" (which sounds strange).
  • I am not able to produce different log messages.

Observations regarding automations:

  • In general, I cannot get any automation to work with this device.
  • When I create a new automation from the device page, the available trigger events have strange names. They are called (see image below)
    • "remote_button_short_press" pressed
    • "remote_button_double_press" double clicked
    • "remote_button_long_press" continuously pressed
    • "remote_button_long_release" released after long press
      lumi-remote-b1acn02_events-for-automation_pad
  • I recently had the chance to test the previous version of the Aqara mini switch (which worked fine); and I think there, the names were all "clean" (e.g. "Button has been pressed once", but I do not remember the exact wording)
  • I created an automation to toggle a light (which worked with the other mini switch). But nothing happens with the lumi.remote.b1acn02.
    • It seems the automation is never triggered (there are no traces after I press the button).
    • (If I run the automation manually from the UI, the light toggles as expected.)

For debugging, I

  1. enabled debug logging again,
  2. pressed the button (short),
  3. double-pressed button,
  4. pressed the button (long),
  5. and disabled debug logging. -> pressing_lumi-remote-b1acn02_home-assistant_zha_2024-09-01T13-27-07.373Z.log

Does anyone have an idea what's missing or what I am doing wrong? Let me know what information/logs I can provide to help. Also, if this questions should better be moved to a new issue, please let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR should be ready to merge smash This PR is close to be merged soon Xiaomi Request/PR regarding a Xiaomi device
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Device Support Request] lumi.remote.b1acn02