From d77b6cf3279f5dc3b0261944a3d44fbdac3551fc Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Thu, 26 Jun 2025 15:45:04 +0200 Subject: [PATCH 1/6] Add support for Eve Weather Weather Trend sensor and update translations --- homeassistant/components/matter/sensor.py | 30 ++++++++++++ homeassistant/components/matter/strings.json | 3 ++ .../matter/snapshots/test_sensor.ambr | 49 +++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index f744ec8885a82a..6063bdd1ba8d7d 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -515,6 +515,36 @@ def _update_from_device(self) -> None: entity_class=MatterSensor, required_attributes=(EveCluster.Attributes.Pressure,), ), + MatterDiscoverySchema( + platform=Platform.SENSOR, + entity_description=MatterSensorEntityDescription( + key="EveWeatherWeatherTrend", + translation_key="eve_weather_trend", + device_class=SensorDeviceClass.ENUM, + native_unit_of_measurement=None, + measurement_to_ha={ + 0: "0", + 1: "1", + 2: "2", + 3: "3", + 4: "4", + 5: "5", + 6: "6", + None: "previous", + }.get, + ha_to_native_value={ + "0": 0, + "1": 1, + "2": 2, + "3": 3, + "5": 5, + "6": 6, + "previous": None, + }.get, + ), + entity_class=MatterSensor, + required_attributes=(EveCluster.Attributes.WeatherTrend,), + ), MatterDiscoverySchema( platform=Platform.SENSOR, entity_description=MatterSensorEntityDescription( diff --git a/homeassistant/components/matter/strings.json b/homeassistant/components/matter/strings.json index 35a9daa23706ea..41926921c6649f 100644 --- a/homeassistant/components/matter/strings.json +++ b/homeassistant/components/matter/strings.json @@ -407,6 +407,9 @@ "pump_speed": { "name": "Rotation speed" }, + "eve_weather_trend": { + "name": "Weather trend" + }, "evse_circuit_capacity": { "name": "Circuit capacity" }, diff --git a/tests/components/matter/snapshots/test_sensor.ambr b/tests/components/matter/snapshots/test_sensor.ambr index 8e459c0f5732b7..df8a053caca3f8 100644 --- a/tests/components/matter/snapshots/test_sensor.ambr +++ b/tests/components/matter/snapshots/test_sensor.ambr @@ -2906,6 +2906,55 @@ 'state': '16.03', }) # --- +# name: test_sensors[eve_weather_sensor][sensor.eve_weather_weather_trend-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.eve_weather_weather_trend', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Weather trend', + 'platform': 'matter', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'eve_weather_trend', + 'unique_id': '00000000000004D2-000000000000001D-MatterNodeDevice-1-EveWeatherWeatherTrend-319486977-319422485', + 'unit_of_measurement': None, + }) +# --- +# name: test_sensors[eve_weather_sensor][sensor.eve_weather_weather_trend-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Eve Weather Weather trend', + }), + 'context': , + 'entity_id': 'sensor.eve_weather_weather_trend', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '6', + }) +# --- # name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ From 7999de90e018efb2581d57512aa04e800a6a34f5 Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Thu, 26 Jun 2025 16:34:33 +0200 Subject: [PATCH 2/6] Add support for Eve Weather Trend sensor with state icons and localization --- homeassistant/components/matter/icons.json | 9 +++++++++ homeassistant/components/matter/sensor.py | 2 +- homeassistant/components/matter/strings.json | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/matter/icons.json b/homeassistant/components/matter/icons.json index 32f822414aa8fc..6e2d2bfb6251b7 100644 --- a/homeassistant/components/matter/icons.json +++ b/homeassistant/components/matter/icons.json @@ -51,6 +51,15 @@ "current_phase": { "default": "mdi:state-machine" }, + "eve_weather_trend": { + "default": "mdi:weather", + "state": { + "sunny": "mdi:weather-sunny", + "cloudy": "mdi:weather-cloudy", + "rainy": "mdi:weather-rainy", + "windy": "mdi:weather-windy" + } + }, "air_quality": { "default": "mdi:air-filter" }, diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index 6063bdd1ba8d7d..4039c5cd0e7a3a 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -524,7 +524,7 @@ def _update_from_device(self) -> None: native_unit_of_measurement=None, measurement_to_ha={ 0: "0", - 1: "1", + 1: "sunny", 2: "2", 3: "3", 4: "4", diff --git a/homeassistant/components/matter/strings.json b/homeassistant/components/matter/strings.json index 41926921c6649f..aa97a7ff5328f0 100644 --- a/homeassistant/components/matter/strings.json +++ b/homeassistant/components/matter/strings.json @@ -408,7 +408,10 @@ "name": "Rotation speed" }, "eve_weather_trend": { - "name": "Weather trend" + "name": "Weather trend", + "state": { + "sunny": "Sunny" + } }, "evse_circuit_capacity": { "name": "Circuit capacity" From 4697baa6081d3afb4bc337c78a30d0275aff8c64 Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Thu, 26 Jun 2025 20:28:46 +0200 Subject: [PATCH 3/6] Add weather state mapping for Eve Weather sensor and update translations --- homeassistant/components/matter/sensor.py | 28 ++++++------------- homeassistant/components/matter/strings.json | 1 + .../matter/snapshots/test_sensor.ambr | 15 ++++++++-- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index 4039c5cd0e7a3a..782cc44164c429 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -68,6 +68,13 @@ clusters.SmokeCoAlarm.Enums.ContaminationStateEnum.kCritical: "critical", } +EVE_CLUSTER_WEATHER_MAP = { + # enum with known Weather state values which we can translate + 1: "sunny", + 2: None, + 3: "cloudy", +} + OPERATIONAL_STATE_MAP = { # enum with known Operation state values which we can translate clusters.OperationalState.Enums.OperationalStateEnum.kStopped: "stopped", @@ -522,25 +529,8 @@ def _update_from_device(self) -> None: translation_key="eve_weather_trend", device_class=SensorDeviceClass.ENUM, native_unit_of_measurement=None, - measurement_to_ha={ - 0: "0", - 1: "sunny", - 2: "2", - 3: "3", - 4: "4", - 5: "5", - 6: "6", - None: "previous", - }.get, - ha_to_native_value={ - "0": 0, - "1": 1, - "2": 2, - "3": 3, - "5": 5, - "6": 6, - "previous": None, - }.get, + options=[x for x in EVE_CLUSTER_WEATHER_MAP.values() if x is not None], + measurement_to_ha=EVE_CLUSTER_WEATHER_MAP.get, ), entity_class=MatterSensor, required_attributes=(EveCluster.Attributes.WeatherTrend,), diff --git a/homeassistant/components/matter/strings.json b/homeassistant/components/matter/strings.json index aa97a7ff5328f0..e10ef391b05528 100644 --- a/homeassistant/components/matter/strings.json +++ b/homeassistant/components/matter/strings.json @@ -410,6 +410,7 @@ "eve_weather_trend": { "name": "Weather trend", "state": { + "cloudy": "Cloudy", "sunny": "Sunny" } }, diff --git a/tests/components/matter/snapshots/test_sensor.ambr b/tests/components/matter/snapshots/test_sensor.ambr index df8a053caca3f8..54e48c732bd305 100644 --- a/tests/components/matter/snapshots/test_sensor.ambr +++ b/tests/components/matter/snapshots/test_sensor.ambr @@ -2911,7 +2911,13 @@ 'aliases': set({ }), 'area_id': None, - 'capabilities': None, + 'capabilities': dict({ + 'options': list([ + 'sunny', + None, + 'cloudy', + ]), + }), 'config_entry_id': , 'config_subentry_id': , 'device_class': None, @@ -2946,13 +2952,18 @@ 'attributes': ReadOnlyDict({ 'device_class': 'enum', 'friendly_name': 'Eve Weather Weather trend', + 'options': list([ + 'sunny', + None, + 'cloudy', + ]), }), 'context': , 'entity_id': 'sensor.eve_weather_weather_trend', 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '6', + 'state': 'unknown', }) # --- # name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry] From 492bf252495a75d590bef943dff383f6d0d5bf62 Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Fri, 27 Jun 2025 07:46:43 +0200 Subject: [PATCH 4/6] Add rainy weather state to Eve Weather sensor mapping and update tests --- homeassistant/components/matter/sensor.py | 1 + tests/components/matter/snapshots/test_sensor.ambr | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index 782cc44164c429..2653ba22743df2 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -73,6 +73,7 @@ 1: "sunny", 2: None, 3: "cloudy", + 6: "rainy", } OPERATIONAL_STATE_MAP = { diff --git a/tests/components/matter/snapshots/test_sensor.ambr b/tests/components/matter/snapshots/test_sensor.ambr index 54e48c732bd305..680c0056d23e56 100644 --- a/tests/components/matter/snapshots/test_sensor.ambr +++ b/tests/components/matter/snapshots/test_sensor.ambr @@ -2914,8 +2914,8 @@ 'capabilities': dict({ 'options': list([ 'sunny', - None, 'cloudy', + 'rainy', ]), }), 'config_entry_id': , @@ -2954,8 +2954,8 @@ 'friendly_name': 'Eve Weather Weather trend', 'options': list([ 'sunny', - None, 'cloudy', + 'rainy', ]), }), 'context': , @@ -2963,7 +2963,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'unknown', + 'state': 'rainy', }) # --- # name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry] From d7410e79b55a1d552b5f805082d131161f97718e Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Fri, 27 Jun 2025 12:00:45 +0200 Subject: [PATCH 5/6] Add stormy weather state to icons, sensor mapping, and translations --- homeassistant/components/matter/icons.json | 2 +- homeassistant/components/matter/sensor.py | 2 +- homeassistant/components/matter/strings.json | 4 +++- tests/components/matter/snapshots/test_sensor.ambr | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/matter/icons.json b/homeassistant/components/matter/icons.json index 6e2d2bfb6251b7..b444c737a3d29e 100644 --- a/homeassistant/components/matter/icons.json +++ b/homeassistant/components/matter/icons.json @@ -57,7 +57,7 @@ "sunny": "mdi:weather-sunny", "cloudy": "mdi:weather-cloudy", "rainy": "mdi:weather-rainy", - "windy": "mdi:weather-windy" + "stormy": "mdi:weather-windy" } }, "air_quality": { diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index 2653ba22743df2..0521ac7fdcdb84 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -71,9 +71,9 @@ EVE_CLUSTER_WEATHER_MAP = { # enum with known Weather state values which we can translate 1: "sunny", - 2: None, 3: "cloudy", 6: "rainy", + 14: "stormy", } OPERATIONAL_STATE_MAP = { diff --git a/homeassistant/components/matter/strings.json b/homeassistant/components/matter/strings.json index e10ef391b05528..8ab7726e248312 100644 --- a/homeassistant/components/matter/strings.json +++ b/homeassistant/components/matter/strings.json @@ -411,7 +411,9 @@ "name": "Weather trend", "state": { "cloudy": "Cloudy", - "sunny": "Sunny" + "rainy": "Rainy", + "sunny": "Sunny", + "stormy": "Stormy" } }, "evse_circuit_capacity": { diff --git a/tests/components/matter/snapshots/test_sensor.ambr b/tests/components/matter/snapshots/test_sensor.ambr index 680c0056d23e56..90d6cb5ad615c5 100644 --- a/tests/components/matter/snapshots/test_sensor.ambr +++ b/tests/components/matter/snapshots/test_sensor.ambr @@ -2916,6 +2916,7 @@ 'sunny', 'cloudy', 'rainy', + 'stormy', ]), }), 'config_entry_id': , @@ -2956,6 +2957,7 @@ 'sunny', 'cloudy', 'rainy', + 'stormy', ]), }), 'context': , From 226f44c39a9e09fe5b1816efa3315ad202d5cf98 Mon Sep 17 00:00:00 2001 From: Ludovic BOUE Date: Fri, 15 Aug 2025 13:27:29 +0200 Subject: [PATCH 6/6] Fix entity_description --- homeassistant/components/matter/sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index a3f463537cecb9..18bd7f84da33f6 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -533,7 +533,7 @@ def _update_from_device(self) -> None: device_class=SensorDeviceClass.ENUM, native_unit_of_measurement=None, options=[x for x in EVE_CLUSTER_WEATHER_MAP.values() if x is not None], - measurement_to_ha=EVE_CLUSTER_WEATHER_MAP.get, + device_to_ha=EVE_CLUSTER_WEATHER_MAP.get, ), entity_class=MatterSensor, required_attributes=(EveCluster.Attributes.WeatherTrend,),