1
mirror of https://github.com/home-assistant/core synced 2024-07-15 09:42:11 +02:00

Use walrus operator for roomba total cleaned area sensor value (#106772)

This commit is contained in:
Xitee 2024-01-01 17:24:13 +01:00 committed by GitHub
parent 41f0eda712
commit a64f912733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,