diff --git a/src/sml2mqtt/sml_value/operations/date_time.py b/src/sml2mqtt/sml_value/operations/date_time.py index db8a472..0e1313c 100644 --- a/src/sml2mqtt/sml_value/operations/date_time.py +++ b/src/sml2mqtt/sml_value/operations/date_time.py @@ -40,7 +40,7 @@ def describe(self, indent: str = '') -> Generator[str, None, None]: return None yield f'{indent:s} Next resets:' - yield f'{indent:s} - {self._next_reset}' + yield f'{indent:s} - {self._next_reset if self._next_reset >= get_now() else "now"}' next_dt = self._next_reset diff --git a/tests/sml_values/test_operations/helper.py b/tests/sml_values/test_operations/helper.py index 2a70668..d794ef2 100644 --- a/tests/sml_values/test_operations/helper.py +++ b/tests/sml_values/test_operations/helper.py @@ -33,7 +33,7 @@ def check_description(obj: ValueOperationBase, value: str | Iterable[str]): # Object names should be title case for line in desc: if ' - ' in line or line.startswith('- '): - if '- 2001' in line: + if '- 2001' in line or '- now' in line: continue if 'On Change Filter' not in line and 'Zero Meter Filter' not in line and 'Negative On Status' not in line: diff --git a/tests/sml_values/test_operations/test_date_time.py b/tests/sml_values/test_operations/test_date_time.py index 5f59d10..8cbc711 100644 --- a/tests/sml_values/test_operations/test_date_time.py +++ b/tests/sml_values/test_operations/test_date_time.py @@ -280,6 +280,18 @@ def test_max_description(now): ] ) + now.set(datetime(2001, 1, 1, 2, 0, 1)) + check_description( + o, [ + '- Max Value:', + ' max: None', + ' Next resets:', + ' - now', + ' - 2001-01-02 02:00:00', + ' - 2001-01-03 02:00:00', + ] + ) + def test_min_start_now(now): f = DateTimeFinder()