Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions homeassistant/components/vicare/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
ViCareSensorEntityDescription(
key="primary_circuit_pump_rotation",
translation_key="primary_circuit_pump_rotation",
native_unit_of_measurement=PERCENTAGE,
value_getter=lambda api: api.getPrimaryCircuitPumpRotation(),
unit_getter=lambda api: api.getPrimaryCircuitPumpRotationUnit(),
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="secondary_circuit_supply_temperature",
translation_key="secondary_circuit_supply_temperature",
Expand All @@ -184,6 +194,36 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
ViCareSensorEntityDescription(
key="hot_gas_temperature",
translation_key="hot_gas_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getHotGasTemperature(),
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="liquid_gas_temperature",
translation_key="liquid_gas_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getLiquidGasTemperature(),
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="suction_gas_temperature",
translation_key="suction_gas_temperature",
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
value_getter=lambda api: api.getSuctionGasTemperature(),
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="hotwater_out_temperature",
translation_key="hotwater_out_temperature",
Expand Down Expand Up @@ -971,6 +1011,28 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
value_getter=lambda api: api.getSupplyPressure(),
unit_getter=lambda api: api.getSupplyPressureUnit(),
),
ViCareSensorEntityDescription(
key="hot_gas_pressure",
translation_key="hot_gas_pressure",
device_class=SensorDeviceClass.PRESSURE,
native_unit_of_measurement=UnitOfPressure.BAR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getHotGasPressure(),
unit_getter=lambda api: api.getHotGasPressureUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="suction_gas_pressure",
translation_key="suction_gas_pressure",
device_class=SensorDeviceClass.PRESSURE,
native_unit_of_measurement=UnitOfPressure.BAR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getSuctionGasPressure(),
unit_getter=lambda api: api.getSuctionGasPressureUnit(),
entity_registry_enabled_default=False,
),
ViCareSensorEntityDescription(
key="heating_rod_starts",
translation_key="heating_rod_starts",
Expand Down Expand Up @@ -1007,6 +1069,35 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getSeasonalPerformanceFactorHeating(),
),
ViCareSensorEntityDescription(
key="cop_heating",
translation_key="cop_heating",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getCoefficientOfPerformanceHeating(),
Comment on lines +1075 to +1077
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bump PyViCare to match new COP APIs

These new sensors call api.getCoefficientOfPerformanceHeating() (and the other COP getters added here), but homeassistant/components/vicare/manifest.json still pins PyViCare==2.55.1. The commit message notes these APIs come from a newer PyViCare PR, so with the currently pinned version this call will raise AttributeError during ViCareSensor.update, breaking the new entities on a standard install. Please update the PyViCare requirement (and regenerate requirements_all.txt) to a version that includes these methods.

Useful? React with 👍 / 👎.

),
ViCareSensorEntityDescription(
key="cop_dhw",
translation_key="cop_dhw",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getCoefficientOfPerformanceDHW(),
),
ViCareSensorEntityDescription(
key="cop_total",
translation_key="cop_total",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getCoefficientOfPerformanceTotal(),
),
ViCareSensorEntityDescription(
key="cop_cooling",
translation_key="cop_cooling",
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getCoefficientOfPerformanceCooling(),
entity_registry_enabled_default=False,
),
Comment on lines +1072 to +1100
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states there are 15 new sensors and mentions a "green COP" sensor, but the code only adds 12 sensors (4 refrigerant circuit temperatures/pressures, 4 COP sensors, 1 pump rotation, 2 compressor sensors, and 1 primary circuit pump). The "green COP" sensor is not implemented. Please update the PR description to accurately reflect the 12 sensors actually being added: COP (heating, DHW, total, cooling), compressor (power, modulation), refrigerant circuit (hot gas/suction gas/liquid gas temperatures and hot gas/suction gas pressures), and primary circuit pump rotation.

Copilot uses AI. Check for mistakes.
ViCareSensorEntityDescription(
key="battery_level",
native_unit_of_measurement=PERCENTAGE,
Expand Down Expand Up @@ -1187,6 +1278,23 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
)

COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
ViCareSensorEntityDescription(
key="compressor_power",
translation_key="compressor_power",
native_unit_of_measurement=UnitOfPower.KILO_WATT,
value_getter=lambda api: api.getPower(),
unit_getter=lambda api: api.getPowerUnit(),
device_class=SensorDeviceClass.POWER,
entity_category=EntityCategory.DIAGNOSTIC,
),
ViCareSensorEntityDescription(
key="compressor_modulation",
translation_key="compressor_modulation",
native_unit_of_measurement=PERCENTAGE,
value_getter=lambda api: api.getModulation(),
unit_getter=lambda api: api.getModulationUnit(),
Comment on lines +1293 to +1295
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, not saying that it is wrong, but why is there both native_unit_of_measurement and unit_getter for this? Can the unit change in the API?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit_getter is a pattern used across several ViCare sensors (e.g. supply_pressure, primary_circuit_pump_rotation). It queries the device for the unit it reports in, allowing the sensor to adapt if different models/regions use different units. For compressor_power specifically, it likely always returns kilowatt, but we follow the same defensive pattern for consistency.

state_class=SensorStateClass.MEASUREMENT,
),
Comment on lines +1290 to +1297
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compressor_modulation sensor is defined in the code but is not present in the test fixture data (Vitocal222G_Vitovent300W.json). While this is not necessarily incorrect (the sensor may only be available on certain heat pump models), it would be beneficial to verify this is intentional. If this sensor is expected to be available on the test device, the fixture data should be updated to include it. Otherwise, consider adding a comment explaining why this sensor is not present in all heat pump models.

Copilot uses AI. Check for mistakes.
ViCareSensorEntityDescription(
key="compressor_starts",
translation_key="compressor_starts",
Expand Down
36 changes: 36 additions & 0 deletions homeassistant/components/vicare/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@
"compressor_inlet_temperature": {
"name": "Compressor inlet temperature"
},
"compressor_modulation": {
"name": "Compressor modulation"
},
"compressor_outlet_pressure": {
"name": "Compressor outlet pressure"
},
Expand All @@ -241,6 +244,9 @@
"ready": "[%key:common::state::idle%]"
}
},
"compressor_power": {
"name": "Compressor power"
},
"compressor_starts": {
"name": "Compressor starts"
},
Expand All @@ -250,6 +256,18 @@
"condenser_subcooling_temperature": {
"name": "Condenser subcooling temperature"
},
"cop_cooling": {
"name": "Coefficient of performance - cooling"
},
"cop_dhw": {
"name": "Coefficient of performance - domestic hot water"
},
"cop_heating": {
"name": "Coefficient of performance - heating"
},
"cop_total": {
"name": "Coefficient of performance"
},
"dhw_storage_bottom_temperature": {
"name": "DHW storage bottom temperature"
},
Expand Down Expand Up @@ -396,6 +414,12 @@
"heating_rod_starts": {
"name": "Heating rod starts"
},
"hot_gas_pressure": {
"name": "Hot gas pressure"
},
"hot_gas_temperature": {
"name": "Hot gas temperature"
},
"hotwater_gas_consumption_heating_this_month": {
"name": "DHW gas consumption this month"
},
Expand Down Expand Up @@ -441,6 +465,9 @@
"inverter_temperature": {
"name": "Inverter temperature"
},
"liquid_gas_temperature": {
"name": "Liquid gas temperature"
},
"outside_humidity": {
"name": "Outside humidity"
},
Expand Down Expand Up @@ -508,6 +535,9 @@
"power_production_today": {
"name": "Energy production today"
},
"primary_circuit_pump_rotation": {
"name": "Primary circuit pump rotation"
},
"primary_circuit_return_temperature": {
"name": "Primary circuit return temperature"
},
Expand Down Expand Up @@ -547,6 +577,12 @@
"spf_total": {
"name": "Seasonal performance factor"
},
"suction_gas_pressure": {
"name": "Suction gas pressure"
},
"suction_gas_temperature": {
"name": "Suction gas temperature"
},
"supply_fan_hours": {
"name": "Supply fan hours"
},
Expand Down
Loading