Improve lists in integrations [R-S] (#113233)

* Improve lists in integrations [R-S]

* Fix

* Fix
This commit is contained in:
Joost Lekkerkerker 2024-03-13 21:55:00 +01:00 committed by GitHub
parent e6a692f354
commit 77917506bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
60 changed files with 543 additions and 611 deletions

View file

@ -175,32 +175,31 @@ async def async_setup_entry(
async_add_entities: AddEntitiesCallback,
) -> None:
"""Set up entry."""
entities: list[ScreenLogicBinarySensor] = []
coordinator: ScreenlogicDataUpdateCoordinator = hass.data[SL_DOMAIN][
config_entry.entry_id
]
gateway = coordinator.gateway
for core_sensor_description in SUPPORTED_CORE_SENSORS:
entities: list[ScreenLogicBinarySensor] = [
ScreenLogicPushBinarySensor(coordinator, core_sensor_description)
for core_sensor_description in SUPPORTED_CORE_SENSORS
if (
gateway.get_data(
*core_sensor_description.data_root, core_sensor_description.key
)
is not None
):
entities.append(
ScreenLogicPushBinarySensor(coordinator, core_sensor_description)
)
)
]
for p_index, p_data in gateway.get_data(DEVICE.PUMP).items():
if not p_data or not p_data.get(VALUE.DATA):
continue
for proto_pump_sensor_description in SUPPORTED_PUMP_SENSORS:
entities.append(
ScreenLogicPumpBinarySensor(
coordinator, copy(proto_pump_sensor_description), p_index
)
entities.extend(
ScreenLogicPumpBinarySensor(
coordinator, copy(proto_pump_sensor_description), p_index
)
for proto_pump_sensor_description in SUPPORTED_PUMP_SENSORS
)
chem_sensor_description: ScreenLogicPushBinarySensorDescription
for chem_sensor_description in SUPPORTED_INTELLICHEM_SENSORS: