ksheumaker / homeassistant-apsystems_ecur

Home Assistant custom component for local querying of APSystems ECU-R Solar System
Apache License 2.0
166 stars 42 forks source link

Update APSystemsSocket.py #73

Closed HAEdwin closed 2 years ago

HAEdwin commented 2 years ago

Missed an important possible timeout catch, it's better to achieve immediate error handling after a timeout and use the cache instead of trying to proccess data further.

Grouped possible socket issues; either the socket could not be opened (resulting in "[Errno 113] Host is unreachable") or the socket was succesfully opened but no data could be sent or received (resulting in "timed out error"). I forgot to catch the timeout that might occur with self.sock.sendall(cmd.encode('utf-8'))

HAEdwin commented 2 years ago

Replaced for new pull request