Skip to content

Handle incomplete restored run timers - #242

Open
hypnosiss wants to merge 1 commit into
rgc99:masterfrom
hypnosiss:fix-incomplete-restored-run-timer
Open

Handle incomplete restored run timers#242
hypnosiss wants to merge 1 commit into
rgc99:masterfrom
hypnosiss:fix-incomplete-restored-run-timer

Conversation

@hypnosiss

Copy link
Copy Markdown

Summary

This prevents restored run timers with incomplete start/end times from crashing the coordinator update loop.

When Home Assistant restores an in-progress irrigation run after a restart, the run can still be marked as running/paused while one of the timer boundaries is missing. In that state update_time_remaining() currently attempts to subtract None from datetime, which repeatedly raises:

TypeError: unsupported operand type(s) for -: NoneType and datetime.datetime

The fix treats these incomplete restored timers as expired, resets the timer counters, and lets the run queue continue cleaning itself up instead of keeping the event loop stuck on the exception.

Validation

python3 -m compileall custom_components/irrigation_unlimited tests/test_sequence_run.py
uv run --python /opt/homebrew/bin/python3.14 --with-requirements requirements_test.txt python -m pytest tests/test_sequence_run.py::test_sequence_run_ignores_incomplete_restored_timer tests/test_sequence_run.py::test_run_ignores_incomplete_restored_timer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant