Skip to content

Fixed battery check, added tested, show IP and cleaned code#27

Merged
Bekkie merged 8 commits intoAmpScm:mainfrom
Bekkie:main
Feb 14, 2026
Merged

Fixed battery check, added tested, show IP and cleaned code#27
Bekkie merged 8 commits intoAmpScm:mainfrom
Bekkie:main

Conversation

@Bekkie
Copy link
Collaborator

@Bekkie Bekkie commented Jan 30, 2026

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_state when 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_async to 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

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.

Bekkie and others added 2 commits February 7, 2026 00:49
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Bekkie Bekkie merged commit 67a0278 into AmpScm:main Feb 14, 2026
5 checks passed
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.

2 participants