Add vicare solar collector and pump information (#64178)
* Added solar collector and pump information * moved sensors to GLOBAL_SENSORS
This commit is contained in:
parent
144371d843
commit
4715163150
2 changed files with 48 additions and 0 deletions
|
@ -35,6 +35,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
SENSOR_CIRCULATION_PUMP_ACTIVE = "circulationpump_active"
|
||||
SENSOR_BURNER_ACTIVE = "burner_active"
|
||||
SENSOR_COMPRESSOR_ACTIVE = "compressor_active"
|
||||
SENSOR_SOLAR_PUMP_ACTIVE = "solar_pump_active"
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -71,6 +72,15 @@ COMPRESSOR_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
|
|||
),
|
||||
)
|
||||
|
||||
GLOBAL_SENSORS: tuple[ViCareBinarySensorEntityDescription, ...] = (
|
||||
ViCareBinarySensorEntityDescription(
|
||||
key=SENSOR_SOLAR_PUMP_ACTIVE,
|
||||
name="Solar pump active",
|
||||
device_class=BinarySensorDeviceClass.POWER,
|
||||
value_getter=lambda api: api.getSolarPumpActive(),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _build_entity(name, vicare_api, device_config, sensor):
|
||||
"""Create a ViCare binary sensor entity."""
|
||||
|
@ -123,6 +133,17 @@ async def async_setup_entry(
|
|||
|
||||
entities = []
|
||||
|
||||
for description in GLOBAL_SENSORS:
|
||||
entity = await hass.async_add_executor_job(
|
||||
_build_entity,
|
||||
f"{name} {description.name}",
|
||||
api,
|
||||
hass.data[DOMAIN][config_entry.entry_id][VICARE_DEVICE_CONFIG],
|
||||
description,
|
||||
)
|
||||
if entity is not None:
|
||||
entities.append(entity)
|
||||
|
||||
for description in CIRCUIT_SENSORS:
|
||||
for circuit in hass.data[DOMAIN][config_entry.entry_id][VICARE_CIRCUITS]:
|
||||
suffix = ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue