Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions homeassistant/components/matter/icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 21 additions & 0 deletions homeassistant/components/matter/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
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",
Expand Down Expand Up @@ -517,6 +525,19 @@ 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,
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(
Expand Down
9 changes: 9 additions & 0 deletions homeassistant/components/matter/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
62 changes: 62 additions & 0 deletions tests/components/matter/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'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': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'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': <ANY>,
'entity_id': 'sensor.eve_weather_weather_trend',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'rainy',
})
# ---
# name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
Expand Down