Skip to content

Commit

Permalink
Fix KeyError issues when devices disappear from Google Wifi Cloud his…
Browse files Browse the repository at this point in the history
…tory.
  • Loading branch information
djtimca committed Sep 7, 2021
1 parent c791571 commit 83ec434
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/googlewifi/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def is_on(self) -> bool:
self._state = state
except TypeError:
pass
except KeyError:
pass

return self._state

Expand Down Expand Up @@ -149,6 +151,8 @@ def device_info(self):
self._device_info = device_info
except TypeError:
pass
except KeyError:
pass

return self._device_info

Expand Down
4 changes: 4 additions & 0 deletions custom_components/googlewifi/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def is_on(self):
self._state = False
except TypeError:
pass
except KeyError:
pass

return self._state

Expand All @@ -115,6 +117,8 @@ def brightness(self):
self._brightness = 0
except TypeError:
pass
except KeyError:
pass

return self._brightness

Expand Down
4 changes: 4 additions & 0 deletions custom_components/googlewifi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ def device_info(self):
self._device_info = device_info
except TypeError:
pass
except KeyError:
pass

return self._device_info

Expand Down Expand Up @@ -252,6 +254,8 @@ def device_info(self):
self._device_info = device_info
except TypeError:
pass
except KeyError:
pass

return self._device_info

Expand Down
4 changes: 4 additions & 0 deletions custom_components/googlewifi/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def is_on(self):
self._state = True
except TypeError:
pass
except KeyError:
pass

if self.coordinator.data:
self._mac = self.coordinator.data[self._system_id]["devices"][
Expand Down Expand Up @@ -217,6 +219,8 @@ def available(self):
self._available = False
except TypeError:
pass
except KeyError:
pass

return self._available

Expand Down

0 comments on commit 83ec434

Please sign in to comment.