I've started using this repo and found some issues (reported in HA logs) which I've tried to fix.
Namely:
the session (ClientConnection) close is never awaited (it is an async call). After fixing this, HA states there's no need to explicitly close the session since it is already 'auto-cleared' on integration unload so the whole 'closing' call has been removed
while fixing this I've put some pylance (type) checking in VS code config and added some type hints. Pylance analysis helps a lot in detecting possible bugs
also, the python compiler issues some warnings on the 'is' operator. The corresponding code has been refactored to explicit boolean testing
Before applying this fixes (after initially installing and configuring the integration in my production HA instance), my HA instance completely lost connection to NabuCasa cloud (this happened 1 or 2 days after installation). I did not check the reason for this but my setup was stable before installing SAJeSolar and I suspect the 'non awaited task bug' resulting from the original code was somehow killing the internal resources for the python interpreter leading to the loss of web connectivity.
At any rate, this branch is now under test in my production HA and it is working without loss of HA connectivity so I 'guess' this PR is stable
Hello,
Thank you for your work on this topic!
I've started using this repo and found some issues (reported in HA logs) which I've tried to fix.
Namely:
Before applying this fixes (after initially installing and configuring the integration in my production HA instance), my HA instance completely lost connection to NabuCasa cloud (this happened 1 or 2 days after installation). I did not check the reason for this but my setup was stable before installing SAJeSolar and I suspect the 'non awaited task bug' resulting from the original code was somehow killing the internal resources for the python interpreter leading to the loss of web connectivity.
At any rate, this branch is now under test in my production HA and it is working without loss of HA connectivity so I 'guess' this PR is stable