Compare commits

...

1 Commits

Author SHA1 Message Date
Ludovic BOUÉ
75d02661eb Add Setpoint Change Source sensor and localization strings 2025-11-14 17:19:28 +00:00
4 changed files with 88 additions and 0 deletions

View File

@@ -183,6 +183,13 @@ PUMP_CONTROL_MODE_MAP = {
clusters.PumpConfigurationAndControl.Enums.ControlModeEnum.kUnknownEnumValue: None,
}
SETPOINT_CHANGE_SOURCE_MAP = {
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kManual: "manual",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kSchedule: "schedule",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kExternal: "external",
clusters.Thermostat.Enums.SetpointChangeSourceEnum.kUnknownEnumValue: None,
}
HUMIDITY_SCALING_FACTOR = 100
TEMPERATURE_SCALING_FACTOR = 100
@@ -1488,4 +1495,16 @@ DISCOVERY_SCHEMAS = [
entity_class=MatterSensor,
required_attributes=(clusters.ServiceArea.Attributes.EstimatedEndTime,),
),
MatterDiscoverySchema(
platform=Platform.SENSOR,
entity_description=MatterSensorEntityDescription(
key="SetpointChangeSource",
translation_key="setpoint_change_source",
device_class=SensorDeviceClass.ENUM,
options=[v for v in SETPOINT_CHANGE_SOURCE_MAP.values() if v is not None],
device_to_ha=SETPOINT_CHANGE_SOURCE_MAP.get,
),
entity_class=MatterSensor,
required_attributes=(clusters.Thermostat.Attributes.SetpointChangeSource,),
),
]

View File

@@ -518,6 +518,14 @@
"rms_voltage": {
"name": "Effective voltage"
},
"setpoint_change_source": {
"name": "Setpoint change source",
"state": {
"external": "External",
"manual": "Manual",
"schedule": "Schedule"
}
},
"switch_current_position": {
"name": "Current switch position"
},

View File

@@ -334,6 +334,7 @@
"1/513/27": 4,
"1/513/28": 3,
"1/513/30": 0,
"1/513/48": 0,
"1/513/65532": 35,
"1/513/65533": 5,
"1/513/65528": [],

View File

@@ -10507,6 +10507,66 @@
'state': '12.5',
})
# ---
# name: test_sensors[thermostat][sensor.longan_link_hvac_setpoint_change_source-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'options': list([
'manual',
'schedule',
'external',
]),
}),
'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.longan_link_hvac_setpoint_change_source',
'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': 'Setpoint change source',
'platform': 'matter',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'setpoint_change_source',
'unique_id': '00000000000004D2-0000000000000004-MatterNodeDevice-1-SetpointChangeSource-513-48',
'unit_of_measurement': None,
})
# ---
# name: test_sensors[thermostat][sensor.longan_link_hvac_setpoint_change_source-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Longan link HVAC Setpoint change source',
'options': list([
'manual',
'schedule',
'external',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.longan_link_hvac_setpoint_change_source',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'manual',
})
# ---
# name: test_sensors[thermostat][sensor.longan_link_hvac_temperature-entry]
EntityRegistryEntrySnapshot({
'aliases': set({