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 heat pump heating rod sensors in ViCare integration #136467

Merged
merged 4 commits into from
Jan 25, 2025
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
15 changes: 15 additions & 0 deletions homeassistant/components/vicare/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,21 @@ class ViCareSensorEntityDescription(SensorEntityDescription, ViCareRequiredKeysM
value_getter=lambda api: api.getSupplyPressure(),
unit_getter=lambda api: api.getSupplyPressureUnit(),
),
ViCareSensorEntityDescription(
key="heating_rod_starts",
translation_key="heating_rod_starts",
value_getter=lambda api: api.getHeatingRodStarts(),
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.TOTAL_INCREASING,
),
ViCareSensorEntityDescription(
key="heating_rod_hours",
translation_key="heating_rod_hours",
native_unit_of_measurement=UnitOfTime.HOURS,
value_getter=lambda api: api.getHeatingRodHours(),
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.TOTAL_INCREASING,
),
)

CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = (
Expand Down
6 changes: 6 additions & 0 deletions homeassistant/components/vicare/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@
},
"supply_pressure": {
"name": "Supply pressure"
},
"heating_rod_starts": {
"name": "Heating rod starts"
},
"heating_rod_hours": {
"name": "Heating rod hours"
}
},
"water_heater": {
Expand Down
99 changes: 99 additions & 0 deletions tests/components/vicare/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,105 @@
'state': '16.4',
})
# ---
# name: test_all_entities[type:heatpump-vicare/Vitocal250A.json][sensor.model0_heating_rod_hours-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.model0_heating_rod_hours',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Heating rod hours',
'platform': 'vicare',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'heating_rod_hours',
'unique_id': 'gateway0_deviceSerialVitocal250A-heating_rod_hours',
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
})
# ---
# name: test_all_entities[type:heatpump-vicare/Vitocal250A.json][sensor.model0_heating_rod_hours-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'model0 Heating rod hours',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
}),
'context': <ANY>,
'entity_id': 'sensor.model0_heating_rod_hours',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '0',
})
# ---
# name: test_all_entities[type:heatpump-vicare/Vitocal250A.json][sensor.model0_heating_rod_starts-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
'entity_id': 'sensor.model0_heating_rod_starts',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'Heating rod starts',
'platform': 'vicare',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'heating_rod_starts',
'unique_id': 'gateway0_deviceSerialVitocal250A-heating_rod_starts',
'unit_of_measurement': None,
})
# ---
# name: test_all_entities[type:heatpump-vicare/Vitocal250A.json][sensor.model0_heating_rod_starts-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'model0 Heating rod starts',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'context': <ANY>,
'entity_id': 'sensor.model0_heating_rod_starts',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': '0',
})
# ---
# name: test_all_entities[type:heatpump-vicare/Vitocal250A.json][sensor.model0_outside_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
Expand Down