Hello everyone,
I’m happy to finally get Bluetooth integrated into home assistant… this may help me to completely get rid of HomeKit/appletv.
I currently have two Bluetooth devices… one Schlage sense lock and one 1st gen eve room.
I’ll try to add my lock latter this week.
Tonight, I’m trying to add the eve room… but it’s not working.
It’s detected by home assistant. But when I try to add it, I get this error (sorry it’s in French)… it’s says something like unknown error when pairing. Temporary error or device not supported. I tried to reset the device again… same error.
I’m running home assistant on a mini intel pc.
Is the eve room supposed to be supported?
If yes, how can I make it work?
bdraco
(J. Nick Koston)
August 4, 2022, 3:33am
2
Please turn on debug logs for aiohomekit
and try again
I have exactly the same issue with EVE Room 1st Gen. HA OS, Raspberry PI4, onboard Bluetooth.
1 Like
here is the last part of the log… it looks like the device is no sending the key. it may need a specific integration like the august lock.
2022-08-04 06:47:59.358 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 446, in async_step_pair
pairing = await self.finish_pairing(code)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 132, in finish_pairing
pairing = await drive_pairing_state_machine(
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/client.py", line 213, in drive_pairing_state_machine
request, expected = state_machine.send(TLV.decode_bytes(response))
File "/usr/local/lib/python3.10/site-packages/aiohomekit/protocol/__init__.py", line 225, in perform_pair_setup_part2
raise InvalidError("M5: not an error or a proof")
aiohomekit.exceptions.InvalidError: M5: not an error or a proof
2022-08-04 06:47:59.463 DEBUG (MainThread) [aiohomekit.controller.ble.discovery] Ensure connected with device F2:4A:E1:1B:1C:07: Eve
2022-08-04 06:47:59.536 DEBUG (MainThread) [aiohomekit.controller.ble.client] Using fragment size: 147
2022-08-04 06:47:59.537 DEBUG (MainThread) [aiohomekit.controller.ble.client] Queuing fragment for write: b'\x00\x03Pu\x00'
2022-08-04 06:47:59.806 DEBUG (MainThread) [aiohomekit.controller.ble.client] Read fragment: bytearray(b'\x02P\x00\x03\x00\x01\x01\x01')
2022-08-04 06:47:59.806 DEBUG (MainThread) [aiohomekit.pdu] Got PDU 2: TID 50 (Expected: 50), Status:0, Len:3
2022-08-04 06:47:59.806 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
1: (1 bytes/<class 'bytearray'>) 0x01
]
2022-08-04 06:47:59.896 DEBUG (MainThread) [aiohomekit.protocol.tlv] sending [
6: (1 bytes/<class 'bytearray'>) 0x01
0: (1 bytes/<class 'bytearray'>) 0x01
]
2022-08-04 06:47:59.897 DEBUG (MainThread) [aiohomekit.controller.ble.client] Using fragment size: 147
2022-08-04 06:47:59.897 DEBUG (MainThread) [aiohomekit.controller.ble.client] Queuing fragment for write: b'\x00\x02\xb6v\x00\x0b\x00\t\x01\x01\x01\x06\x06\x01\x01\x00\x01\x01'
2022-08-04 06:48:00.166 DEBUG (MainThread) [aiohomekit.controller.ble.client] Read fragment: bytearray(b'\x02\xb6\x00\x05\x00\x01\x03\x07\x01\x01')
2022-08-04 06:48:00.166 DEBUG (MainThread) [aiohomekit.pdu] Got PDU 2: TID b6 (Expected: b6), Status:0, Len:5
2022-08-04 06:48:00.167 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
1: (3 bytes/<class 'bytearray'>) 0x070101
]
2022-08-04 06:48:00.167 DEBUG (MainThread) [aiohomekit.protocol.tlv] receiving [
7: (1 bytes/<class 'bytearray'>) 0x01
]
2022-08-04 06:48:00.167 ERROR (MainThread) [homeassistant.components.homekit_controller.config_flow] Pairing attempt failed with an unhandled exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/homekit_controller/config_flow.py", line 484, in async_step_pair
self.finish_pairing = await discovery.async_start_pairing(self.hkid)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/client.py", line 63, in _async_wrap
return await func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/discovery.py", line 121, in async_start_pairing
salt, pub_key = await drive_pairing_state_machine(
File "/usr/local/lib/python3.10/site-packages/aiohomekit/controller/ble/client.py", line 213, in drive_pairing_state_machine
request, expected = state_machine.send(TLV.decode_bytes(response))
File "/usr/local/lib/python3.10/site-packages/aiohomekit/protocol/__init__.py", line 132, in perform_pair_setup_part1
raise InvalidError("M2: Accessory did not send public key")
aiohomekit.exceptions.InvalidError: M2: Accessory did not send public key
Maran
August 4, 2022, 11:28am
5
is it the update of bluetooth as my iPhone was detected before if I was in the house, since the update I’m away however not moved since this morning?
bdraco
(J. Nick Koston)
August 7, 2022, 1:25am
6
The eve room showed up today. Unfortunately it paired right out of the box without any issues, but its not an older version.
I think we are going to need debug logs for
aiohomekit
and bleak
to see if we can figure out what is different.
Not problem for debug log of these two components.
anything specific I should look for or you want a complete copy of the core log as soon as pairing failed?
bdraco
(J. Nick Koston)
August 7, 2022, 2:42am
8
Just the log from the time you start pairing to when it fails is probably enough.
Hello,
Here is my attempt to pair an Eve Room 1. I’ve tried to filter only the eve device as bleak is quite verbose.
I had to use pastebin as the log is too big for posting. I hope the paste will be available quickly from moderation.
Thank you!
https://pastebin.com/ytP22XgW
here’s my log… there’s probably a lot more than what you are looking for…
https://controlc.com/797fa5cc
bdraco
(J. Nick Koston)
August 7, 2022, 6:15pm
12
Only tangentially related, but I noticed the pairing attempt is slow in the logs. These PRs should improve that but it won’t fix the issue here.
altdesktop:master
← bdraco:unmarshall_performance
opened 04:17AM - 03 Aug 22 UTC
This change reduces the overhead of unmarshalling with the
goal of having bleak… scanners not overwhelming the system.
See related issue:
https://github.com/hbldh/bleak/issues/236#issuecomment-789055069
```
(speed_up_unmarsh) % python3 bench/unmarshall.py
Unmarshalling 1000000 bluetooth rssi messages took 13.497067291998974 seconds
(master) % python3 bench/unmarshall.py
Unmarshalling 1000000 bluetooth rssi messages took 47.7756206660124 seconds
```
hbldh:develop
← bdraco:bluez_service_cache
opened 07:30PM - 06 Aug 22 UTC
If the device was previously connected and we have the
the service collection a… lready built, it can
be reused for the next connection if the device has not
since been removed from the bus when the dangerous_use_bleak_cache
flag is passed.
For devices that connect and disconnect frequently this
can make operations up to an magnitude faster once
the first connection has been made and the device
has not been removed from the bus since the last
connection.
In testing this significantly reduced the time it took to execute operations on Ble devices. The goal is to be able to quickly operate Bluetooth locks (and other similar devices)
bdraco
(J. Nick Koston)
August 7, 2022, 7:05pm
13
It looks like these devices have the older hardware coprocessor authentication which uses a different pairing method. In theory there is code in aiohomekit
to support this, but it seems that the device isn’t sending the public key so it fails. It doesn’t look like its something that is a quick fix.
I found a used gen1 on ebay so I’ll see if there is anything we can do once I have it in hand at the end of the week
1 Like
Thank you for your work on this issue with gen1 eve room!
When/if you find the solution, I guess this may help with other older device too.
I have most of the older eve devices: eve room, eve thermo, eve energy, eve door, eve weather all first gen and few others newer gen. I can do tests when required. Btw eve energy gives the same error when pairing.
bdraco
(J. Nick Koston)
August 8, 2022, 6:05pm
16
It could be repeated to https://github.com/Jc2k/aiohomekit/issues/136
I spent way to many hours looking for a bug in the srp code before I realized the mtu was wrong. Sadly they turned out to be asymmetric.
If someone with the device can enable debug logs for bleak and do a host reboot so we can the logs at startup time and then try to pair the eve device. we should be able to see what the actual mtu value is in the logs.
I can surely try this when I’m back home in a few hours.
you only need debug in bleak and not aiohomekit?
bdraco
(J. Nick Koston)
August 8, 2022, 7:04pm
18
Yes. bleak
only. It wouldn’t hurt to enable debug aiohomekit
as well though in case there just happens to be something that comes up that sheds more light on this issue
https://controlc.com/d934fcdf
here’s my home-assistant.log after boot and after trying to pair my eve room
default log set to warn. bleak and aiohomekit set to debug.
bdraco
(J. Nick Koston)
August 8, 2022, 10:46pm
20
2022-08-08 18:33:53.099 DEBUG (MainThread) [bleak.backends.bluezdbus.manager] received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesAdded (/): ['/org/bluez/hci0/dev_C2_EB_3B_22_6B_82/service3000/char3040', {'org.freedesktop.DBus.Introspectable': {}, 'org.bluez.GattCharacteristic1': {'UUID': <dbus_next.signature.Variant ('s', 0000004e-0000-1000-8000-0026bb765291)>, 'Service': <dbus_next.signature.Variant ('o', /org/bluez/hci0/dev_C2_EB_3B_22_6B_82/service3000)>, 'Value': <dbus_next.signature.Variant ('ay', b'')>, 'Flags': <dbus_next.signature.Variant ('as', ['read', 'write'])>, 'MTU': <dbus_next.signature.Variant ('q', 158)>}, 'org.freedesktop.DBus.Properties': {}}]
Well its not the MTU, but at least we can cross that problem off the list.
We just added some more logging into aiohomekit that might help tell us whats going on in 2022.8.3
home-assistant:dev
← bdraco:hkc_ble_bump
opened 07:53PM - 08 Aug 22 UTC
## Proposed change
<!--
Describe the big picture of your changes here to com… municate to the
maintainers why we should accept this pull request. If it fixes a bug
or resolves a feature request, be sure to link to that issue in the
additional information section.
-->
- Various fixes for BLE devices and logging imporvements
https://github.com/Jc2k/aiohomekit/compare/1.2.5...1.2.6
## Type of change
<!--
What type of change does your PR introduce to Home Assistant?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->
- [x] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [ ] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
## Additional information
<!--
Details are important, and help maintainers processing your PR.
Please be sure to fill out additional details, if applicable.
-->
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
## Checklist
<!--
Put an `x` in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->
- [ ] The code change is tested and works locally.
- [ ] Local tests pass. **Your PR cannot be merged unless tests pass**
- [ ] There is no commented out code in this PR.
- [ ] I have followed the [development checklist][dev-checklist]
- [ ] The code has been formatted using Black (`black --fast homeassistant tests`)
- [ ] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
If the code communicates with devices, web services, or third-party tools:
- [ ] The [manifest file][manifest-docs] has all fields filled out correctly.
Updated and included derived files by running: `python3 -m script.hassfest`.
- [ ] New or updated dependencies have been added to `requirements_all.txt`.
Updated by running `python3 -m script.gen_requirements_all`.
- [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
- [ ] Untested files have been added to `.coveragerc`.
The integration reached or maintains the following [Integration Quality Scale][quality-scale]:
<!--
The Integration Quality Scale scores an integration on the code quality
and user experience. Each level of the quality scale consists of a list
of requirements. We highly recommend getting your integration scored!
-->
- [ ] No score or internal
- [ ] 🥈 Silver
- [ ] 🥇 Gold
- [ ] 🏆 Platinum
<!--
This project is very active and we have a high turnover of pull requests.
Unfortunately, the number of incoming pull requests is higher than what our
reviewers can review and merge so there is a long backlog of pull requests
waiting for review. You can help here!
By reviewing another pull request, you will help raise the code quality of
that pull request and the final review will be faster. This way the general
pace of pull request reviews will go up and your wait time will go down.
When picking a pull request to review, try to choose one that hasn't yet
been reviewed.
Thanks for helping out!
-->
To help with the load of incoming pull requests:
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure
<!--
Thank you for contributing <3
Below, some useful links you could explore:
-->
[dev-checklist]: https://developers.home-assistant.io/docs/en/development_checklist.html
[manifest-docs]: https://developers.home-assistant.io/docs/en/creating_integration_manifest.html
[quality-scale]: https://developers.home-assistant.io/docs/en/next/integration_quality_scale_index.html
[docs-repository]: https://github.com/home-assistant/home-assistant.io