Code Monkey home page Code Monkey logo

Comments (12)

Jc2k avatar Jc2k commented on June 12, 2024

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.

vilhalmer avatar vilhalmer commented on June 12, 2024

Sorry for the delay, it has been a thoroughly weird week. I'll get this applied and report back.

from aiohomekit.

vilhalmer avatar vilhalmer commented on June 12, 2024

Is this the right URL? There's no diff between this and the version on master.

from aiohomekit.

Jc2k avatar Jc2k commented on June 12, 2024

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.

vilhalmer avatar vilhalmer commented on June 12, 2024

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.

Jc2k avatar Jc2k commented on June 12, 2024

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.

Jc2k avatar Jc2k commented on June 12, 2024

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.

Jc2k avatar Jc2k commented on June 12, 2024

Can you try replacing your /usr/local/lib/python3.7/site-packages/aiohomekit/http/response.py with the one from master?

from aiohomekit.

vilhalmer avatar vilhalmer commented on June 12, 2024

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.

Jc2k avatar Jc2k commented on June 12, 2024

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.

vilhalmer avatar vilhalmer commented on June 12, 2024

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.

Jc2k avatar Jc2k commented on June 12, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.