From 80ec9d43941690b29b50979869c16f8ba215a6b1 Mon Sep 17 00:00:00 2001 From: dontinelli <73341522+dontinelli@users.noreply.github.com> Date: Sun, 7 Apr 2024 21:07:51 +0200 Subject: [PATCH] improve handling of incorrect values in fyta integration (#115134) * improve handling of incorrect values * Changes based on review comment * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker * update value_fn * ruff --------- Co-authored-by: Joost Lekkerkerker --- homeassistant/components/fyta/sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/fyta/sensor.py b/homeassistant/components/fyta/sensor.py index 0643c69981e..2b9e8e3de07 100644 --- a/homeassistant/components/fyta/sensor.py +++ b/homeassistant/components/fyta/sensor.py @@ -46,35 +46,35 @@ SENSORS: Final[list[FytaSensorEntityDescription]] = [ translation_key="plant_status", device_class=SensorDeviceClass.ENUM, options=PLANT_STATUS_LIST, - value_fn=lambda value: PLANT_STATUS[value], + value_fn=PLANT_STATUS.get, ), FytaSensorEntityDescription( key="temperature_status", translation_key="temperature_status", device_class=SensorDeviceClass.ENUM, options=PLANT_STATUS_LIST, - value_fn=lambda value: PLANT_STATUS[value], + value_fn=PLANT_STATUS.get, ), FytaSensorEntityDescription( key="light_status", translation_key="light_status", device_class=SensorDeviceClass.ENUM, options=PLANT_STATUS_LIST, - value_fn=lambda value: PLANT_STATUS[value], + value_fn=PLANT_STATUS.get, ), FytaSensorEntityDescription( key="moisture_status", translation_key="moisture_status", device_class=SensorDeviceClass.ENUM, options=PLANT_STATUS_LIST, - value_fn=lambda value: PLANT_STATUS[value], + value_fn=PLANT_STATUS.get, ), FytaSensorEntityDescription( key="salinity_status", translation_key="salinity_status", device_class=SensorDeviceClass.ENUM, options=PLANT_STATUS_LIST, - value_fn=lambda value: PLANT_STATUS[value], + value_fn=PLANT_STATUS.get, ), FytaSensorEntityDescription( key="temperature",