8000 Add translatable states to oven mode in SmartThings by joostlek · Pull Request #139356 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add translatable states to oven mode in SmartThings #139356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions homeassistant/components/smartthings/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,34 @@
"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."""
Expand Down Expand Up @@ -435,6 +463,9 @@ class SmartThingsSensorEntityDescription(SensorEntityDescription):
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),
)
]
},
Expand Down
33 changes: 32 additions & 1 deletion homeassistant/components/smartthings/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%]"
Expand Down
62 changes: 59 additions & 3 deletions tests/components/smartthings/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand All @@ -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]
Expand Down
0