Add translatable states to oven job state in SmartThings (#139361)

This commit is contained in:
Joost Lekkerkerker 2025-02-26 17:12:27 +01:00 committed by GitHub
parent fc1190dafd
commit b777c29bab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 91 additions and 3 deletions

View File

@ -49,6 +49,14 @@ JOB_STATE_MAP = {
"unknown": None,
}
OVEN_JOB_STATE_MAP = {
"scheduledStart": "scheduled_start",
"fastPreheat": "fast_preheat",
"scheduledEnd": "scheduled_end",
"stone_heating": "stone_heating",
"timeHoldPreheat": "time_hold_preheat",
}
MEDIA_PLAYBACK_STATE_MAP = {
"fast forwarding": "fast_forwarding",
}
@ -480,6 +488,27 @@ CAPABILITY_TO_SENSORS: dict[
SmartThingsSensorEntityDescription(
key=Attribute.OVEN_JOB_STATE,
translation_key="oven_job_state",
options=[
"cleaning",
"cooking",
"cooling",
"draining",
"preheat",
"ready",
"rinsing",
"finished",
"scheduled_start",
"warming",
"defrosting",
"sensing",
"searing",
"fast_preheat",
"scheduled_end",
"stone_heating",
"time_hold_preheat",
],
device_class=SensorDeviceClass.ENUM,
value_fn=lambda value: OVEN_JOB_STATE_MAP.get(value, value),
)
],
Attribute.COMPLETION_TIME: [

View File

@ -207,7 +207,26 @@
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"
},
"oven_job_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]"
"name": "[%key:component::smartthings::entity::sensor::dishwasher_job_state::name%]",
"state": {
"cleaning": "Cleaning",
"cooking": "Cooking",
"cooling": "Cooling",
"draining": "Draining",
"preheat": "Preheat",
"ready": "Ready",
"rinsing": "Rinsing",
"finished": "Finished",
"scheduled_start": "Scheduled start",
"warming": "Warming",
"defrosting": "Defrosting",
"sensing": "Sensing",
"searing": "Searing",
"fast_preheat": "Fast preheat",
"scheduled_end": "Scheduled end",
"stone_heating": "Stone heating",
"time_hold_preheat": "Time hold preheat"
}
},
"oven_setpoint": {
"name": "Set point"

View File

@ -1758,7 +1758,27 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'options': list([
'cleaning',
'cooking',
'cooling',
'draining',
'preheat',
'ready',
'rinsing',
'finished',
'scheduled_start',
'warming',
'defrosting',
'sensing',
'searing',
'fast_preheat',
'scheduled_end',
'stone_heating',
'time_hold_preheat',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
@ -1776,7 +1796,7 @@
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Job state',
'platform': 'smartthings',
@ -1790,7 +1810,27 @@
# name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_job_state-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Microwave Job state',
'options': list([
'cleaning',
'cooking',
'cooling',
'draining',
'preheat',
'ready',
'rinsing',
'finished',
'scheduled_start',
'warming',
'defrosting',
'sensing',
'searing',
'fast_preheat',
'scheduled_end',
'stone_heating',
'time_hold_preheat',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.microwave_job_state',