mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Add missing Weheat temperature sensors (#128452)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
144454b8c3
commit
dddc1906c2
@ -10,23 +10,17 @@
|
||||
"cop": {
|
||||
"default": "mdi:speedometer"
|
||||
},
|
||||
"water_inlet_temperature": {
|
||||
"default": "mdi:thermometer"
|
||||
},
|
||||
"water_outlet_temperature": {
|
||||
"default": "mdi:thermometer"
|
||||
},
|
||||
"ch_inlet_temperature": {
|
||||
"default": "mdi:radiator"
|
||||
},
|
||||
"outside_temperature": {
|
||||
"default": "mdi:home-thermometer-outline"
|
||||
},
|
||||
"dhw_top_temperature": {
|
||||
"default": "mdi:thermometer"
|
||||
"thermostat_room_temperature": {
|
||||
"default": "mdi:home-thermometer"
|
||||
},
|
||||
"dhw_bottom_temperature": {
|
||||
"default": "mdi:thermometer"
|
||||
"thermostat_room_temperature_setpoint": {
|
||||
"default": "mdi:home-thermometer"
|
||||
},
|
||||
"heat_pump_state": {
|
||||
"default": "mdi:state-machine"
|
||||
|
@ -95,6 +95,33 @@ SENSORS = [
|
||||
suggested_display_precision=DISPLAY_PRECISION_WATER_TEMP,
|
||||
value_fn=lambda status: status.air_inlet_temperature,
|
||||
),
|
||||
WeHeatSensorEntityDescription(
|
||||
translation_key="thermostat_water_setpoint",
|
||||
key="thermostat_water_setpoint",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=DISPLAY_PRECISION_WATER_TEMP,
|
||||
value_fn=lambda status: status.thermostat_water_setpoint,
|
||||
),
|
||||
WeHeatSensorEntityDescription(
|
||||
translation_key="thermostat_room_temperature",
|
||||
key="thermostat_room_temperature",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=DISPLAY_PRECISION_WATER_TEMP,
|
||||
value_fn=lambda status: status.thermostat_room_temperature,
|
||||
),
|
||||
WeHeatSensorEntityDescription(
|
||||
translation_key="thermostat_room_temperature_setpoint",
|
||||
key="thermostat_room_temperature_setpoint",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
suggested_display_precision=DISPLAY_PRECISION_WATER_TEMP,
|
||||
value_fn=lambda status: status.thermostat_room_temperature_setpoint,
|
||||
),
|
||||
WeHeatSensorEntityDescription(
|
||||
translation_key="heat_pump_state",
|
||||
key="heat_pump_state",
|
||||
|
@ -54,6 +54,15 @@
|
||||
"outside_temperature": {
|
||||
"name": "Outside temperature"
|
||||
},
|
||||
"thermostat_water_setpoint": {
|
||||
"name": "Water target temperature"
|
||||
},
|
||||
"thermostat_room_temperature": {
|
||||
"name": "Current room temperature"
|
||||
},
|
||||
"thermostat_room_temperature_setpoint": {
|
||||
"name": "Room temperature setpoint"
|
||||
},
|
||||
"dhw_top_temperature": {
|
||||
"name": "DHW top temperature"
|
||||
},
|
||||
|
@ -115,6 +115,9 @@ def mock_weheat_heat_pump_instance() -> MagicMock:
|
||||
mock_heat_pump_instance.power_output = 66
|
||||
mock_heat_pump_instance.dhw_top_temperature = 77
|
||||
mock_heat_pump_instance.dhw_bottom_temperature = 88
|
||||
mock_heat_pump_instance.thermostat_water_setpoint = 35
|
||||
mock_heat_pump_instance.thermostat_room_temperature = 19
|
||||
mock_heat_pump_instance.thermostat_room_temperature_setpoint = 21
|
||||
mock_heat_pump_instance.cop = 4.5
|
||||
mock_heat_pump_instance.heat_pump_state = HeatPump.State.HEATING
|
||||
mock_heat_pump_instance.energy_total = 12345
|
||||
|
@ -175,6 +175,60 @@
|
||||
'state': '4.5',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_current_room_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_model_current_room_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Current room temperature',
|
||||
'platform': 'weheat',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'thermostat_room_temperature',
|
||||
'unique_id': '0000-1111-2222-3333_thermostat_room_temperature',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_current_room_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'temperature',
|
||||
'friendly_name': 'Test Model Current room temperature',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_model_current_room_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '19',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_dhw_bottom_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@ -496,7 +550,7 @@
|
||||
'state': '44',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_power_output-entry]
|
||||
# name: test_all_entities[sensor.test_model_room_temperature_setpoint-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@ -510,7 +564,7 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_model_power_output',
|
||||
'entity_id': 'sensor.test_model_room_temperature_setpoint',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
@ -520,34 +574,34 @@
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 0,
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.POWER: 'power'>,
|
||||
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'power output',
|
||||
'original_name': 'Room temperature setpoint',
|
||||
'platform': 'weheat',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'power_output',
|
||||
'unique_id': '0000-1111-2222-3333_power_output',
|
||||
'unit_of_measurement': <UnitOfPower.WATT: 'W'>,
|
||||
'translation_key': 'thermostat_room_temperature_setpoint',
|
||||
'unique_id': '0000-1111-2222-3333_thermostat_room_temperature_setpoint',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_power_output-state]
|
||||
# name: test_all_entities[sensor.test_model_room_temperature_setpoint-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'power',
|
||||
'friendly_name': 'Test Model power output',
|
||||
'device_class': 'temperature',
|
||||
'friendly_name': 'Test Model Room temperature setpoint',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfPower.WATT: 'W'>,
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_model_power_output',
|
||||
'entity_id': 'sensor.test_model_room_temperature_setpoint',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '77',
|
||||
'state': '21',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_water_inlet_temperature-entry]
|
||||
@ -658,3 +712,57 @@
|
||||
'state': '22',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_water_target_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.test_model_water_target_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 1,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Water target temperature',
|
||||
'platform': 'weheat',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'thermostat_water_setpoint',
|
||||
'unique_id': '0000-1111-2222-3333_thermostat_water_setpoint',
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.test_model_water_target_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'temperature',
|
||||
'friendly_name': 'Test Model Water target temperature',
|
||||
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.test_model_water_target_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '35',
|
||||
})
|
||||
# ---
|
||||
|
@ -34,7 +34,7 @@ async def test_all_entities(
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("has_dhw", "nr_of_entities"), [(False, 9), (True, 11)])
|
||||
@pytest.mark.parametrize(("has_dhw", "nr_of_entities"), [(False, 12), (True, 14)])
|
||||
async def test_create_entities(
|
||||
hass: HomeAssistant,
|
||||
mock_weheat_discover: AsyncMock,
|
||||
|
Loading…
x
Reference in New Issue
Block a user