Closed shred86 closed 4 years ago
We could change the first and third of those warnings to info logs instead?
So based on my little understanding of sockets, it sounds like there’s really no way to tell when the connection will drop. In other words, it’s not a session expiring issue since the socket connection should persist until either the client or server drops it. I was hoping maybe there was a way to tell when the session would expire and re-initiate the connection prior to getting “Not Authorized”.
Right, this really isn't a problem. A WebSocket connection will eventually disconnect, either from a hiccup on the client or server end or the server finally killing out connection from it being connected too long. A lot of work went in to making sure that in either case abodepy will reconnect as quickly as possible. If it tries to connect and the session is expired then it'll need to grab a new session and then connect again. These aren't really issues so much as just correctly handling the situation.
With that said, some of these logs could be reduced to info level, i.e. the first and third log in your example. Really only "Not Authorized" is the warning, and it's recoverable usually. Perhaps we could even only elevate the error to a warning if its repeated more than once after the first reconnect attempt... then in MOST cases it shouldn't show at all.
Makes sense. Yeah, it’s been rock solid for me these past couple years (or since you did the rewrite with lomond).
I think it would make sense to reduce the first and third to at least the info level, then put in some logic to only assert “Not authorized” if it occurs multiple times within a short period. Seems like something I could do, but probably won’t look pretty. :)
I was able to reduce one of the logs to info level. The Not Authorized exception is generic enough that it shouldn't be, and the other error is from lombok which I can't control. :-)
I've noticed this occurring in the logs anywhere from every 1-3 days which causes for a lot of entries in the Home Assistant logs. My only guess is the session is expiring resulting in the "Not Authorized", but I don't know much about how sockets work (still trying to learn).