mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Use contextlib.suppress where possible (#48189)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Support gathering ted5000 information."""
|
||||
from contextlib import suppress
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
@@ -73,10 +74,8 @@ class Ted5000Sensor(SensorEntity):
|
||||
@property
|
||||
def state(self):
|
||||
"""Return the state of the resources."""
|
||||
try:
|
||||
with suppress(KeyError):
|
||||
return self._gateway.data[self._mtu][self._unit]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def update(self):
|
||||
"""Get the latest data from REST API."""
|
||||
|
||||
Reference in New Issue
Block a user