mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 04:08:19 -04:00
Add working hours sensors to HR-energy Qube (#193631)
This commit is contained in:
@@ -14,9 +14,11 @@ from homeassistant.components.sensor import (
|
||||
)
|
||||
from homeassistant.const import (
|
||||
REVOLUTIONS_PER_MINUTE,
|
||||
EntityCategory,
|
||||
UnitOfEnergy,
|
||||
UnitOfPower,
|
||||
UnitOfTemperature,
|
||||
UnitOfTime,
|
||||
UnitOfVolumeFlowRate,
|
||||
)
|
||||
from homeassistant.helpers.typing import StateType
|
||||
@@ -228,6 +230,51 @@ SENSOR_TYPES: tuple[QubeSensorEntityDescription, ...] = (
|
||||
suggested_display_precision=1,
|
||||
value_fn=lambda data: data.state.setpoint_room_cool_night,
|
||||
),
|
||||
QubeSensorEntityDescription(
|
||||
key="working_hours_dhw",
|
||||
translation_key="working_hours_dhw",
|
||||
device_class=SensorDeviceClass.DURATION,
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.state.workinghours_dhw_hrsret,
|
||||
),
|
||||
QubeSensorEntityDescription(
|
||||
key="working_hours_heating",
|
||||
translation_key="working_hours_heating",
|
||||
device_class=SensorDeviceClass.DURATION,
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.state.workinghours_heat_hrsret,
|
||||
),
|
||||
QubeSensorEntityDescription(
|
||||
key="working_hours_cooling",
|
||||
translation_key="working_hours_cooling",
|
||||
device_class=SensorDeviceClass.DURATION,
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
value_fn=lambda data: data.state.workinghours_cool_hrsret,
|
||||
),
|
||||
*(
|
||||
QubeSensorEntityDescription(
|
||||
key=f"working_hours_heater_{number}",
|
||||
translation_key="working_hours_heater",
|
||||
translation_placeholders={"number": str(number)},
|
||||
device_class=SensorDeviceClass.DURATION,
|
||||
native_unit_of_measurement=UnitOfTime.HOURS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
value_fn=value_fn,
|
||||
)
|
||||
for number, value_fn in (
|
||||
(1, lambda data: data.state.workinghours_heater1_hrs),
|
||||
(2, lambda data: data.state.workinghours_heater2_hrs),
|
||||
(3, lambda data: data.state.workinghours_heater3_hrs),
|
||||
)
|
||||
),
|
||||
QubeSensorEntityDescription(
|
||||
key="status_heatpump",
|
||||
translation_key="status_heatpump",
|
||||
|
||||
@@ -225,6 +225,18 @@
|
||||
},
|
||||
"temp_supply": {
|
||||
"name": "Supply temperature CH"
|
||||
},
|
||||
"working_hours_cooling": {
|
||||
"name": "Working hours cooling"
|
||||
},
|
||||
"working_hours_dhw": {
|
||||
"name": "Working hours DHW"
|
||||
},
|
||||
"working_hours_heater": {
|
||||
"name": "Working hours heater {number}"
|
||||
},
|
||||
"working_hours_heating": {
|
||||
"name": "Working hours heating"
|
||||
}
|
||||
},
|
||||
"switch": {
|
||||
|
||||
@@ -85,6 +85,12 @@ def mock_qube_client(mock_qube_client_cls: MagicMock) -> MagicMock:
|
||||
state.status_code = 1
|
||||
state.status = StatusCode.STANDBY
|
||||
state.setpoint_dhw = 50.0
|
||||
state.workinghours_dhw_hrsret = 1250
|
||||
state.workinghours_heat_hrsret = 8400
|
||||
state.workinghours_cool_hrsret = 310
|
||||
state.workinghours_heater1_hrs = 12
|
||||
state.workinghours_heater2_hrs = 0
|
||||
state.workinghours_heater3_hrs = 0
|
||||
|
||||
# Binary sensors - Outputs
|
||||
state.dout_srcpmp_val = True
|
||||
|
||||
@@ -67,12 +67,12 @@
|
||||
'usr_pid_coolsetp': None,
|
||||
'usr_pid_heatsetp': None,
|
||||
'usralrms': False,
|
||||
'workinghours_cool_hrsret': None,
|
||||
'workinghours_dhw_hrsret': None,
|
||||
'workinghours_heat_hrsret': None,
|
||||
'workinghours_heater1_hrs': None,
|
||||
'workinghours_heater2_hrs': None,
|
||||
'workinghours_heater3_hrs': None,
|
||||
'workinghours_cool_hrsret': 310,
|
||||
'workinghours_dhw_hrsret': 1250,
|
||||
'workinghours_heat_hrsret': 8400,
|
||||
'workinghours_heater1_hrs': 12,
|
||||
'workinghours_heater2_hrs': 0,
|
||||
'workinghours_heater3_hrs': 0,
|
||||
}),
|
||||
'switches': dict({
|
||||
'antilegionella_frcstart_ant': False,
|
||||
|
||||
@@ -1116,3 +1116,351 @@
|
||||
'state': '500.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_cooling-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_cooling',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours cooling',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours cooling',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_cooling',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_cooling',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_cooling-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours cooling',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_cooling',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '310',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_dhw-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_dhw',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours DHW',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours DHW',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_dhw',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_dhw',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_dhw-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours DHW',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_dhw',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1250',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_1',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours heater 1',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours heater 1',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_heater',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_heater_1',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours heater 1',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '12',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_2',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours heater 2',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours heater 2',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_heater',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_heater_2',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours heater 2',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_3-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_3',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours heater 3',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours heater 3',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_heater',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_heater_3',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heater_3-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours heater 3',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heater_3',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0',
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heating-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': None,
|
||||
'device_class': None,
|
||||
'device_id': <DeviceEntry identifiers=[('hr_energy_qube', '01JQUBEHEATPUMP00000000000')]>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heating',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Working hours heating',
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.DURATION: 'duration'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Working hours heating',
|
||||
'platform': 'hr_energy_qube',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'working_hours_heating',
|
||||
'unique_id': '01JQUBEHEATPUMP00000000000-working_hours_heating',
|
||||
'unit_of_measurement': <UnitOfTime.HOURS: 'h'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_entities[sensor.qube_heat_pump_working_hours_heating-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'duration',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'Qube heat pump Working hours heating',
|
||||
<SensorEntityCapabilityAttribute.STATE_CLASS: 'state_class'>: <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
<EntityStateAttribute.UNIT_OF_MEASUREMENT: 'unit_of_measurement'>: <UnitOfTime.HOURS: 'h'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.qube_heat_pump_working_hours_heating',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '8400',
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -20,6 +20,7 @@ from homeassistant.helpers import entity_registry as er
|
||||
from . import setup_integration
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_entities(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
@@ -132,3 +133,21 @@ async def test_room_temperature_missing_value(
|
||||
state = hass.states.get("sensor.qube_heat_pump_room_temperature")
|
||||
assert state is not None
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
|
||||
@pytest.mark.parametrize("number", [1, 2, 3])
|
||||
async def test_heater_working_hours_disabled_by_default(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_qube_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
number: int,
|
||||
) -> None:
|
||||
"""Test the heater working hours sensors are disabled by default."""
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
entity_id = f"sensor.qube_heat_pump_working_hours_heater_{number}"
|
||||
entry = entity_registry.async_get(entity_id)
|
||||
assert entry is not None
|
||||
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||
assert hass.states.get(entity_id) is None
|
||||
|
||||
Reference in New Issue
Block a user