mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Set options for dishwasher job state sensor in SmartThings (#139349)
This commit is contained in:
parent
3c3c4d2641
commit
9262dec444
@ -42,6 +42,13 @@ THERMOSTAT_CAPABILITIES = {
|
|||||||
Capability.THERMOSTAT_MODE,
|
Capability.THERMOSTAT_MODE,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JOB_STATE_MAP = {
|
||||||
|
"preDrain": "pre_drain",
|
||||||
|
"preWash": "pre_wash",
|
||||||
|
"wrinklePrevent": "wrinkle_prevent",
|
||||||
|
"unknown": None,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def power_attributes(status: dict[str, Any]) -> dict[str, Any]:
|
def power_attributes(status: dict[str, Any]) -> dict[str, Any]:
|
||||||
"""Return the power attributes."""
|
"""Return the power attributes."""
|
||||||
@ -194,6 +201,20 @@ CAPABILITY_TO_SENSORS: dict[
|
|||||||
SmartThingsSensorEntityDescription(
|
SmartThingsSensorEntityDescription(
|
||||||
key=Attribute.DISHWASHER_JOB_STATE,
|
key=Attribute.DISHWASHER_JOB_STATE,
|
||||||
translation_key="dishwasher_job_state",
|
translation_key="dishwasher_job_state",
|
||||||
|
options=[
|
||||||
|
"airwash",
|
||||||
|
"cooling",
|
||||||
|
"drying",
|
||||||
|
"finish",
|
||||||
|
"pre_drain",
|
||||||
|
"pre_wash",
|
||||||
|
"rinse",
|
||||||
|
"spin",
|
||||||
|
"wash",
|
||||||
|
"wrinkle_prevent",
|
||||||
|
],
|
||||||
|
device_class=SensorDeviceClass.ENUM,
|
||||||
|
value_fn=lambda value: JOB_STATE_MAP.get(value, value),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
Attribute.COMPLETION_TIME: [
|
Attribute.COMPLETION_TIME: [
|
||||||
|
@ -72,7 +72,19 @@
|
|||||||
"name": "Machine state"
|
"name": "Machine state"
|
||||||
},
|
},
|
||||||
"dishwasher_job_state": {
|
"dishwasher_job_state": {
|
||||||
"name": "Job state"
|
"name": "Job state",
|
||||||
|
"state": {
|
||||||
|
"airwash": "Airwash",
|
||||||
|
"cooling": "Cooling",
|
||||||
|
"drying": "Drying",
|
||||||
|
"finish": "Finish",
|
||||||
|
"pre_drain": "Pre-drain",
|
||||||
|
"pre_wash": "Pre-wash",
|
||||||
|
"rinse": "Rinse",
|
||||||
|
"spin": "Spin",
|
||||||
|
"wash": "Wash",
|
||||||
|
"wrinkle_prevent": "Wrinkle prevention"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"completion_time": {
|
"completion_time": {
|
||||||
"name": "Completion time"
|
"name": "Completion time"
|
||||||
|
@ -2739,7 +2739,20 @@
|
|||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'capabilities': None,
|
'capabilities': dict({
|
||||||
|
'options': list([
|
||||||
|
'airwash',
|
||||||
|
'cooling',
|
||||||
|
'drying',
|
||||||
|
'finish',
|
||||||
|
'pre_drain',
|
||||||
|
'pre_wash',
|
||||||
|
'rinse',
|
||||||
|
'spin',
|
||||||
|
'wash',
|
||||||
|
'wrinkle_prevent',
|
||||||
|
]),
|
||||||
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
'config_subentry_id': <ANY>,
|
'config_subentry_id': <ANY>,
|
||||||
'device_class': None,
|
'device_class': None,
|
||||||
@ -2757,7 +2770,7 @@
|
|||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
}),
|
}),
|
||||||
'original_device_class': None,
|
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
'original_name': 'Job state',
|
'original_name': 'Job state',
|
||||||
'platform': 'smartthings',
|
'platform': 'smartthings',
|
||||||
@ -2771,7 +2784,20 @@
|
|||||||
# name: test_all_entities[da_wm_dw_000001][sensor.dishwasher_job_state-state]
|
# name: test_all_entities[da_wm_dw_000001][sensor.dishwasher_job_state-state]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'enum',
|
||||||
'friendly_name': 'Dishwasher Job state',
|
'friendly_name': 'Dishwasher Job state',
|
||||||
|
'options': list([
|
||||||
|
'airwash',
|
||||||
|
'cooling',
|
||||||
|
'drying',
|
||||||
|
'finish',
|
||||||
|
'pre_drain',
|
||||||
|
'pre_wash',
|
||||||
|
'rinse',
|
||||||
|
'spin',
|
||||||
|
'wash',
|
||||||
|
'wrinkle_prevent',
|
||||||
|
]),
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'sensor.dishwasher_job_state',
|
'entity_id': 'sensor.dishwasher_job_state',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user