Add heat pump supply pressure sensor in ViCare integration (#136265)

This commit is contained in:
Christopher Fenner 2025-01-23 09:15:24 +01:00 committed by GitHub
parent b839a2e2bd
commit 40348890da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 5682 additions and 66 deletions

View File

@ -30,6 +30,7 @@ from homeassistant.const import (
EntityCategory, EntityCategory,
UnitOfEnergy, UnitOfEnergy,
UnitOfPower, UnitOfPower,
UnitOfPressure,
UnitOfTemperature, UnitOfTemperature,
UnitOfTime, UnitOfTime,
UnitOfVolume, UnitOfVolume,
@ -836,6 +837,16 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
"forcedlevelfour", "forcedlevelfour",
], ],
), ),
ViCareSensorEntityDescription(
key="supply_pressure",
translation_key="supply_pressure",
device_class=SensorDeviceClass.PRESSURE,
native_unit_of_measurement=UnitOfPressure.BAR,
state_class=SensorStateClass.MEASUREMENT,
entity_category=EntityCategory.DIAGNOSTIC,
value_getter=lambda api: api.getSupplyPressure(),
unit_getter=lambda api: api.getSupplyPressureUnit(),
),
) )
CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (

View File

@ -455,6 +455,9 @@
"silent": "Silent", "silent": "Silent",
"forcedlevelfour": "Boost" "forcedlevelfour": "Boost"
} }
},
"supply_pressure": {
"name": "Supply pressure"
} }
}, },
"water_heater": { "water_heater": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -16,15 +16,25 @@ from tests.common import MockConfigEntry, snapshot_platform
@pytest.mark.usefixtures("entity_registry_enabled_by_default") @pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_all_heating_entities( @pytest.mark.parametrize(
("fixture_type", "fixture_data"),
[
("type:boiler", "vicare/Vitodens300W.json"),
("type:heatpump", "vicare/Vitocal250A.json"),
("type:ventilation", "vicare/ViAir300F.json"),
],
)
async def test_all_entities(
hass: HomeAssistant, hass: HomeAssistant,
fixture_type: str,
fixture_data: str,
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,
mock_config_entry: MockConfigEntry, mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
) -> None: ) -> None:
"""Test all entities.""" """Test all entities."""
fixtures: list[Fixture] = [ fixtures: list[Fixture] = [
Fixture({"type:boiler"}, "vicare/Vitodens300W.json"), Fixture({fixture_type}, fixture_data),
] ]
with ( with (
patch(f"{MODULE}.login", return_value=MockPyViCare(fixtures)), patch(f"{MODULE}.login", return_value=MockPyViCare(fixtures)),
@ -35,24 +45,6 @@ async def test_all_heating_entities(
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_all_ventilation_entities(
hass: HomeAssistant,
snapshot: SnapshotAssertion,
mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
) -> None:
"""Test all entities."""
fixtures: list[Fixture] = [Fixture({"type:ventilation"}, "vicare/ViAir300F.json")]
with (
patch(f"{MODULE}.login", return_value=MockPyViCare(fixtures)),
patch(f"{MODULE}.PLATFORMS", [Platform.SENSOR]),
):
await setup_integration(hass, mock_config_entry)
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
@pytest.mark.usefixtures("entity_registry_enabled_by_default") @pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_room_sensors( async def test_room_sensors(
hass: HomeAssistant, hass: HomeAssistant,