rlippmann / hass-adtpulse

ADT Pulse sensor for Home Assistant
Other
0 stars 0 forks source link

Unexpected sync check format #7

Closed jamesb2147 closed 9 months ago

jamesb2147 commented 9 months ago

Helloo,

First off, I want to say how much I appreciate your hard work on this awesome integration. It's so amazing that I've actually got it automating access to community HOA resources based on a calendar, and I could not have done that without the hard work that you and others have put into creating and maintaining this project!!

The one bug I'm trying to figure out right now is the "unexpected sync check" error. I assume this came from an update on the ADT side. Error below:

Logger: pyadtpulse
Source: runner.py:188
First occurred: 9:50:32 PM (271 occurrences)
Last logged: 10:56:56 PM

Unexpected sync check format (\d+[-]\d+[-]\d+), forcing re-auth

I believe you're already aware of (and quite frustrated by) this issue, so I thought I'd add some context that might help. I've been playing around with the timing, and it definitely seems to coincide with re-authenticating. When I set the re-auth option to 9000 mins, the error showed up exactly 24h and 8s after the first logs from the ADT Pulse integration. If I set it to 120 mins, I get the error approximately 110 mins after the first ADT logs. When set to 60 mins for re-auth, I get the error about 50 mins after the first ADT logs.

FWIW, for others, I think a workaround that works for me (tentatively; it's still in testing) is to leave that re-auth value at 9000 mins but tell the system to reboot daily at some time you know won't impact your usage (e.g. 3AM).

I hope all that helps somebody. Thank you again @rlippmann !

rlippmann commented 9 months ago

You're welcome!

Yes, this issue has been bothering me for about 3 months. I've refactored all the base code into smaller objects and added backoffs to various places in the code. This allowed me to (hopefully) add more robust error handling. I think I have it to the point where I can release it.

I've probably over architected the solution, but, oh well.

I think that message also occurs when you log into the pulse web site with the same browser you used to generate the fingerprint. Evidently, the system won't let you use the same fingerprint at the same time, even if you log in with another username and password. This can have the unfortunate side effect of having the system lock you out for 30 minutes.

The true solution to that problem is to generate a new fingerprint exclusively for the use of HA. I think I've reverse engineered the 2FA authentication flow, and am considering adding it. However, it's a lot of work, and getting the fingerprint is kind of annoying, but it's a 1 time thing, and is a lot easier than it used to be. So I'm not sure I want to spend the time and effort to implement this.

rlippmann commented 9 months ago

This should be fixed in 0.4.0