Matter Custom Eve Weather trend (#147620)

This commit is contained in:
Ludovic BOUÉ
2025-08-18 11:32:08 +02:00
committed by GitHub
parent 330bb46cf9
commit 2f5561aeba
4 changed files with 101 additions and 0 deletions

View File

@@ -57,6 +57,15 @@
"current_phase": { "current_phase": {
"default": "mdi:state-machine" "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": { "air_quality": {
"default": "mdi:air-filter" "default": "mdi:air-filter"
}, },

View File

@@ -70,6 +70,14 @@ CONTAMINATION_STATE_MAP = {
clusters.SmokeCoAlarm.Enums.ContaminationStateEnum.kCritical: "critical", 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 = { OPERATIONAL_STATE_MAP = {
# enum with known Operation state values which we can translate # enum with known Operation state values which we can translate
clusters.OperationalState.Enums.OperationalStateEnum.kStopped: "stopped", clusters.OperationalState.Enums.OperationalStateEnum.kStopped: "stopped",
@@ -517,6 +525,19 @@ DISCOVERY_SCHEMAS = [
entity_class=MatterSensor, entity_class=MatterSensor,
required_attributes=(EveCluster.Attributes.Pressure,), 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( MatterDiscoverySchema(
platform=Platform.SENSOR, platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription( entity_description=MatterSensorEntityDescription(

View File

@@ -434,6 +434,15 @@
"pump_speed": { "pump_speed": {
"name": "Rotation speed" "name": "Rotation speed"
}, },
"eve_weather_trend": {
"name": "Weather trend",
"state": {
"cloudy": "Cloudy",
"rainy": "Rainy",
"sunny": "Sunny",
"stormy": "Stormy"
}
},
"evse_circuit_capacity": { "evse_circuit_capacity": {
"name": "Circuit capacity" "name": "Circuit capacity"
}, },

View File

@@ -2906,6 +2906,68 @@
'state': '16.03', '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] # name: test_sensors[extractor_hood][sensor.mock_extractor_hood_activated_carbon_filter_condition-entry]
EntityRegistryEntrySnapshot({ EntityRegistryEntrySnapshot({
'aliases': set({ 'aliases': set({