Giter VIP home page Giter VIP logo

Comments (20)

mikesalz avatar mikesalz commented on July 1, 2024

I am receiving the same error repeatedly, as well.

image

from alarmdotcom.

mikesalz avatar mikesalz commented on July 1, 2024

This error is really blowing up my logs. @elahd Do you happen to have any idea what the issue is? I'm happy to help test any potential fixes. Thanks!

from alarmdotcom.

rspierenburg avatar rspierenburg commented on July 1, 2024

Same here, exact same error. 37 occurances since March 22.

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

Are you able to test a new version of pyalarmdotcomajax? See #391.

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

This looks like a combination of an Alarm.com server issue and a weak recovery mechanism in the integration. I've been seeing a lot the same errors in my browser's web console when logged into the Alarm.com website:

image

v6 of pyalarmdotcomajax should be more robust and will pollute your error logs less during recovery.

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

@elahd is this a standalone python script or can you incorporate it into home assistant ?

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

It's both. The pyalarmdotcom Python package interfaces with Alarm.com and is used by the alarmdotcom Home Assistant integration. The bundled adc CLI helps with debugging.

The issues with real time updates can't be fixed in the HA integration alone, they need to be fixed in pyalarmdotcomajax.

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

just installed the beta version. Real time updates are back. I'll report back if something goes wrong.

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

Same errors after less than an hour...

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

The websocket doesn’t recover

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

@MicroDraco Can you try running the stream command with the -d flag to enable debugging mode? This will reveal the actual error that blocks recovery.

adc stream -d -u "USERNAME" -p "PASSWORD"

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

home-assistant_2024-04-03T22-23-40.187Z.log
it seems as if the websocket recovered ONCE while I was at work, then failed to reconnect after an hour.

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

home-assistant_alarmdotcom_2024-04-03T23-48-09.422Z.log

here is another set of debugs logs

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

@MicroDraco Thanks for that. I updated the branch with some fixes. The client's connection is now as stable as the Alarm.com website (so not very stable), but it's better at reconnecting once the connection is lost.

The reconnect workflow will run when:

  1. The ADC server kicks you off. (WebSocket error 104, which impacts both the pyadc client and the alarm.com website.)
  2. The main alarm.com session expires. (HTTP error 401)
  3. Timeout / authentication / other HTTP 4xx errors
  4. All other errors will kill the client.

The workflow is:

  1. Wait a random amount of time before reconnecting, up to a minute.
  2. Request a new auth token for the WebSocket connections. (If the main login session has expired, log back in to alarm.com first.)
  3. Try reconnecting to the WebSocket endpoint.
  4. Wait 5 seconds. If we're still connected to the server, do a full pull refresh to update state.

The client will die if 25 consecutive connection attempts fail or if the server asks for an OTP (it shouldn't).

There's no way to track the actual events that were lost while disconnected. That is, if a door was closed while connected, then was opened and closed again while disconnected, that opened event will be lost. Alarm.com doesn't have a good interface for requesting historical events. The "activity" page on their website doesn't present event data in a way that can be (easily) processed programmatically.

To test, run the pip install command you ran before to pull the latest code.

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

I see no changes on the repo? Last change was two weeks ago.

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

It's the refactor-2024 branch at https://github.com/pyalarmdotcom/pyalarmdotcomajax/tree/refactor-2024

from alarmdotcom.

MicroDraco avatar MicroDraco commented on July 1, 2024

I want to incorporate this into the home assistant integration but I get an error "Setup failed for custom integration 'alarmdotcom': Unable to import component: cannot import name 'API_URL_BASE' from 'pyalarmdotcomajax.const' (/usr/local/lib/python3.12/site-packages/pyalarmdotcomajax/const.py)".

I'm not sure what files to replace.

from alarmdotcom.

elahd avatar elahd commented on July 1, 2024

from alarmdotcom.

lbreggi avatar lbreggi commented on July 1, 2024

Hi @elahd I can help testing, would be possible to give me the intructions to migrate and what you need to test? thanks!

from alarmdotcom.

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.