Python client for the Baby Tracker sync server, reverse engineered from the Android app (4.53), and a HACS-installable Home Assistant integration built on it. Each baby gets a log calendar and summary sensors, and actions add entries that sync back to the group. Reading has been run against the real server. Uploading and running inside real Home Assistant have not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
734 B
Python
21 lines
734 B
Python
"""Makes ``import babytracker_api`` work without Home Assistant.
|
|
|
|
The library is loaded by path because the integration folder holds a calendar.py,
|
|
which would hide Python's own calendar module if that folder were on sys.path.
|
|
"""
|
|
|
|
import importlib.util
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
LIBRARY = ROOT / "custom_components" / "babytracker" / "babytracker_api"
|
|
|
|
if "babytracker_api" not in sys.modules:
|
|
spec = importlib.util.spec_from_file_location(
|
|
"babytracker_api", LIBRARY / "__init__.py", submodule_search_locations=[str(LIBRARY)]
|
|
)
|
|
module = importlib.util.module_from_spec(spec)
|
|
sys.modules["babytracker_api"] = module
|
|
spec.loader.exec_module(module)
|