Skip to content

Commit

Permalink
update next reset description
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Apr 2, 2024
1 parent ab18073 commit 750580b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sml2mqtt/sml_value/operations/date_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/sml_values/test_operations/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions tests/sml_values/test_operations/test_date_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 750580b

Please sign in to comment.