File tree 1 file changed +13
-8
lines changed
1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -55,14 +55,19 @@ async def _async_update_data(self) -> dict[str, Any]:
55
55
)
56
56
# Do not throw an exception unless it's failed a few times to avoid excessive "unavailable" data
57
57
# in HASS
58
- if self .failed_update_count > FAILED_UPDATES_ALLOWANCE :
59
- _LOGGER .error (
60
- "Update failed %s times, above limit of %s! - %s" ,
61
- self .failed_update_count ,
62
- FAILED_UPDATES_ALLOWANCE ,
63
- exception ,
64
- )
65
- raise UpdateFailed () from exception
58
+ if self .failed_update_count <= FAILED_UPDATES_ALLOWANCE :
59
+ # return the 'old' data on a failed update
60
+ _LOGGER .debug ("Update failed, returning existing data" )
61
+ return self .data
62
+
63
+ # Data update failed too many times, raise an error
64
+ _LOGGER .error (
65
+ "Update failed %s times, above limit of %s! - %s" ,
66
+ self .failed_update_count ,
67
+ FAILED_UPDATES_ALLOWANCE ,
68
+ exception ,
69
+ )
70
+ raise UpdateFailed () from exception
66
71
67
72
def get_value (self , path : list [int | str ], default = None ) -> Any :
68
73
"""
You can’t perform that action at this time.
0 commit comments