Fixed battery check, added tested, show IP and cleaned code#27
Merged
Bekkie merged 8 commits intoAmpScm:mainfrom Feb 14, 2026
Merged
Fixed battery check, added tested, show IP and cleaned code#27Bekkie merged 8 commits intoAmpScm:mainfrom
Bekkie merged 8 commits intoAmpScm:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes device battery-state handling in the state manager, adds server IP reporting during startup/mDNS registration, and introduces a comprehensive routes.py integration-style test suite backed by a real SQLite test DB.
Changes:
- Include
battery_statewhen loading device metadata so battery checks aren’t silently skipped. - Add “primary IPv4” detection and expose/log the server IP on startup and mDNS registration; extend
register_service_asyncto return the IP. - Add a large FastAPI routes test suite using a temporary SQLite DB with mock API calls.
Reviewed changes
Copilot reviewed 6 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_zeroconf_register.py | Updates test to unpack the new register_service_async return shape. |
| tests/test_routes.py | Adds end-to-end-ish route tests using a real SQLite DB + FastAPI TestClient. |
| tado_local/zeroconf_register.py | Exposes get_primary_ipv4() and returns IP from mDNS registration. |
| tado_local/main.py | Logs API URLs using detected server IP; logs IP during mDNS registration. |
| tado_local/state.py | Ensures battery_state is included in device queries/caches. |
| tado_local/routes.py | Minor formatting-only change in the shown hunk. |
| tado_local/sync.py | Formatting-only whitespace cleanup in the shown hunk. |
| tado_local/api.py | Formatting-only whitespace cleanup in the shown hunk. |
| tado_local/homekit_uuids.py | Formatting-only change (no functional delta). |
| demos/zone-manager.py | Formatting-only whitespace cleanup in the shown hunks. |
| requirements-dev.txt | Adds pytest-httpx to dev requirements. |
Comments suppressed due to low confidence (1)
tado_local/zeroconf_register.py:51
- register_service_async returns tuple of size 3 and tuple of size 4.
register_service_async returns tuple of size 3 and tuple of size 4.
async def register_service_async(name: str = 'tado-local', port: int = 4407, props: Optional[Dict[str, str]] = None, service_type: Optional[str] = None, advertise_addr: Optional[str] = None):
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed: battery check, database field was not loaded for devices, therefore battery check was ignored
New: show server IP address on start up and on mDNS registration
Added: routes.py test set, which actually uses database (with mock data) and real http-server-calls
Cleaned a lot ruff warnings