Ignore myuplink sensors without a description that provide non-numeric values (#115525)

Ignore sensors without a description that provide non-numeric values

Co-authored-by: Jan-Philipp Benecke <jan-philipp@bnck.me>
This commit is contained in:
Thomas Ytterdal 2024-06-01 11:27:03 +02:00 committed by Paulus Schoutsen
parent b39d7b39e1
commit c52fabcf77

View File

@ -160,6 +160,11 @@ async def async_setup_entry(
if find_matching_platform(device_point) == Platform.SENSOR: if find_matching_platform(device_point) == Platform.SENSOR:
description = get_description(device_point) description = get_description(device_point)
entity_class = MyUplinkDevicePointSensor entity_class = MyUplinkDevicePointSensor
# Ignore sensors without a description that provide non-numeric values
if description is None and not isinstance(
device_point.value, (int, float)
):
continue
if ( if (
description is not None description is not None
and description.device_class == SensorDeviceClass.ENUM and description.device_class == SensorDeviceClass.ENUM