diff --git a/custom_components/localthings/manifest.json b/custom_components/localthings/manifest.json index 799740b..e1c770b 100644 --- a/custom_components/localthings/manifest.json +++ b/custom_components/localthings/manifest.json @@ -12,5 +12,5 @@ "pyOpenSSL>=23.0", "smartthings-local>=0.1.0" ], - "version": "0.4.0" + "version": "0.4.1" } diff --git a/custom_components/localthings/registry/capabilities/operational.py b/custom_components/localthings/registry/capabilities/operational.py index 8056a9f..bc9efb2 100644 --- a/custom_components/localthings/registry/capabilities/operational.py +++ b/custom_components/localthings/registry/capabilities/operational.py @@ -75,7 +75,9 @@ OPERATIONAL_STATE = Capability( poll_tier='hot', entities=( SensorDesc(key='machine_state', field='x.com.samsung.da.state', - name='Machine state', value_fn=_to_ocf), + name='Machine state', device_class='enum', + options=('idle', 'active', 'pause'), + translation_key='machine_state', value_fn=_to_ocf), # cycle_active is a bool derived from machine_state; used by the # adapter to gate oven writes (cycle_active_field='cycle_active'). # Harmless for non-oven appliances — just an extra bool in state. diff --git a/custom_components/localthings/registry/capabilities/oven.py b/custom_components/localthings/registry/capabilities/oven.py index 2780335..764d66c 100644 --- a/custom_components/localthings/registry/capabilities/oven.py +++ b/custom_components/localthings/registry/capabilities/oven.py @@ -223,7 +223,9 @@ OVEN_OPERATIONAL_STATE = Capability( poll_tier='hot', entities=( SensorDesc(key='machine_state', field='x.com.samsung.da.state', - name='Machine state', icon='mdi:stove', value_fn=_to_ocf), + name='Machine state', icon='mdi:stove', + device_class='enum', options=('idle', 'active', 'pause'), + translation_key='machine_state', value_fn=_to_ocf), BinarySensorDesc(key='cycle_active', field='x.com.samsung.da.state', name='Cycle active', device_class='running', value_fn=lambda v: _SAMSUNG_STATE_TO_OCF.get(v) == 'active'), diff --git a/custom_components/localthings/strings.json b/custom_components/localthings/strings.json index 5fe72c9..c6220ef 100644 --- a/custom_components/localthings/strings.json +++ b/custom_components/localthings/strings.json @@ -115,6 +115,13 @@ "observe": "Push (observe)", "poll": "Polling" } + }, + "machine_state": { + "state": { + "idle": "Idle", + "active": "Active", + "pause": "Paused" + } } } }, diff --git a/custom_components/localthings/translations/en.json b/custom_components/localthings/translations/en.json index 5fe72c9..c6220ef 100644 --- a/custom_components/localthings/translations/en.json +++ b/custom_components/localthings/translations/en.json @@ -115,6 +115,13 @@ "observe": "Push (observe)", "poll": "Polling" } + }, + "machine_state": { + "state": { + "idle": "Idle", + "active": "Active", + "pause": "Paused" + } } } },