Improve lists in integrations [R-S] (#113233)
* Improve lists in integrations [R-S] * Fix * Fix
This commit is contained in:
parent
e6a692f354
commit
77917506bb
60 changed files with 543 additions and 611 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue