mirror of
https://github.com/home-assistant/core.git
synced 2025-08-04 21:25:13 +02:00
fix
This commit is contained in:
@@ -8,9 +8,6 @@ import logging
|
|||||||
|
|
||||||
from PyViCare.PyViCareDevice import Device as PyViCareDevice
|
from PyViCare.PyViCareDevice import Device as PyViCareDevice
|
||||||
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
||||||
from PyViCare.PyViCareHeatingDevice import (
|
|
||||||
HeatingDeviceWithComponent as PyViCareHeatingDeviceWithComponent,
|
|
||||||
)
|
|
||||||
from PyViCare.PyViCareUtils import (
|
from PyViCare.PyViCareUtils import (
|
||||||
PyViCareInvalidDataError,
|
PyViCareInvalidDataError,
|
||||||
PyViCareNotSupportedFeatureError,
|
PyViCareNotSupportedFeatureError,
|
||||||
@@ -117,59 +114,54 @@ def _build_entities(
|
|||||||
|
|
||||||
entities: list[ViCareBinarySensor] = []
|
entities: list[ViCareBinarySensor] = []
|
||||||
for device in device_list:
|
for device in device_list:
|
||||||
entities.extend(_build_entities_for_device(device.api, device.config))
|
|
||||||
entities.extend(
|
entities.extend(
|
||||||
_build_entities_for_component(
|
[
|
||||||
get_circuits(device.api), device.config, CIRCUIT_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entities.extend(
|
|
||||||
_build_entities_for_component(
|
|
||||||
get_burners(device.api), device.config, BURNER_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entities.extend(
|
|
||||||
_build_entities_for_component(
|
|
||||||
get_compressors(device.api), device.config, COMPRESSOR_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return entities
|
|
||||||
|
|
||||||
|
|
||||||
def _build_entities_for_device(
|
|
||||||
device: PyViCareDevice,
|
|
||||||
device_config: PyViCareDeviceConfig,
|
|
||||||
) -> list[ViCareBinarySensor]:
|
|
||||||
"""Create device specific ViCare binary sensor entities."""
|
|
||||||
|
|
||||||
return [
|
|
||||||
ViCareBinarySensor(
|
ViCareBinarySensor(
|
||||||
device,
|
device.api,
|
||||||
device_config,
|
device.config,
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
for description in GLOBAL_SENSORS
|
for description in GLOBAL_SENSORS
|
||||||
if is_supported(description.key, description, device)
|
if is_supported(description.key, description, device.api)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
def _build_entities_for_component(
|
[
|
||||||
components: list[PyViCareHeatingDeviceWithComponent],
|
|
||||||
device_config: PyViCareDeviceConfig,
|
|
||||||
entity_descriptions: tuple[ViCareBinarySensorEntityDescription, ...],
|
|
||||||
) -> list[ViCareBinarySensor]:
|
|
||||||
"""Create component specific ViCare binary sensor entities."""
|
|
||||||
|
|
||||||
return [
|
|
||||||
ViCareBinarySensor(
|
ViCareBinarySensor(
|
||||||
component,
|
component,
|
||||||
device_config,
|
device.config,
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
for component in components
|
for component in get_circuits(device.api)
|
||||||
for description in entity_descriptions
|
for description in CIRCUIT_SENSORS
|
||||||
if is_supported(description.key, description, component)
|
if is_supported(description.key, description, component)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
|
[
|
||||||
|
ViCareBinarySensor(
|
||||||
|
component,
|
||||||
|
device.config,
|
||||||
|
description,
|
||||||
|
)
|
||||||
|
for component in get_burners(device.api)
|
||||||
|
for description in BURNER_SENSORS
|
||||||
|
if is_supported(description.key, description, component)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
|
[
|
||||||
|
ViCareBinarySensor(
|
||||||
|
component,
|
||||||
|
device.config,
|
||||||
|
description,
|
||||||
|
)
|
||||||
|
for component in get_compressors(device.api)
|
||||||
|
for description in COMPRESSOR_SENSORS
|
||||||
|
if is_supported(description.key, description, component)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
return entities
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
|
@@ -8,9 +8,6 @@ import logging
|
|||||||
|
|
||||||
from PyViCare.PyViCareDevice import Device as PyViCareDevice
|
from PyViCare.PyViCareDevice import Device as PyViCareDevice
|
||||||
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
||||||
from PyViCare.PyViCareHeatingDevice import (
|
|
||||||
HeatingDeviceWithComponent as PyViCareHeatingDeviceWithComponent,
|
|
||||||
)
|
|
||||||
from PyViCare.PyViCareUtils import (
|
from PyViCare.PyViCareUtils import (
|
||||||
PyViCareInvalidDataError,
|
PyViCareInvalidDataError,
|
||||||
PyViCareNotSupportedFeatureError,
|
PyViCareNotSupportedFeatureError,
|
||||||
@@ -707,59 +704,54 @@ def _build_entities(
|
|||||||
|
|
||||||
entities: list[ViCareSensor] = []
|
entities: list[ViCareSensor] = []
|
||||||
for device in device_list:
|
for device in device_list:
|
||||||
entities.extend(_build_entities_for_device(device.api, device.config))
|
|
||||||
entities.extend(
|
entities.extend(
|
||||||
_build_entities_for_component(
|
[
|
||||||
get_circuits(device.api), device.config, CIRCUIT_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entities.extend(
|
|
||||||
_build_entities_for_component(
|
|
||||||
get_burners(device.api), device.config, BURNER_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
entities.extend(
|
|
||||||
_build_entities_for_component(
|
|
||||||
get_compressors(device.api), device.config, COMPRESSOR_SENSORS
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return entities
|
|
||||||
|
|
||||||
|
|
||||||
def _build_entities_for_device(
|
|
||||||
device: PyViCareDevice,
|
|
||||||
device_config: PyViCareDeviceConfig,
|
|
||||||
) -> list[ViCareSensor]:
|
|
||||||
"""Create device specific ViCare sensor entities."""
|
|
||||||
|
|
||||||
return [
|
|
||||||
ViCareSensor(
|
ViCareSensor(
|
||||||
device,
|
device.api,
|
||||||
device_config,
|
device.config,
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
for description in GLOBAL_SENSORS
|
for description in GLOBAL_SENSORS
|
||||||
if is_supported(description.key, description, device)
|
if is_supported(description.key, description, device.api)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
def _build_entities_for_component(
|
[
|
||||||
components: list[PyViCareHeatingDeviceWithComponent],
|
|
||||||
device_config: PyViCareDeviceConfig,
|
|
||||||
entity_descriptions: tuple[ViCareSensorEntityDescription, ...],
|
|
||||||
) -> list[ViCareSensor]:
|
|
||||||
"""Create component specific ViCare sensor entities."""
|
|
||||||
|
|
||||||
return [
|
|
||||||
ViCareSensor(
|
ViCareSensor(
|
||||||
component,
|
component,
|
||||||
device_config,
|
device.config,
|
||||||
description,
|
description,
|
||||||
)
|
)
|
||||||
for component in components
|
for component in get_circuits(device.api)
|
||||||
for description in entity_descriptions
|
for description in CIRCUIT_SENSORS
|
||||||
if is_supported(description.key, description, component)
|
if is_supported(description.key, description, component)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
|
[
|
||||||
|
ViCareSensor(
|
||||||
|
component,
|
||||||
|
device.config,
|
||||||
|
description,
|
||||||
|
)
|
||||||
|
for component in get_burners(device.api)
|
||||||
|
for description in BURNER_SENSORS
|
||||||
|
if is_supported(description.key, description, component)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
entities.extend(
|
||||||
|
[
|
||||||
|
ViCareSensor(
|
||||||
|
component,
|
||||||
|
device.config,
|
||||||
|
description,
|
||||||
|
)
|
||||||
|
for component in get_compressors(device.api)
|
||||||
|
for description in COMPRESSOR_SENSORS
|
||||||
|
if is_supported(description.key, description, component)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
return entities
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
|
Reference in New Issue
Block a user