Code Monkey home page Code Monkey logo

Comments (3)

thoukydides avatar thoukydides commented on May 17, 2024

It's a tricky one...

Due to the API rate limits it is necessary to rely entirely on the event stream... so when the event stream is terminated there is a window where events may be lost and the state of the appliances can start to differ from what the plugin has cached. Hence, it is best to try and re-establish the event stream as quickly as possible to minimise potential issues. I therefore don't want to introduce any delays before trying to reconnect (other than where unavoidable due to the rate limits).

It is also an aspect of the API that has shown quite a few problems previously, some of them very intermittent and hard to reproduce. For this reason I am also reluctant to reduce the amount of information that is logged. Without logs of each connection attempt and its outcome I wouldn't have been able to diagnose and workaround some of the previous failure mechanisms.

I could possibly add a delay before retrying for this one specific error message. It probably won't ever be triggered again after today's outage, so that doesn't really seem worth it.

The only other idea I currently have is to implement a new log filtering mechanism, between the raw log messages and the Homebridge log facility. This would need to keep a history of recent log entries, identify duplicates of recent entries, and have rules for how frequently duplicates should be written to the log. However, it would take a reasonable amount of effort to do something worthwhile, and the danger is that it would make routine logs more difficult to analyse and interpret. Again, for something that is probably a one-off event it doesn't seem worth the effort.

from homebridge-homeconnect.

thoukydides avatar thoukydides commented on May 17, 2024

Checking my own server's log it looks more like this (because I run with debug enabled for my own plugins):

Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Starting events stream for all appliances
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Home Connect request #61992: STREAM https://api.home-connect.com/api/homeappliances/events
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Oven] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Induction Hob] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Dishwasher] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Home Connect request #61992: Service Temporarily Unavailable +102ms
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Terminated events stream for all appliances: Home Connect API error: Service Temporarily Unavailable
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Oven] Event STOP (0 items)
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Induction Hob] Event STOP (0 items)
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Dishwasher] Event STOP (0 items)
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Starting events stream for all appliances
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Home Connect request #61993: STREAM https://api.home-connect.com/api/homeappliances/events
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Oven] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Induction Hob] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Dishwasher] Events may have been missed; treating appliance as disconnected
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Home Connect request #61993: Service Temporarily Unavailable +105ms
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] Terminated events stream for all appliances: Home Connect API error: Service Temporarily Unavailable
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Oven] Event STOP (0 items)
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Induction Hob] Event STOP (0 items)
Oct 21 17:00:34 i7pc homebridge[30342]: [10/21/2020, 17:00:34] [HomeConnect] [Dishwasher] Event STOP (0 items)

For log message filtering to be useful in this case it wouldn't just need to check for an exact match in recent log messages, but it would need to be some form of fuzzy match due to the inclusion of the API request numbers and timings. Even less worth the effort...

from homebridge-homeconnect.

thoukydides avatar thoukydides commented on May 17, 2024

It looks like the API has been fine for the last hour.

Unless outages with this failure mode become a regular issue I am not going to do anything to reduce logging, so am closing this issue for now.

from homebridge-homeconnect.

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.