Comments (12)
Congrats on issue #1 ;) Homebridge has been a bit hit and miss so far. It does some stuff I know real HomeKit devices dont (like sending empty events as keep alives even when you havent turned push on at all). Did have a report of it working earlier today though.
I need you to modify your local copy of aiohomekit/http/response.py
so that we can see whats in the buffer. Maybe something like this? https://gist.githubusercontent.com/Jc2k/c89e30fdc112b2329b12609bff8a9e07/raw/bee6b2950da45087addc7a8ffec5e3e1799e0a48/response.py
from aiohomekit.
Sorry for the delay, it has been a thoroughly weird week. I'll get this applied and report back.
from aiohomekit.
Is this the right URL? There's no diff between this and the version on master.
from aiohomekit.
Oops! Lets try again. I think I mean this one but it's been a few days so I can't really remember what i was thinking...
from aiohomekit.
Here's the full startup log and me toggling the light off and on again at the end: https://paste.sr.ht/~vilhalmer/0a683c69d361fe16f13db811fbabc419429551bc
With the patch the traceback doesn't appear, but it still appears to be polling the state.
In case it's useful, the accessory is using this homebridge plugin: https://github.com/AMoo-Miki/homebridge-tuya-lan at tag 1.5.0-rc.12.
from aiohomekit.
So that is a slightly older version of the parser - I suspect the bug was introduced trying to handle some devices that were returning HTML without setting a content-size
. (They shouldn't be returning HTML full stop). Let me plug your responses into the test harness and see if they break master. If that doesn't i'll have to instrument the latest version of the parser and get you to try that.
Polling is expected at this stage. I expected some devices to claim to support events but then utterly fail. So at the moment events are on top of polling. The plan is to stabilise things then maybe reduce the frequency of some things getting polled.
Thanks for like to plugin. I don't know enough homebridge for it to help, but it will be interesting to track which plugins work and how well they work in the long run.
from aiohomekit.
Reproduced it with this payload:
2020-03-29 17:57:54 DEBUG (MainThread) [aiohomekit.http.response] parse: bytearray(b'HTTP/1.1 207 Multi-Status\r\nContent-Type: application/hap+json\r\nDate: Sun, 29 Mar 2020 21:57:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n33\r\n{"characteristics":[{"aid":2,"iid":10,"status":0}]}\r\n0\r\n\r\nHTTP/1.1 207 Multi-Status\r\nContent-Type: application/hap+json\r\nDate: Sun, 29 Mar 2020 21:57:54 GMT\r\nConnection: keep-alive\r\nTransfer-Encoding: chunked\r\n\r\n33\r\n{"characteristics":[{"aid":2,"iid":10,"status":0}]}\r\n0\r\n\r\n')
from aiohomekit.
Can you try replacing your /usr/local/lib/python3.7/site-packages/aiohomekit/http/response.py
with the one from master?
from aiohomekit.
This seems to fix it!
However, when controlling the accessory the state still doesn't update until the next poll interval. I was hoping that the parsing issue was preventing it from setting up events and thus falling back to polling, but maybe homebridge isn't advertising support or similar? (This discussion can go elsewhere if it would make more sense.)
from aiohomekit.
There are 2 possibilities where this is a problem on the HA side:
- The characteristic doesn't advertise event support, so we don't turn it on
- Subscribing fails so events get disabled until restart. There would be a log message if this had happened though.
Looking at the logs you sent previously I can see we do try to enable events for characteristic 10 of accessory 2 only. homebridge
says this worked. We never see it push any data, though.
Do you have an ios device? That would be the quickest way to tell if this is still something I can help with. Or can you verify with wireshark/tcpdump that the Tuy API pushes something to homebridge when something changes?
from aiohomekit.
I do have iOS, I'll try pairing directly and see which side this is on. I'll open a new issue (or a PR maybe!) if appropriate. Thanks for your assistance, happy to get the traceback resolved either way! :)
from aiohomekit.
Brilliant @vilhalmer! Thanks for your help tracking this exception down. Good luck and don't hesitate to reach out if you have any more problems.
from aiohomekit.
Related Issues (20)
- Sleepy Thread devices HOT 8
- Avoid BlueZ mtu warning by setting `_mtu_size`
- Always subscribe to all available encrypted notifications
- Characteristics for Fibaro Wall Plug (Homekit version)
- Slow response and warn logs for Nuki HOT 5
- Don't fetch programmable switch events on reconnect without getting a GATT notify for them HOT 5
- There is a race where we can be waiting for the device to be detected at startup and we get it more than once because we don't clear it before its detected again
- Fetching friendly_name does a linear search
- Using aiohomekit standalone: transport not supported HOT 2
- Eve Degree: Various BLE errors HOT 1
- asyncio.exceptions.TimeoutError during zeroconf search needs to be re-raised as AccessoryNotFoundError
- Log says "pairing established" but any interaction throws "is no known alias" HOT 4
- `first` to get accessory_info at startup is unexpectedly expensive
- Connection refused HOT 2
- BLE Pairing can fail due to race
- BLE callbacks can error if a device is unpairing because the cache has been deleted
- Missing Service cache clear is missing from pairing process
- Many callback to Called async_set_available_state with True at startup HOT 1
- Video & Intercom Doorbell in HA HOT 6
- BLE Events might still be read when processing disconnected notifications
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiohomekit.