From a64f9127336892a4c8df7b72ab0d10f55e862524 Mon Sep 17 00:00:00 2001 From: Xitee <59659167+Xitee1@users.noreply.github.com> Date: Mon, 1 Jan 2024 17:24:13 +0100 Subject: [PATCH] Use walrus operator for roomba total cleaned area sensor value (#106772) --- homeassistant/components/roomba/sensor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/homeassistant/components/roomba/sensor.py b/homeassistant/components/roomba/sensor.py index c02de0229c01..ad2894ebb117 100644 --- a/homeassistant/components/roomba/sensor.py +++ b/homeassistant/components/roomba/sensor.py @@ -126,9 +126,7 @@ SENSORS: list[RoombaSensorEntityDescription] = [ native_unit_of_measurement=AREA_SQUARE_METERS, entity_category=EntityCategory.DIAGNOSTIC, value_fn=lambda self: ( - self.run_stats.get("sqft") * 9.29 - if self.run_stats.get("sqft") is not None - else None + None if (sqft := self.run_stats.get("sqft")) is None else sqft * 9.29 ), suggested_display_precision=0, entity_registry_enabled_default=False,