feat: enhance operational capabilities by adding completion_minutes and updating related logic; remove completion_time references

This commit is contained in:
Jeroen Hof committed 2026-07-24 15:35:17 +02:00
1 parent 7be91b56e8
commit 365a1c4722
8 files changed
+95 -85

No files matched your search

-1
View File
@@ -4,7 +4,6 @@
"auto_release_dry",
"child_lock",
"completion_minutes",
"completion_time",
"cycle",
"cycle_active",
"delay_start_hours",
-1
View File
@@ -4,7 +4,6 @@
"buzzer_sound",
"child_lock",
"completion_minutes",
"completion_time",
"cycle",
"cycle_active",
"delay_start_hours",
-1
View File
@@ -6,7 +6,6 @@
"buzzer_sound",
"child_lock",
"completion_minutes",
"completion_time",
"cycle",
"cycle_active",
"delay_start_hours",
-1
View File
@@ -4,7 +4,6 @@
"bubble_soak",
"child_lock",
"completion_minutes",
"completion_time",
"cycle",
"cycle_active",
"delay_start_hours",
-1
View File
@@ -3,7 +3,6 @@
"alarm_code",
"child_lock",
"completion_minutes",
"completion_time",
"cycle",
"cycle_active",
"delay_start_hours",
+2 -2
View File
@@ -4,11 +4,11 @@ from custom_components.localthings.registry.capabilities import laundry
class TestCourseHelpers:
def test_parses_edit_course_list(self):
raw = 'EditCourseList_1C1D211B1E29243328262722202325322F2E30662D8F962b2a'
raw = 'EditCourseList_1C1D211B1E29243328262722202325322F2E30662D8F962B2A'
assert laundry.parse_edit_course_list(raw) == [
'1C', '1D', '21', '1B', '1E', '29', '24', '33', '28', '26', '27',
'22', '20', '23', '25', '32', '2F', '2E', '30', '66', '2D', '8F', '96',
'2b', '2a'
'2B', '2A'
]
def test_parse_edit_course_list_handles_missing_or_malformed(self):
+22 -17
View File
@@ -1,3 +1,5 @@
"""Unit tests for operational state capabilities."""
from custom_components.localthings.registry.capabilities.operational import OPERATIONAL_STATE
@@ -24,18 +26,8 @@ class TestProgressPercentage:
assert desc.rep_fn(rep) == 42
class TestCompletionTime:
"""Unit tests for completion_time and completion_minutes entities."""
def test_completion_time_string(self):
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_time')
rep = {'x.com.samsung.da.remainingTime': '01:25:30'}
assert desc.rep_fn(rep) == '01:25:30'
def test_completion_time_fallback(self):
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_time')
rep = {'remainingTime': '00:45:00'}
assert desc.rep_fn(rep) == '00:45:00'
class TestCompletionMinutes:
"""Unit tests for completion_minutes entity."""
def test_completion_minutes_parsing(self):
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_minutes')
@@ -48,13 +40,26 @@ class TestCompletionTime:
rep_exact = {'x.com.samsung.da.remainingTime': '01:30:00'}
assert desc.rep_fn(rep_exact) == 90
def test_completion_time_missing_or_invalid(self):
desc_time = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_time')
desc_min = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_minutes')
def test_completion_minutes_fallback_key(self):
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_minutes')
rep = {'remainingTime': '00:45:00'}
assert desc.rep_fn(rep) == 45
def test_completion_minutes_stale_finish_gated(self):
"""Firmware freezes remainingTime at '00:01:00' when progress reaches 'Finish'.
Should return 0 to prevent stuck values."""
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_minutes')
rep = {
'x.com.samsung.da.progress': 'Finish',
'x.com.samsung.da.remainingTime': '00:01:00',
}
assert desc.rep_fn(rep) == 0
def test_completion_minutes_missing_or_invalid(self):
desc = next(e for e in OPERATIONAL_STATE.entities if e.key == 'completion_minutes')
rep = {}
assert desc_time.rep_fn(rep) is None
assert desc_min.rep_fn(rep) is None
assert desc.rep_fn(rep) is None
class TestDelayFieldFallback: