Add Vicare volumetric flow and compressor phase sensors (#103875)

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
fb22 2023-11-14 09:18:37 +01:00 committed by GitHub
parent 7a060176b6
commit 96bcc6c35a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,11 +24,13 @@ from homeassistant.components.sensor import (
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ( from homeassistant.const import (
PERCENTAGE, PERCENTAGE,
EntityCategory,
UnitOfEnergy, UnitOfEnergy,
UnitOfPower, UnitOfPower,
UnitOfTemperature, UnitOfTemperature,
UnitOfTime, UnitOfTime,
UnitOfVolume, UnitOfVolume,
UnitOfVolumeFlowRate,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -477,6 +479,15 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
device_class=SensorDeviceClass.TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT, state_class=SensorStateClass.MEASUREMENT,
), ),
ViCareSensorEntityDescription(
key="volumetric_flow",
name="Volumetric flow",
icon="mdi:gauge",
native_unit_of_measurement=UnitOfVolumeFlowRate.CUBIC_METERS_PER_HOUR,
value_getter=lambda api: api.getVolumetricFlowReturn() / 1000,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
) )
CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
@ -572,6 +583,13 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
value_getter=lambda api: api.getHoursLoadClass5(), value_getter=lambda api: api.getHoursLoadClass5(),
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
), ),
ViCareSensorEntityDescription(
key="compressor_phase",
name="Compressor Phase",
icon="mdi:information",
value_getter=lambda api: api.getPhase(),
entity_category=EntityCategory.DIAGNOSTIC,
),
) )