mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Add further ventilation-related sensors to ViCare (#131496)
This commit is contained in:
parent
9d7706c9be
commit
40a3e19ce5
@ -84,6 +84,9 @@
|
|||||||
},
|
},
|
||||||
"compressor_phase": {
|
"compressor_phase": {
|
||||||
"default": "mdi:information"
|
"default": "mdi:information"
|
||||||
|
},
|
||||||
|
"ventilation_level": {
|
||||||
|
"default": "mdi:fan"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -796,7 +796,7 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
|
|||||||
translation_key="photovoltaic_status",
|
translation_key="photovoltaic_status",
|
||||||
device_class=SensorDeviceClass.ENUM,
|
device_class=SensorDeviceClass.ENUM,
|
||||||
options=["ready", "production"],
|
options=["ready", "production"],
|
||||||
value_getter=lambda api: _filter_pv_states(api.getPhotovoltaicStatus()),
|
value_getter=lambda api: _filter_states(api.getPhotovoltaicStatus()),
|
||||||
),
|
),
|
||||||
ViCareSensorEntityDescription(
|
ViCareSensorEntityDescription(
|
||||||
key="room_temperature",
|
key="room_temperature",
|
||||||
@ -812,6 +812,29 @@ GLOBAL_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
|
|||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_getter=lambda api: api.getHumidity(),
|
value_getter=lambda api: api.getHumidity(),
|
||||||
),
|
),
|
||||||
|
ViCareSensorEntityDescription(
|
||||||
|
key="ventilation_level",
|
||||||
|
translation_key="ventilation_level",
|
||||||
|
value_getter=lambda api: _filter_states(api.getVentilationLevel().lower()),
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
options=["standby", "levelone", "leveltwo", "levelthree", "levelfour"],
|
||||||
|
),
|
||||||
|
ViCareSensorEntityDescription(
|
||||||
|
key="ventilation_reason",
|
||||||
|
translation_key="ventilation_reason",
|
||||||
|
value_getter=lambda api: api.getVentilationReason().lower(),
|
||||||
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
|
entity_registry_enabled_default=False,
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
options=[
|
||||||
|
"standby",
|
||||||
|
"permanent",
|
||||||
|
"schedule",
|
||||||
|
"sensordriven",
|
||||||
|
"silent",
|
||||||
|
"forcedlevelfour",
|
||||||
|
],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
|
CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
|
||||||
@ -920,7 +943,7 @@ COMPRESSOR_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _filter_pv_states(state: str) -> str | None:
|
def _filter_states(state: str) -> str | None:
|
||||||
return None if state in ("nothing", "unknown") else state
|
return None if state in ("nothing", "unknown") else state
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,6 +434,27 @@
|
|||||||
},
|
},
|
||||||
"compressor_phase": {
|
"compressor_phase": {
|
||||||
"name": "Compressor phase"
|
"name": "Compressor phase"
|
||||||
|
},
|
||||||
|
"ventilation_level": {
|
||||||
|
"name": "Ventilation level",
|
||||||
|
"state": {
|
||||||
|
"standby": "[%key:common::state::standby%]",
|
||||||
|
"levelone": "1",
|
||||||
|
"leveltwo": "2",
|
||||||
|
"levelthree": "3",
|
||||||
|
"levelfour": "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ventilation_reason": {
|
||||||
|
"name": "Ventilation reason",
|
||||||
|
"state": {
|
||||||
|
"standby": "[%key:common::state::standby%]",
|
||||||
|
"permanent": "Permanent",
|
||||||
|
"schedule": "Schedule",
|
||||||
|
"sensordriven": "Sensor-driven",
|
||||||
|
"silent": "Silent",
|
||||||
|
"forcedlevelfour": "Boost"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"water_heater": {
|
"water_heater": {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@ 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_entities(
|
async def test_all_heating_entities(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
snapshot: SnapshotAssertion,
|
snapshot: SnapshotAssertion,
|
||||||
mock_config_entry: MockConfigEntry,
|
mock_config_entry: MockConfigEntry,
|
||||||
@ -35,6 +35,24 @@ async def test_all_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}.vicare_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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user