Add tests for Fritz!Tools sensors (#67776)
This commit is contained in:
parent
94c5dbfd16
commit
3d64d1b76b
4 changed files with 165 additions and 9 deletions
|
@ -308,14 +308,13 @@ class FritzBoxSensor(FritzBoxBaseEntity, SensorEntity):
|
|||
"""Update data."""
|
||||
_LOGGER.debug("Updating FRITZ!Box sensors")
|
||||
|
||||
status: FritzStatus = self._avm_wrapper.fritz_status
|
||||
try:
|
||||
status: FritzStatus = self._avm_wrapper.fritz_status
|
||||
self._attr_available = True
|
||||
self._attr_native_value = (
|
||||
self._last_device_value
|
||||
) = self.entity_description.value_fn(status, self._last_device_value)
|
||||
except FritzConnectionException:
|
||||
_LOGGER.error("Error getting the state from the FRITZ!Box", exc_info=True)
|
||||
self._attr_available = False
|
||||
return
|
||||
|
||||
self._attr_native_value = (
|
||||
self._last_device_value
|
||||
) = self.entity_description.value_fn(status, self._last_device_value)
|
||||
self._attr_available = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue