Add translatable states to oven mode in SmartThings (#139356)

This commit is contained in:
Joost Lekkerkerker 2025-02-26 16:59:20 +01:00 committed by GitHub
parent 775a81829b
commit fc1190dafd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 122 additions and 4 deletions

View File

@ -53,6 +53,34 @@ MEDIA_PLAYBACK_STATE_MAP = {
"fast forwarding": "fast_forwarding",
}
OVEN_MODE = {
"Conventional": "conventional",
"Bake": "bake",
"BottomHeat": "bottom_heat",
"ConvectionBake": "convection_bake",
"ConvectionRoast": "convection_roast",
"Broil": "broil",
"ConvectionBroil": "convection_broil",
"SteamCook": "steam_cook",
"SteamBake": "steam_bake",
"SteamRoast": "steam_roast",
"SteamBottomHeatplusConvection": "steam_bottom_heat_plus_convection",
"Microwave": "microwave",
"MWplusGrill": "microwave_plus_grill",
"MWplusConvection": "microwave_plus_convection",
"MWplusHotBlast": "microwave_plus_hot_blast",
"MWplusHotBlast2": "microwave_plus_hot_blast_2",
"SlimMiddle": "slim_middle",
"SlimStrong": "slim_strong",
"SlowCook": "slow_cook",
"Proof": "proof",
"Dehydrate": "dehydrate",
"Others": "others",
"StrongSteam": "strong_steam",
"Descale": "descale",
"Rinse": "rinse",
}
def power_attributes(status: dict[str, Any]) -> dict[str, Any]:
"""Return the power attributes."""
@ -435,6 +463,9 @@ CAPABILITY_TO_SENSORS: dict[
key=Attribute.OVEN_MODE,
translation_key="oven_mode",
entity_category=EntityCategory.DIAGNOSTIC,
options=list(OVEN_MODE.values()),
device_class=SensorDeviceClass.ENUM,
value_fn=lambda value: OVEN_MODE.get(value, value),
)
]
},

View File

@ -170,7 +170,38 @@
"name": "Odor sensor"
},
"oven_mode": {
"name": "Oven mode"
"name": "Oven mode",
"state": {
"heating": "Heating",
"grill": "Grill",
"warming": "Warming",
"defrosting": "Defrosting",
"conventional": "Conventional",
"bake": "Bake",
"bottom_heat": "Bottom heat",
"convection_bake": "Convection bake",
"convection_roast": "Convection roast",
"broil": "Broil",
"convection_broil": "Convection broil",
"steam_cook": "Steam cook",
"steam_bake": "Steam bake",
"steam_roast": "Steam roast",
"steam_bottom_heat_plus_convection": "Steam bottom heat plus convection",
"microwave": "Microwave",
"microwave_plus_grill": "Microwave plus grill",
"microwave_plus_convection": "Microwave plus convection",
"microwave_plus_hot_blast": "Microwave plus hot blast",
"microwave_plus_hot_blast_2": "Microwave plus hot blast 2",
"slim_middle": "Slim middle",
"slim_strong": "Slim strong",
"slow_cook": "Slow cook",
"proof": "Proof",
"dehydrate": "Dehydrate",
"others": "Others",
"strong_steam": "Strong steam",
"descale": "Descale",
"rinse": "Rinse"
}
},
"oven_machine_state": {
"name": "[%key:component::smartthings::entity::sensor::dishwasher_machine_state::name%]"

View File

@ -1852,7 +1852,35 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'options': list([
'conventional',
'bake',
'bottom_heat',
'convection_bake',
'convection_roast',
'broil',
'convection_broil',
'steam_cook',
'steam_bake',
'steam_roast',
'steam_bottom_heat_plus_convection',
'microwave',
'microwave_plus_grill',
'microwave_plus_convection',
'microwave_plus_hot_blast',
'microwave_plus_hot_blast_2',
'slim_middle',
'slim_strong',
'slow_cook',
'proof',
'dehydrate',
'others',
'strong_steam',
'descale',
'rinse',
]),
}),
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
@ -1870,7 +1898,7 @@
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
'original_icon': None,
'original_name': 'Oven mode',
'platform': 'smartthings',
@ -1884,14 +1912,42 @@
# name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_oven_mode-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'enum',
'friendly_name': 'Microwave Oven mode',
'options': list([
'conventional',
'bake',
'bottom_heat',
'convection_bake',
'convection_roast',
'broil',
'convection_broil',
'steam_cook',
'steam_bake',
'steam_roast',
'steam_bottom_heat_plus_convection',
'microwave',
'microwave_plus_grill',
'microwave_plus_convection',
'microwave_plus_hot_blast',
'microwave_plus_hot_blast_2',
'slim_middle',
'slim_strong',
'slow_cook',
'proof',
'dehydrate',
'others',
'strong_steam',
'descale',
'rinse',
]),
}),
'context': <ANY>,
'entity_id': 'sensor.microwave_oven_mode',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'Others',
'state': 'others',
})
# ---
# name: test_all_entities[da_ks_microwave_0101x][sensor.microwave_set_point-entry]