How djtimca/hasatellitetracker works
Project type and purpose
• This is a Home Assistant custom integration (plugin) named “SatelliteTracker” that uses the N2YO API to provide two kinds of entities:
• A “location” sensor showing satellites overhead,
• A “satellite” integration with multiple sensors for visible passes and a device tracker for plotting satellite position on your Home Assistant map.
File structure
• Top-level:
• .gitignore, LICENSE, README.md, hacs.json, info.md (project metadata)
• custom_components/satellitetracker/ (actual integration code)
• Inside satellitetracker/:
• manifest.json (HASS metadata, requirements, version, dependencies)
• config_flow.py (defines the UI flow for adding/configuring the integration)
• const.py (static strings, API base URLs, default settings)
• binary_sensor.py, sensor.py, device_tracker.py (three platform modules registering different entity types)
• __init__.py (entry point for setup, loading platforms)
• Localization: strings.json, translations/sk.json
README for additional insights
• It describes two setup modes (“Location” vs. “Satellite”), each creating different entity sets.
• Mentions N2YO API key, rate-limit considerations, configurable polling intervals and radii/minimum pass durations.
Main components
a. Home Assistant Core (blue rectangle)
• Component registry & entity/state machine (could be a sub-component)
• Frontend (UI) for configuration and dashboards
b. SatelliteTracker Integration (orange rectangle inside Core)
• config_flow.py (Config Entry handler)
• __init__.py (setup, coordinator initialization)
• Update Coordinator (internal helper to schedule API calls)
• Platforms:
• Binary Sensor Platform (binary_sensor.py)
• Sensor Platform (sensor.py)
• Device Tracker Platform (device_tracker.py)
• Constants & localization (const.py, strings.json, translations)
• Endpoints for current satellites overhead and next visible passes
d. Home Assistant UI / User (optional to show user interaction)
Relationships and interactions
• The user (via Home Assistant UI) initiates the Config Flow → calls config_flow.py → creates a Config Entry.
• On integration setup (__init__.py), an Update Coordinator is instantiated using API key and user-provided parameters (lat, long, elevation, category or NORAD ID, etc.).
• The Coordinator regularly calls the N2YO API (external service) based on the polling interval.
• API responses are parsed and pushed to the registered entity platforms.
• Each platform module registers its entities with the Core’s entity registry, which updates the state machine.
• The UI/dashboard fetches entity states from the state machine and displays sensor/device tracker data.
Architectural patterns and design principles
• Home Assistant Integration Pattern: use of Config Flow, Config Entries, platforms per entity type.
• Update Coordinator: centralizes polling and throttling, respects API rate limits.
• Entity Model: separate modules for each entity type for maintainability.
• Decoupling: business logic (API calls, data parsing) separated from Home Assistant plumbing.
• Localization: strings and translations externalized.
Key details to capture
• Config Entry lifecycle
• Update polling logic and intervals
• Distinct entity types (binary_sensor, sensor, device_tracker)
• Localization and manifest metadata