MisterWil / abodepy

A thin Python wrapper for the Abode alarm API
MIT License
49 stars 17 forks source link

Fix to handle Abode server issues #73

Closed shred86 closed 3 years ago

shred86 commented 3 years ago

An issue was identified with the Abode component in Home Assistant where entities are sometimes stuck in an "Unavailable" state after the web socket is disconnected. What appears to be occurring is sometimes the web socket reconnects, _on_socket_connected is called which then calls self._abode.refresh(). However, the issue is this refresh will sometimes throw an exception because the response is not correct (Abode server is probably still initializing) which then stops the callbacks from executing. For the Home Assistant Abode component, we still want these callbacks to execute since the web socket is connected.

Solution is to execute a try block here and execute the callbacks in the finally section such that they always execute since self._connected is in fact True.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.2%) to 83.727% when pulling 7af0df2535fe7bf29e261e92d272137c1730cb0c on shred86:callback-fix into eb9fbbb4b7305e2186595bd764e8a9dfa9eba606 on MisterWil:master.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.2%) to 83.727% when pulling 4926b9b7436d12b1dcafab88dd109a9f0050687f on shred86:callback-fix into eb9fbbb4b7305e2186595bd764e8a9dfa9eba606 on MisterWil:master.