From da1003ac416308b15cac61972bca7aa3cad7602e Mon Sep 17 00:00:00 2001 From: Matrix <justin@yosmart.com> Date: Wed, 11 Sep 2024 16:27:48 +0800 Subject: [PATCH] Improve yolink code readability (#125724) Improve code readability --- homeassistant/components/yolink/sensor.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/yolink/sensor.py b/homeassistant/components/yolink/sensor.py index 537393d0315..8f263cdae07 100644 --- a/homeassistant/components/yolink/sensor.py +++ b/homeassistant/components/yolink/sensor.py @@ -175,8 +175,10 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = ( device_class=SensorDeviceClass.HUMIDITY, native_unit_of_measurement=PERCENTAGE, state_class=SensorStateClass.MEASUREMENT, - exists_fn=lambda device: device.device_type in [ATTR_DEVICE_TH_SENSOR] - and device.device_model_name not in NONE_HUMIDITY_SENSOR_MODELS, + exists_fn=lambda device: ( + device.device_type in [ATTR_DEVICE_TH_SENSOR] + and device.device_model_name not in NONE_HUMIDITY_SENSOR_MODELS + ), ), YoLinkSensorEntityDescription( key="temperature", @@ -248,8 +250,9 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = ( native_unit_of_measurement=UnitOfVolume.CUBIC_METERS, state_class=SensorStateClass.TOTAL_INCREASING, should_update_entity=lambda value: value is not None, - exists_fn=lambda device: device.device_type - in ATTR_DEVICE_WATER_METER_CONTROLLER, + exists_fn=lambda device: ( + device.device_type in ATTR_DEVICE_WATER_METER_CONTROLLER + ), ), YoLinkSensorEntityDescription( key="power", -- GitLab