Add translatable states to washer machine state in SmartThings (#139366)

This commit is contained in:
Joost Lekkerkerker 2025-02-26 17:34:29 +01:00 committed by GitHub
parent 5e5fd6a2f2
commit 92268f894a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 4 deletions

View File

@ -93,6 +93,8 @@ OVEN_MODE = {
"Rinse": "rinse",
}
WASHER_OPTIONS = ["pause", "run", "stop"]
def power_attributes(status: dict[str, Any]) -> dict[str, Any]:
"""Return the power attributes."""
@ -242,7 +244,7 @@ CAPABILITY_TO_SENSORS: dict[
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
translation_key="dishwasher_machine_state",
options=["pause", "run", "stop"],
options=WASHER_OPTIONS,
device_class=SensorDeviceClass.ENUM,
)
],
@ -847,6 +849,8 @@ CAPABILITY_TO_SENSORS: dict[
SmartThingsSensorEntityDescription(
key=Attribute.MACHINE_STATE,
translation_key="washer_machine_state",
options=WASHER_OPTIONS,
device_class=SensorDeviceClass.ENUM,
)
],
Attribute.WASHER_JOB_STATE: [

View File

@ -326,7 +326,12 @@
"name": "Washer mode"
},
"washer_machine_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]",
"state": {
"pause": "[%key:common::state::paused%]",
"run": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::state::run%]",
"stop": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::state::stop%]"
}
},
"washer_job_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]"

View File

@ -3798,7 +3798,13 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'options': list([
'pause',
'run',
'stop',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
@ -3816,7 +3822,7 @@
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Machine state',
'platform': 'smartthings',
@ -3830,7 +3836,13 @@
# name: test_all_entities[da_wm_wm_000001][sensor.washer_machine_state-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Washer Machine state',
'options': list([
'pause',
'run',
'stop',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.washer_machine_state',