diff --git a/homeassistant/components/matter/icons.json b/homeassistant/components/matter/icons.json index 4bf2350738f..dc1fbc25181 100644 --- a/homeassistant/components/matter/icons.json +++ b/homeassistant/components/matter/icons.json @@ -57,6 +57,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", + "stormy": "mdi:weather-windy" + } + }, "air_quality": { "default": "mdi:air-filter" }, diff --git a/homeassistant/components/matter/sensor.py b/homeassistant/components/matter/sensor.py index af7dd385fd0..18bd7f84da3 100644 --- a/homeassistant/components/matter/sensor.py +++ b/homeassistant/components/matter/sensor.py @@ -70,6 +70,14 @@ CONTAMINATION_STATE_MAP = { clusters.SmokeCoAlarm.Enums.ContaminationStateEnum.kCritical: "critical", } +EVE_CLUSTER_WEATHER_MAP = { + # enum with known Weather state values which we can translate + 1: "sunny", + 3: "cloudy", + 6: "rainy", + 14: "stormy", +} + OPERATIONAL_STATE_MAP = { # enum with known Operation state values which we can translate clusters.OperationalState.Enums.OperationalStateEnum.kStopped: "stopped", @@ -517,6 +525,19 @@ DISCOVERY_SCHEMAS = [ 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, + options=[x for x in EVE_CLUSTER_WEATHER_MAP.values() if x is not None], + device_to_ha=EVE_CLUSTER_WEATHER_MAP.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 8cd2fdf6adf..f45baf8729d 100644 --- a/homeassistant/components/matter/strings.json +++ b/homeassistant/components/matter/strings.json @@ -434,6 +434,15 @@ "pump_speed": { "name": "Rotation speed" }, + "eve_weather_trend": { + "name": "Weather trend", + "state": { + "cloudy": "Cloudy", + "rainy": "Rainy", + "sunny": "Sunny", + "stormy": "Stormy" + } + }, "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 b7aff460d77..eb34c7302e3 100644 --- a/tests/components/matter/snapshots/test_sensor.ambr +++ b/tests/components/matter/snapshots/test_sensor.ambr @@ -2906,6 +2906,68 @@ 'state': '16.03', }) # --- +# name: test_sensors[eve_weather_sensor][sensor.eve_weather_weather_trend-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'sunny', + 'cloudy', + 'rainy', + 'stormy', + ]), + }), + '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', + 'options': list([ + 'sunny', + 'cloudy', + 'rainy', + 'stormy', + ]), + }), + 'context': , + 'entity_id': 'sensor.eve_weather_weather_trend', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'rainy', + }) +# --- # name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry] EntityRegistryEntrySnapshot({ 'aliases': set({