Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Vicare volumetric flow and compressor phase sensors #103875

Merged
merged 9 commits into from
Nov 14, 2023
36 changes: 27 additions & 9 deletions homeassistant/components/vicare/sensor.py
Expand Up @@ -24,6 +24,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
PERCENTAGE,
EntityCategory,
UnitOfEnergy,
UnitOfPower,
UnitOfTemperature,
Expand Down Expand Up @@ -103,7 +104,7 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
),
ViCareSensorEntityDescription(
key="primary_circuit_return_temperature",
name="Primary Circuit Return Temperature",
name="Primary Circuit Return Temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getReturnTemperaturePrimaryCircuit(),
device_class=SensorDeviceClass.TEMPERATURE,
Expand Down Expand Up @@ -271,63 +272,63 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
),
ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentday",
name="Energy consumption of gas heating current day",
name="Heating energy consumption today",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentDay(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentmonth",
name="Energy consumption of gas heating current month",
name="Heating energy consumption this month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentMonth(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_currentyear",
name="Energy consumption of gas heating current year",
name="Heating energy consumption this year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingCurrentYear(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_summary_consumption_heating_lastsevendays",
name="Energy consumption of gas heating last seven days",
name="Heating energy consumption last seven days",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionHeatingLastSevenDays(),
unit_getter=lambda api: api.getPowerSummaryConsumptionHeatingUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentday",
name="Energy consumption of hot water gas heating current day",
name="Hot water energy consumption today",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentDay(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentmonth",
name="Energy consumption of hot water gas heating current month",
name="Hot water energy consumption this month",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentMonth(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_dhw_summary_consumption_heating_currentyear",
name="Energy consumption of hot water gas heating current year",
name="Hot water energy consumption this year",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterCurrentYear(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="energy_summary_dhw_consumption_heating_lastsevendays",
name="Energy consumption of hot water gas heating last seven days",
name="Hot water energy consumption last seven days",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
value_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterLastSevenDays(),
unit_getter=lambda api: api.getPowerSummaryConsumptionDomesticHotWaterUnit(),
Expand Down Expand Up @@ -477,6 +478,15 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
ViCareSensorEntityDescription(
key="volumetric_flow",
name="Volumetric flow",
icon="mdi:gauge",
native_unit_of_measurement="l/h",
edenhaus marked this conversation as resolved.
Show resolved Hide resolved
value_getter=lambda api: api.getVolumetricFlowReturn(),
fb22 marked this conversation as resolved.
Show resolved Hide resolved
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
),
)

CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
Expand Down Expand Up @@ -572,6 +582,14 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
value_getter=lambda api: api.getHoursLoadClass5(),
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,
device_class=SensorDeviceClass.ENUM,
fb22 marked this conversation as resolved.
Show resolved Hide resolved
),
)


Expand Down