Add translatable states to robot cleaner movement in SmartThings (#139363)

This commit is contained in:
Joost Lekkerkerker 2025-02-26 17:25:50 +01:00 committed by GitHub
parent 51099ae7d6
commit cadee73da8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 59 additions and 3 deletions

View File

@ -61,6 +61,10 @@ MEDIA_PLAYBACK_STATE_MAP = {
"fast forwarding": "fast_forwarding",
}
ROBOT_CLEANER_MOVEMENT_MAP = {
"powerOff": "off",
}
OVEN_MODE = {
"Conventional": "conventional",
"Bake": "bake",
@ -625,6 +629,20 @@ CAPABILITY_TO_SENSORS: dict[
SmartThingsSensorEntityDescription(
key=Attribute.ROBOT_CLEANER_MOVEMENT,
translation_key="robot_cleaner_movement",
options=[
"homing",
"idle",
"charging",
"alarm",
"off",
"reserve",
"point",
"after",
"cleaning",
"pause",
],
device_class=SensorDeviceClass.ENUM,
value_fn=lambda value: ROBOT_CLEANER_MOVEMENT_MAP.get(value, value),
)
]
},

View File

@ -255,7 +255,19 @@
"name": "Cleaning mode"
},
"robot_cleaner_movement": {
"name": "Movement"
"name": "Movement",
"state": {
"homing": "Homing",
"idle": "[%key:common::state::idle%]",
"charging": "[%key:common::state::charging%]",
"alarm": "Alarm",
"off": "[%key:common::state::off%]",
"reserve": "Reserve",
"point": "Point",
"after": "After",
"cleaning": "Cleaning",
"pause": "[%key:common::state::paused%]"
}
},
"robot_cleaner_turbo_mode": {
"name": "Turbo mode"

View File

@ -2563,7 +2563,20 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'options': list([
'homing',
'idle',
'charging',
'alarm',
'off',
'reserve',
'point',
'after',
'cleaning',
'pause',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
@ -2581,7 +2594,7 @@
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Movement',
'platform': 'smartthings',
@ -2595,7 +2608,20 @@
# name: test_all_entities[da_rvc_normal_000001][sensor.robot_vacuum_movement-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Robot vacuum Movement',
'options': list([
'homing',
'idle',
'charging',
'alarm',
'off',
'reserve',
'point',
'after',
'cleaning',
'pause',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.robot_vacuum_movement',