mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 07:37:34 +00:00
Improve code readability (#119558)
This commit is contained in:
parent
440771bdea
commit
55f8a36572
@ -70,18 +70,22 @@ DEVICE_TYPES: tuple[YoLinkSwitchEntityDescription, ...] = (
|
|||||||
translation_key="plug_1",
|
translation_key="plug_1",
|
||||||
device_class=SwitchDeviceClass.OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
exists_fn=lambda device: device.device_type == ATTR_DEVICE_MULTI_OUTLET,
|
exists_fn=lambda device: device.device_type == ATTR_DEVICE_MULTI_OUTLET,
|
||||||
plug_index_fn=lambda device: 1
|
plug_index_fn=lambda device: (
|
||||||
|
1
|
||||||
if device.device_model_name.startswith(DEV_MODEL_MULTI_OUTLET_YS6801)
|
if device.device_model_name.startswith(DEV_MODEL_MULTI_OUTLET_YS6801)
|
||||||
else 0,
|
else 0
|
||||||
|
),
|
||||||
),
|
),
|
||||||
YoLinkSwitchEntityDescription(
|
YoLinkSwitchEntityDescription(
|
||||||
key="multi_outlet_plug_2",
|
key="multi_outlet_plug_2",
|
||||||
translation_key="plug_2",
|
translation_key="plug_2",
|
||||||
device_class=SwitchDeviceClass.OUTLET,
|
device_class=SwitchDeviceClass.OUTLET,
|
||||||
exists_fn=lambda device: device.device_type == ATTR_DEVICE_MULTI_OUTLET,
|
exists_fn=lambda device: device.device_type == ATTR_DEVICE_MULTI_OUTLET,
|
||||||
plug_index_fn=lambda device: 2
|
plug_index_fn=lambda device: (
|
||||||
|
2
|
||||||
if device.device_model_name.startswith(DEV_MODEL_MULTI_OUTLET_YS6801)
|
if device.device_model_name.startswith(DEV_MODEL_MULTI_OUTLET_YS6801)
|
||||||
else 1,
|
else 1
|
||||||
|
),
|
||||||
),
|
),
|
||||||
YoLinkSwitchEntityDescription(
|
YoLinkSwitchEntityDescription(
|
||||||
key="multi_outlet_plug_3",
|
key="multi_outlet_plug_3",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user