Closed Hooch76 closed 5 years ago
Additional information: seems as if it might be related to WiFi connectivity of my Home Assistant box. Connection randomly drops for a little while (<1min) and it seems that pysma does not recover then. Is this possible? (All other components are not affected though. They throw an error when no network is available but will be updated once connection is re-established).
It can probably be improved by adding ClientConnectError or its base, here
except asyncio.TimeoutError, aiohttp.client_exceptions.ClientConnectorError:
you have to also import aiohttp
at the top
Let me know if you still experience issues after the new version
pysma seems now to be able to recover from network hiccups, as seen from the home assistant debug log:
WARNING (MainThread) [pysma] No 'result' in reply from SMA, got: {'err': 'Could not connect to SMA at https://x.y.z.z (timeout)'}
There's another (unrelated) issue where pysma runs into the following error
WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
The problem is that I cannot see any more tries of pysma connecting to the inverter once that occured (and data is not updated then).
No errors after that?
try wrapping this line in try/finally
try:
yield from self._fetch_json(URL_LOGOUT, {})
finally:
self.sma_sid = None
but even that should have thrown another error after the one you shared
Nothing at all from pysma after that ... I've updated it and let you know how it goes. Thanks
This is how the logfile from home assistant looks like:
2019-07-19 06:00:47 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
2019-07-19 06:01:48 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
2019-07-19 06:02:58 WARNING (MainThread) [pysma] No 'result' in reply from SMA, got: {'err': 'Could not connect to SMA at https://x.x.x.x (timeout)'}
2019-07-19 06:09:01 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
2019-07-19 06:39:22 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
2019-07-19 07:40:21 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
2019-07-19 08:41:17 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
Also have a look at the timestamps. It is retried once an hour only. Any chance that "closing session" somehow does not work? Restarting home assistant immediately fixes the issue.
I'm not sure why exactly this is closed. I have the same issue.
@Human, the original or the new issue?
@kellerza I'm having the titular "Home assistant sensor stops updating" issue with the last-mentioned error logs:
2019-07-30 06:56:16 WARNING (MainThread) [pysma] 401 error detected, closing session to force another login attempt
@Human It has been closed because the changes have been merged to the PySMA 0.3.2 release which is already available in home-assistant:dev
Thanks. I still have the same bug, as the title describes. Would it be best for me to a file a new bug report?
@Human Yes, please do so! I just checked and I'm experiencing it again too...
I've created a new issue, see https://github.com/kellerza/pysma/issues/25
The SMA sensor in Home Assistant works fine for some time (<24h) but then stops updating. Restarting Home Assistant usually fixes the issue .
This is what I get in the logs then:
Plus