mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Graceful handling of missing datapoint in myuplink (#146517)
This commit is contained in:
parent
dd216ac15b
commit
a53997dfc7
@ -293,8 +293,8 @@ class MyUplinkDevicePointSensor(MyUplinkEntity, SensorEntity):
|
|||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
"""Sensor state value."""
|
"""Sensor state value."""
|
||||||
device_point = self.coordinator.data.points[self.device_id][self.point_id]
|
device_point = self.coordinator.data.points[self.device_id].get(self.point_id)
|
||||||
if device_point.value == MARKER_FOR_UNKNOWN_VALUE:
|
if device_point is None or device_point.value == MARKER_FOR_UNKNOWN_VALUE:
|
||||||
return None
|
return None
|
||||||
return device_point.value # type: ignore[no-any-return]
|
return device_point.value # type: ignore[no-any-return]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user