diff --git a/homeassistant/components/weheat/icons.json b/homeassistant/components/weheat/icons.json index a7579c12ecd84..6fdae84cfffa5 100644 --- a/homeassistant/components/weheat/icons.json +++ b/homeassistant/components/weheat/icons.json @@ -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" diff --git a/homeassistant/components/weheat/sensor.py b/homeassistant/components/weheat/sensor.py index fc7d3628a3364..ef5be9030b9ed 100644 --- a/homeassistant/components/weheat/sensor.py +++ b/homeassistant/components/weheat/sensor.py @@ -95,6 +95,33 @@ class WeHeatSensorEntityDescription(SensorEntityDescription): 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", diff --git a/homeassistant/components/weheat/strings.json b/homeassistant/components/weheat/strings.json index 3982bfd23b3d4..0733024cbed43 100644 --- a/homeassistant/components/weheat/strings.json +++ b/homeassistant/components/weheat/strings.json @@ -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" }, diff --git a/tests/components/weheat/conftest.py b/tests/components/weheat/conftest.py index 622882d6e8d4e..6ecb64ffdf4d3 100644 --- a/tests/components/weheat/conftest.py +++ b/tests/components/weheat/conftest.py @@ -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 diff --git a/tests/components/weheat/snapshots/test_sensor.ambr b/tests/components/weheat/snapshots/test_sensor.ambr index fc2b6a845a88a..3bd4a2545989c 100644 --- a/tests/components/weheat/snapshots/test_sensor.ambr +++ b/tests/components/weheat/snapshots/test_sensor.ambr @@ -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': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + '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': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + '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': , + }) +# --- +# 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': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.test_model_current_room_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + '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': , + 'original_device_class': , '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': , + 'translation_key': 'thermostat_room_temperature_setpoint', + 'unique_id': '0000-1111-2222-3333_thermostat_room_temperature_setpoint', + 'unit_of_measurement': , }) # --- -# 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': , - 'unit_of_measurement': , + 'unit_of_measurement': , }), 'context': , - 'entity_id': 'sensor.test_model_power_output', + 'entity_id': 'sensor.test_model_room_temperature_setpoint', 'last_changed': , 'last_reported': , 'last_updated': , - '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': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + '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': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + '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': , + }) +# --- +# 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': , + 'unit_of_measurement': , + }), + 'context': , + 'entity_id': 'sensor.test_model_water_target_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '35', + }) +# --- diff --git a/tests/components/weheat/test_sensor.py b/tests/components/weheat/test_sensor.py index 5bd05b5cb2b1d..d9055addc67b6 100644 --- a/tests/components/weheat/test_sensor.py +++ b/tests/components/weheat/test_sensor.py @@ -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,