mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Avoid keyerror on incomplete api data in myuplink (#136333)
* Avoid keyerror * Inject erroneous value in device point fixture * Update diagnostics snapshot
This commit is contained in:
parent
025f70445b
commit
3da9c599dc
@ -325,10 +325,10 @@ class MyUplinkEnumSensor(MyUplinkDevicePointSensor):
|
||||
}
|
||||
|
||||
@property
|
||||
def native_value(self) -> str:
|
||||
def native_value(self) -> str | None:
|
||||
"""Sensor state value for enum sensor."""
|
||||
device_point = self.coordinator.data.points[self.device_id][self.point_id]
|
||||
return self.options_map[str(int(device_point.value))] # type: ignore[no-any-return]
|
||||
return self.options_map.get(str(int(device_point.value)))
|
||||
|
||||
|
||||
class MyUplinkEnumRawSensor(MyUplinkDevicePointSensor):
|
||||
|
@ -822,7 +822,7 @@
|
||||
"parameterUnit": "",
|
||||
"writable": false,
|
||||
"timestamp": "2024-02-08T19:13:05+00:00",
|
||||
"value": 30,
|
||||
"value": 31,
|
||||
"strVal": "Heating",
|
||||
"smartHomeCategories": [],
|
||||
"minValue": null,
|
||||
|
@ -883,7 +883,7 @@
|
||||
"parameterUnit": "",
|
||||
"writable": false,
|
||||
"timestamp": "2024-02-08T19:13:05+00:00",
|
||||
"value": 30,
|
||||
"value": 31,
|
||||
"strVal": "Heating",
|
||||
"smartHomeCategories": [],
|
||||
"minValue": null,
|
||||
@ -2045,7 +2045,7 @@
|
||||
"parameterUnit": "",
|
||||
"writable": false,
|
||||
"timestamp": "2024-02-08T19:13:05+00:00",
|
||||
"value": 30,
|
||||
"value": 31,
|
||||
"strVal": "Heating",
|
||||
"smartHomeCategories": [],
|
||||
"minValue": null,
|
||||
|
@ -3396,7 +3396,7 @@
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Heating',
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_states[sensor.gotham_city_priority_2-entry]
|
||||
@ -3462,7 +3462,7 @@
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Heating',
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_states[sensor.gotham_city_priority_raw-entry]
|
||||
@ -3508,7 +3508,7 @@
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '30',
|
||||
'state': '31',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_states[sensor.gotham_city_priority_raw_2-entry]
|
||||
@ -3554,7 +3554,7 @@
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '30',
|
||||
'state': '31',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor_states[sensor.gotham_city_r_start_diff_additional_heat-entry]
|
||||
|
Loading…
x
Reference in New Issue
Block a user