A Python toolkit for monitoring and analyzing Starlink connectivity performance.
- Performance reporting over customizable time periods
- Data export to JSON format
- Command-line interface for easy access
Clone the repository:
Python tools for remotely accessing and monitoring Starlink devices using cookie-based authentication.
This repository provides example scripts for interacting with Starlink devices remotely. The main script demonstrates how to:
- Authenticate using cookies
- Retrieve account information
- List service lines and dishes
- Get dish status and alerts
- View router/WiFi information
- List connected clients
- Clone this repository:
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py- Install required dependencies:
pip install -r requirements.txt-
Create a
cookies.jsonfile with your Starlink authentication cookies:- Copy
cookies.json.exampletocookies.json - Update it with your actual authentication cookies from your browser
- You can export cookies from your browser using browser developer tools or a cookie export extension
- Copy
-
Example
cookies.jsonstructure:
[
{
"name": "cookie_name",
"value": "cookie_value",
"domain": ".starlink.com",
"path": "/",
"secure": true,
"httpOnly": false
}
]Run the remote access example script:
python remote_access_example.pyThe script will:
- Read authentication cookies from
cookies.json - Connect to your Starlink account
- Retrieve and display information about:
- Dishes (ID, serial number, status, alerts)
- Routers (ID, software version)
- WiFi networks (2.4GHz and 5GHz SSIDs)
- Connected clients
-------------------------
DISH_ID: dish_12345
Dish Serial: UT12345678901234
Dish Status:
alert1: value1
alert2: value2
Router ID: router_12345
Software Version: 2024.01.01.mr12345
Networks:
2.4ghz: MyStarlink
5ghz: MyStarlink_5G
Clients:
Device1|192.168.1.100
Device2|192.168.1.101
- Never commit
cookies.jsonto version control - it contains sensitive authentication information - The
cookies.jsonfile is already included in.gitignore - Cookie files stored in
dir_cookiesare also excluded from version control - Keep your authentication cookies secure and rotate them regularly A Python library for interacting with Starlink user terminals via gRPC. This library provides convenient wrappers for common Starlink methods to manage and monitor your Starlink dish.
This library provides methods for:
- Get Status/History: Retrieve current status (connectivity, alerts) and historical data
- Get Network Stats: Download/upload speeds, latency, packet loss
- Get Telemetry: Device alerts, errors, warnings (streaming supported)
- Reboot Dish: Restart the user terminal
- Set Dish Config: Enable/disable features like snow melt mode, power saving
- Get Device Location: Precise location (local) or H3 cell (remote)
- Get WiFi Status: SSID, connected clients
- Change WiFi Config: Modify SSID, passwords, enable bypass mode
- Get Account Data: Basic account info (remote only)
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
pip install -e .pip install starlink_connectivity_tools- Python 3.7 or higher
- grpcio >= 1.50.0
- grpcio-tools >= 1.50.0
from starlink_connectivity_tools import StarlinkClient
# Connect to local Starlink dish (default: 192.168.100.1:9200)
client = StarlinkClient()
# Get current status
status = client.get_status()
print(f"Connected: {status['is_connected']}")
print(f"State: {status['state']}")
print(f"Uptime: {status['uptime']} seconds")
# Get network statistics
stats = client.get_network_stats()
print(f"Download: {stats['download_speed_mbps']} Mbps")
print(f"Upload: {stats['upload_speed_mbps']} Mbps")
print(f"Latency: {stats['latency_ms']} ms")
print(f"Packet Loss: {stats['packet_loss_percent']}%")
# Get WiFi status
wifi = client.get_wifi_status()
print(f"SSID: {wifi['ssid']}")
print(f"Connected Clients: {len(wifi['connected_clients'])}")from starlink_connectivity_tools import StarlinkClient
# Automatically handle connection and disconnection
with StarlinkClient() as client:
status = client.get_status()
print(status)from starlink_connectivity_tools import StarlinkClient
# Connect remotely with authentication token
client = StarlinkClient(
target="remote.starlink.com:9200",
auth_token="your-auth-token"
)
# Get account data (requires authentication)
account = client.get_account_data()
print(f"Email: {account['email']}")
print(f"Service Plan: {account['service_plan']}")from starlink_connectivity_tools import StarlinkClient
# Force secure channel for local connection (optional)
secure_client = StarlinkClient(
target="192.168.100.1:9200",
secure=True
)
# Force insecure channel for testing (not recommended for production)
insecure_client = StarlinkClient(
target="remote.starlink.com:9200",
secure=False # Only for testing/development
)Note: The library automatically detects private IP addresses (RFC 1918: 10.x.x.x, 172.16.x.x-172.31.x.x, 192.168.x.x) and uses insecure channels for them. For all other addresses or when an auth_token is provided, it uses secure SSL/TLS channels.
Retrieve current status of the Starlink dish.
status = client.get_status()
# Returns:
# {
# "uptime": 123456,
# "state": "CONNECTED",
# "alerts": [],
# "is_connected": true,
# "software_version": "1.2.3"
# }Retrieve historical data from the Starlink dish.
history = client.get_history(samples=100)
# Returns:
# {
# "timestamps": [...],
# "download_throughput": [...],
# "upload_throughput": [...],
# "latency": [...],
# "packet_loss": [...],
# "obstructed": [...]
# }Get current network statistics.
stats = client.get_network_stats()
# Returns:
# {
# "download_speed_mbps": 150.5,
# "upload_speed_mbps": 25.3,
# "latency_ms": 35.2,
# "packet_loss_percent": 0.1,
# "uptime_seconds": 123456
# }Retrieve device telemetry including alerts, errors, and warnings.
telemetry = client.get_telemetry()
# Returns:
# {
# "alerts": [...],
# "errors": [...],
# "warnings": [...],
# "temperature_celsius": 45.2,
# "power_usage_watts": 65.5
# }Restart the Starlink user terminal.
result = client.reboot_dish()
# Returns:
# {
# "success": true,
# "message": "Reboot command sent"
# }Configure Starlink dish settings.
result = client.set_dish_config(
snow_melt_mode=True,
power_save_mode=False
)
# Returns:
# {
# "success": true,
# "message": "Configuration updated",
# "updated_config": {...}
# }Get the device location.
# Get precise GPS location (local)
location = client.get_device_location(remote=False)
# Returns:
# {
# "latitude": 47.6062,
# "longitude": -122.3321,
# "altitude": 50.0
# }
# Get H3 cell location (remote)
location = client.get_device_location(remote=True)
# Returns:
# {
# "h3_cell": "8a2a1072b59ffff"
# }Get WiFi status and connected clients.
wifi = client.get_wifi_status()
# Returns:
# {
# "ssid": "STARLINKXXX",
# "enabled": true,
# "channel": 36,
# "connected_clients": [...],
# "signal_strength": -45
# }Modify WiFi configuration.
result = client.change_wifi_config(
ssid="MyNewSSID",
password="newsecurepassword123",
bypass_mode=False
)
# Returns:
# {
# "success": true,
# "message": "WiFi configuration updated",
# "updated_config": {...}
# }Get basic account information (remote only, requires authentication).
account = client.get_account_data()
# Returns:
# {
# "email": "user@example.com",
# "name": "John Doe",
# "service_plan": "Residential",
# "account_number": "ABC123456"
# }The default connection is to the local Starlink dish at 192.168.100.1:9200. This requires you to be on the same network as your Starlink router. Local connections automatically use insecure gRPC channels.
client = StarlinkClient() # Uses default local address with insecure channelThe library automatically detects RFC 1918 private IP addresses and uses insecure channels for them:
- 10.0.0.0/8 (10.x.x.x)
- 172.16.0.0/12 (172.16.x.x - 172.31.x.x)
- 192.168.0.0/16 (192.168.x.x)
For remote connections, you need an authentication token. Remote connections automatically use secure SSL/TLS channels:
client = StarlinkClient(
target="remote.starlink.com:9200",
auth_token="your-auth-token"
)You can override automatic detection with the secure parameter:
# Force secure channel even for local IP
client = StarlinkClient(target="192.168.100.1:9200", secure=True)
# Force insecure channel (not recommended except for testing)
client = StarlinkClient(target="test.local:9200", secure=False)The library raises grpc.RpcError exceptions when gRPC calls fail:
from starlink_connectivity_tools import StarlinkClient
import grpc
client = StarlinkClient()
try:
status = client.get_status()
except grpc.RpcError as e:
print(f"gRPC error: {e.code()} - {e.details()}")
except PermissionError as e:
print(f"Permission error: {e}")# Clone the repository
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
# Install in development mode with dev dependencies
pip install -e ".[dev]"pytest tests/black starlink_connectivity_tools/mypy starlink_connectivity_tools/This library is inspired by and compatible with:
- starlink-client - Multi-language support (Python, Go, JS)
- starlink-grpc-tools - Scripts and tools for Starlink gRPC interaction
- The Starlink gRPC API is unofficial and undocumented
- This library uses reverse-engineered proto files
- API may change without notice as SpaceX updates the firmware
- Local connections do not require authentication
- Remote connections require valid authentication tokens
MIT License - see LICENSE file for details Python tools for interacting with Starlink Enterprises API via gRPC. This library provides a simple interface to monitor and manage Starlink router and dish devices.
- 📡 Get device status and diagnostics
- 🛰️ Monitor ping metrics and network performance
- 🚀 Run speed tests
- 🔧 Retrieve device information
- 🔄 Reboot devices remotely
- 📊 Support for both router and dish devices
- Python 3.7+
- starlink-client library
- protobuf
- grpcio
See LICENSE file for details.
- gRPC
- Protocol Buffers
- Access to Starlink devices on your network
- Clone this repository:
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.pyGenerate a performance report for a specific time period:
python tools/starlink_monitor_cli.py report --hours 48This command generates a performance report for the last 48 hours, showing metrics such as:
- Average latency
- Average download speed
- Average upload speed
- Uptime statistics
Export collected data to a JSON file:
python tools/starlink_monitor_cli.py export --output starlink_data.jsonThis command exports all collected metrics to the specified JSON file for further analysis or archival purposes.
View all available commands and options:
python tools/starlink_monitor_cli.py --helpView help for a specific command:
python tools/starlink_monitor_cli.py report --help
python tools/starlink_monitor_cli.py export --helpThis project is licensed under the Apache License 2.0 - see the LICENSE file for details. 2. Install dependencies:
pip install -r requirements.txt- You'll also need the Starlink protobuf files (
device_pb2.pyanddevice_pb2_grpc.py). These can be generated from the official Starlink protobuf definitions.
The main script provides a CLI for interacting with Starlink devices:
# Get diagnostics from both router and dish
python starlink_client.py --command diagnostics
# Get status from router only
python starlink_client.py --command status --target router
# Run a speed test
python starlink_client.py --command run-speed-test
# Get ping metrics
python starlink_client.py --command ping
# Get device information
python starlink_client.py --command device-info
# Reboot the router
python starlink_client.py --command reboot --target router
# Output to a file in JSON format
python starlink_client.py --command status --format json --output status.json--command, -c: Command to execute (diagnostics, status, ping, reboot, speed-test, run-speed-test, device-info)--target, -t: Target device (router, dish, both) - default: both--router-addr: Router gRPC address - default: 192.168.1.1:9000--dish-addr: Dish gRPC address - default: 192.168.100.1:9200--format, -f: Output format (json, pretty) - default: pretty--output, -o: Output file path (optional)
You can also use the StarlinkClient class directly in your Python code:
from starlink_client import StarlinkClient
# Initialize the client
client = StarlinkClient()
# Get status
status = client.get_status(target="both")
print(status)
# Get diagnostics
diagnostics = client.get_diagnostics(target="router")
print(diagnostics)
# Get ping metrics
ping_metrics = client.get_ping_metrics()
print(ping_metrics)
# Run speed test
speed_test = client.run_speed_test()
print(speed_test)
# Get device info
device_info = client.get_device_info(target="dish")
print(device_info)
# Reboot device
result = client.reboot(target="router")
print(result)If your Starlink devices are on non-standard addresses:
from starlink_client import StarlinkClient
client = StarlinkClient(
router_addr="192.168.2.1:9000",
dish_addr="192.168.100.1:9200"
)
status = client.get_status()The examples/ directory contains various usage examples:
basic_status.py- Get basic status informationget_diagnostics.py- Retrieve detailed diagnosticsping_monitoring.py- Monitor ping metrics (with continuous monitoring option)speed_test.py- Run speed tests and retrieve resultsdevice_info.py- Get detailed device informationcustom_addresses.py- Use custom gRPC addresses
Run an example:
cd examples
python basic_status.pyget_diagnostics(target="both")- Get diagnostic informationget_status(target="both")- Get current statusget_ping_metrics()- Get ping/latency metrics (dish only)get_speed_test()- Get last speed test results (router only)run_speed_test()- Run a new speed test (router only)get_device_info(target="both")- Get device informationreboot(target)- Reboot a device (router or dish)
target: Specifies which device(s) to query"router"- Router only"dish"- Dish only"both"- Both devices (where applicable)
- Router:
192.168.1.1:9000 - Dish:
192.168.100.1:9200
These are the standard addresses for Starlink devices on the local network.
All methods return a dictionary. In case of errors, the response will contain an "error" key:
result = client.get_status()
if "error" in result.get("router", {}):
print(f"Router error: {result['router']['error']}")- Your computer must be connected to the Starlink network
- Starlink devices must be accessible at their gRPC endpoints
- No authentication is required for local network access
Connection Issues:
- Ensure you're connected to the Starlink network
- Verify device addresses are correct
- Check firewall settings aren't blocking gRPC ports
Import Errors:
- Make sure protobuf files (
device_pb2.py,device_pb2_grpc.py) are in the same directory - Install all requirements:
pip install -r requirements.txtA Python package for interacting with Starlink-related APIs, focusing on space traffic coordination and satellite operations.
The Space Safety API is hosted at space-safety.starlink.com and provides tools for satellite operators to:
- Submit ephemeris files: Upload orbital data for your satellites
- Screen against Starlink constellation: Check for potential conjunctions
- Coordinate space traffic: Ensure safe operations in shared orbital space A comprehensive Python library for interacting with Starlink user terminals. This library provides wrappers for various Starlink gRPC methods, enabling device management, network monitoring, and configuration.
✅ Get Status/History - Retrieve current status (connectivity, alerts) and historical data
✅ Get Network Stats - Download/upload speeds, latency, packet loss
✅ Get Telemetry - Device alerts, errors, warnings (streaming supported)
✅ Reboot Dish - Restart the user terminal
✅ Set Dish Config - Enable/disable features like snow melt mode, power saving
✅ Get Device Location - Precise location (local) or H3 cell (remote)
✅ Get WiFi Status - SSID, connected clients
✅ Change WiFi Config - Modify SSID, passwords, enable bypass mode
✅ Get Account Data - Basic account info (remote only)
- 🔌 Support for both local (gRPC) and remote (API) connections
- 📊 Type-safe data models with validation
- 🔄 Async support for telemetry streaming
- 🛡️ Comprehensive error handling
- 📖 Extensive documentation and examples
- 🧪 Easy to test and integrate
pip install starlink-connectivity-toolsOr install from source:
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
pip install -e .from starlink_connectivity_tools import SpaceSafetyAPI
# Initialize the API client
api = SpaceSafetyAPI(api_key="your_api_key_here")
# Submit ephemeris data
ephemeris_data = {
"satellite_id": "SAT-001",
"epoch": "2026-01-05T12:00:00Z",
"state_vector": {
"position": [7000.0, 0.0, 0.0], # km
"velocity": [0.0, 7.5, 0.0] # km/s
}
}
response = api.submit_ephemeris(ephemeris_data)
print(f"Submission ID: {response['submission_id']}")
# Screen for conjunctions
results = api.screen_conjunction("SAT-001")
print(f"Found {results['total_events']} potential conjunctions")
# Close the session
api.close()from starlink_connectivity_tools import SpaceSafetyAPI
with SpaceSafetyAPI(api_key="your_api_key_here") as api:
# Submit an ephemeris file
result = api.submit_ephemeris_file(
file_path="/path/to/ephemeris.oem",
file_format="oem"
)
# Get constellation data
constellation = api.get_starlink_constellation_data(
filters={"active_only": True}
)
print(f"Active satellites: {len(constellation)}")from starlink_connectivity_tools import SpaceSafetyAPI
api = SpaceSafetyAPI(api_key="your_api_key_here")
# Screen with a specific time window
time_window = {
"start": "2026-01-05T00:00:00Z",
"end": "2026-01-12T00:00:00Z"
}
results = api.screen_conjunction("SAT-001", time_window=time_window)
for conjunction in results['conjunctions']:
print(f"Potential conjunction with {conjunction['starlink_satellite_id']}")
print(f" Time: {conjunction['time_of_closest_approach']}")
print(f" Miss distance: {conjunction['miss_distance']} km")
print(f" Collision probability: {conjunction['probability_of_collision']}")from starlink_connectivity_tools import SpaceSafetyAPI
api = SpaceSafetyAPI(api_key="your_api_key_here")
# After submitting ephemeris data
response = api.submit_ephemeris(ephemeris_data)
submission_id = response['submission_id']
# Check status later
status = api.get_screening_status(submission_id)
print(f"Status: {status['status']}")
if status['status'] == 'completed':
print("Results:", status['results'])
## Quick Start
### Basic Usage
```python
from starlink_connectivity_tools import StarlinkClient
# Connect to local Starlink device
with StarlinkClient() as client:
# Get device status
status = client.get_status()
print(f"Device is {status.state.value}")
print(f"Uptime: {status.uptime_seconds // 3600} hours")
# Get network statistics
stats = client.get_network_stats()
print(f"Download: {stats.download_mbps} Mbps")
print(f"Latency: {stats.latency_ms} ms")from starlink_connectivity_tools import StarlinkClient
with StarlinkClient() as client:
stats = client.get_network_stats()
if stats.is_healthy():
print("✓ Network performance is good")
else:
print(f"⚠ High latency: {stats.latency_ms}ms")
print(f"⚠ Packet loss: {stats.packet_loss_percent}%")from starlink_connectivity_tools import StarlinkClient, WiFiConfig
with StarlinkClient() as client:
# Get current WiFi status
wifi = client.get_wifi_status()
print(f"SSID: {wifi.ssid}")
print(f"Connected clients: {wifi.client_count()}")
# Update WiFi configuration
config = WiFiConfig(
ssid="MyStarlink",
password="SecurePassword123"
)
client.set_wifi_config(config)from starlink_connectivity_tools import StarlinkClient, DishConfig
with StarlinkClient() as client:
# Enable snow melt mode
config = DishConfig(snow_melt_mode_enabled=True)
client.set_dish_config(config)
# Enable power saving
config = DishConfig(power_save_mode_enabled=True)
client.set_dish_config(config)from starlink_connectivity_tools import StarlinkClient, AlertLevel
with StarlinkClient() as client:
telemetry = client.get_telemetry()
print(f"Temperature: {telemetry.temperature_celsius}°C")
print(f"Power: {telemetry.power_input_watts}W")
# Check for critical alerts
if telemetry.has_critical_alerts():
for alert in telemetry.get_alerts_by_level(AlertLevel.CRITICAL):
print(f"CRITICAL: {alert.message}")import asyncio
from starlink_connectivity_tools import StarlinkClient
async def monitor_telemetry():
client = StarlinkClient()
client.connect()
try:
async for telemetry in client.stream_telemetry():
print(f"Temp: {telemetry.temperature_celsius}°C")
if telemetry.has_critical_alerts():
break
finally:
client.disconnect()
asyncio.run(monitor_telemetry())from starlink_connectivity_tools import StarlinkClient
# Remote API requires API key
with StarlinkClient(use_remote=True, api_key="your-api-key") as client:
account = client.get_account_data()
print(f"Service Line: {account.service_line_number}")
print(f"Data Used: {account.data_used_gb} GB")
if account.is_near_limit():
print("⚠ Warning: Approaching data limit")from starlink_connectivity_tools import StarlinkClient
with StarlinkClient() as client:
# Get last 24 hours at 15-minute intervals
history = client.get_history(duration_hours=24, interval_minutes=15)
for entry in history:
if entry.network_stats:
print(f"{entry.timestamp}: {entry.network_stats.latency_ms}ms")SpaceSafetyAPI(api_key=None, base_url="https://space-safety.starlink.com")Parameters:
api_key(str, optional): API key for authenticationbase_url(str): Base URL for the API
Submit ephemeris data for a satellite.
Parameters:
ephemeris_data(dict): Dictionary containing orbital parameters
Returns: dict with submission confirmation
Upload an ephemeris file.
Parameters:
file_path(str): Path to the ephemeris filefile_format(str): Format of the file (e.g., "oem", "tle")
Returns: dict with upload confirmation
Screen for potential conjunctions with Starlink satellites.
Parameters:
satellite_id(str): Satellite identifiertime_window(dict, optional): Time range for screening
Returns: dict with conjunction results
Retrieve current Starlink constellation data.
Parameters:
filters(dict, optional): Filters for constellation data
Returns: list of satellite data
Get the status of a previous submission.
Parameters:
submission_id(str): Submission ID from previous request
Returns: dict with status information
This package focuses exclusively on SpaceX Starlink-related APIs for satellite connectivity and space traffic coordination.
For more information, see STARLINK_UK_NOTE.md.
For official updates and documentation:
- Starlink Support Portal: https://support.starlink.com
- Space Safety API: https://space-safety.starlink.com
- Developer Resources: Check Starlink's official channels for API updates
- Python 3.7+
- requests >= 2.25.0
Main client class for interacting with Starlink devices.
Constructor:
StarlinkClient(
host: str = "192.168.100.1",
port: int = 9200,
use_remote: bool = False,
api_key: Optional[str] = None,
timeout: int = 10
)Methods:
connect()- Establish connection to devicedisconnect()- Close connectionget_status()- Get current device statusget_history(duration_hours, interval_minutes)- Get historical dataget_network_stats()- Get network performance statsget_telemetry()- Get device telemetrystream_telemetry()- Stream telemetry (async)reboot_dish()- Reboot the user terminalset_dish_config(config)- Configure dish settingsget_dish_config()- Get current dish configurationget_device_location()- Get device locationget_wifi_status()- Get WiFi statusset_wifi_config(config)- Update WiFi settingsget_account_data()- Get account info (remote only)
state- Device operational stateuptime_seconds- Device uptimeconnected- Connection statusalerts- List of alertshardware_version- Hardware versionsoftware_version- Software version
download_mbps- Download speedupload_mbps- Upload speedlatency_ms- Latency in millisecondspacket_loss_percent- Packet loss percentageis_healthy(max_latency_ms, max_packet_loss)- Check if performance is good
alerts- List of alertstemperature_celsius- Device temperaturepower_input_watts- Power consumptionerrors- List of errorswarnings- List of warningshas_critical_alerts()- Check for critical alertsget_alerts_by_level(level)- Filter alerts by severity
ssid- Network nameenabled- WiFi enabled statusconnected_clients- List of connected devicesclient_count()- Number of connected clients
ssid- Network name to setpassword- Network passwordbypass_mode_enabled- Bypass mode settingvalidate_ssid()- Validate SSIDvalidate_password()- Validate password
snow_melt_mode_enabled- Snow melt modepower_save_mode_enabled- Power save modeis_power_saving()- Check if power saving is active
See examples.py for comprehensive usage examples including:
- Basic status monitoring
- Network performance tracking
- WiFi management
- Dish configuration
- Telemetry streaming
- Remote API usage
- Historical data retrieval
# Clone repository
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
# Install with dev dependencies
pip install -e ".[dev]"
Python library for interacting with the Starlink dish gRPC API. This library provides a client for querying device status, network statistics, telemetry, and performing actions like rebooting the Starlink user terminal (dish).
## Overview
The Starlink user terminal exposes an **unauthenticated gRPC API** for monitoring and control. This API is not officially documented by SpaceX but has been reverse-engineered by the community.
### API Details
- **Protocol**: gRPC over HTTP/2
- **Local Address**: `192.168.100.1:9200` (local network only)
- **Authentication**: None required for local access
- **Remote Access**: Possible via Starlink's remote API with session cookies (valid for 15 days)
- **Service Discovery**: Supports gRPC server reflection
## Features
- ✅ Connect to local Starlink dish (192.168.100.1:9200)
- ✅ Remote access with session cookie authentication
- ✅ Service discovery using gRPC server reflection
- ✅ Extract proto files from the dish
- ✅ Query device status, network stats, and telemetry (requires proto files)
- ✅ Perform actions like rebooting or configuring the dish (requires proto files)
## Installation
### From PyPI (when published)
```bash
pip install starlink-connectivity-toolsgit clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
pip install -e .pip install -e ".[dev]"from starlink_connectivity_tools import StarlinkDishClient
# Connect to local dish
with StarlinkDishClient() as client:
# Discover available services
services = client.discover_services()
print(f"Available services: {services}")from starlink_connectivity_tools import StarlinkDishClient
# Connect remotely with session cookie
with StarlinkDishClient(
address="remote.starlink.com:9200",
session_cookie="your-session-cookie"
) as client:
services = client.discover_services()
print(f"Available services: {services}")from starlink_connectivity_tools.client import StarlinkDishClient
from starlink_connectivity_tools.reflection import ProtoReflectionClient
# Connect to dish
client = StarlinkDishClient()
client.connect()
# Create reflection client
reflection_client = ProtoReflectionClient(client._channel)
# List services
services = reflection_client.list_services()
# Extract proto file for a service
reflection_client.export_proto_file(
services[0],
"./proto_files/starlink.proto"
)Several example scripts are provided in the examples/ directory:
python examples/basic_usage.pyDemonstrates basic connection and service discovery.
python examples/extract_proto.py [output_directory]Extracts proto file definitions from the Starlink dish using server reflection.
python examples/remote_access.py <session_cookie> [remote_address]Connects to the Starlink dish remotely using session cookies.
The Starlink gRPC API requires proto files to make actual RPC calls. You have two options:
Use the extract_proto.py example to extract proto files directly from your dish:
python examples/extract_proto.py ./proto_filesThe community has reverse-engineered proto files. Search for "starlink grpc proto" to find them.
Once you have the proto files, compile them:
python -m grpc_tools.protoc \
-I./proto_files \
--python_out=. \
--grpc_python_out=. \
proto_files/*.protoMain client class for interacting with the Starlink dish.
address(str, optional): gRPC server address. Defaults to192.168.100.1:9200session_cookie(str, optional): Session cookie for remote accessuse_reflection(bool): Whether to use server reflection. Default:Trueinsecure(bool): Whether to use insecure channel. Default:Truetimeout(int): Default timeout for RPC calls in seconds. Default:10
connect(): Establish connection to the gRPC serverclose(): Close the gRPC channeldiscover_services(): List available gRPC servicesget_status(): Get device status (requires proto files)get_network_stats(): Get network statistics (requires proto files)get_telemetry(): Get telemetry data (requires proto files)reboot(): Reboot the dish (requires proto files)set_configuration(config): Configure the dish (requires proto files)
Client for extracting proto definitions using gRPC server reflection.
list_services(): List all available servicesget_file_descriptor(symbol): Get file descriptor for a symbolexport_proto_file(symbol, output_path): Export proto file to disk
- Ensure you're connected to the Starlink WiFi network
- Verify the dish is powered on and operational
- Check the address is
192.168.100.1:9200 - Some network configurations may block local gRPC access
- Verify your session cookie is still valid (15-day expiry)
- Session cookies can be extracted from browser developer tools
- Check you have internet connectivity
- Ensure the remote address is correct
- The dish may not support server reflection (older firmware)
- Try using community proto files instead
- Check network connectivity
Contributions are welcome! Please feel free to submit a Pull Request.
This is an unofficial library and is not affiliated with, endorsed by, or connected to SpaceX or Starlink. Use at your own risk.
This project is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial tool and is not affiliated with or endorsed by SpaceX or Starlink. Use at your own risk.
Based on the Starlink gRPC API for enterprises and business customers. See LICENSE file for details.
This is an unofficial package. For official Starlink services and support, please visit https://starlink.com.
APIs may evolve over time. Check official Starlink resources for the latest updates. This project is licensed under the MIT License - see the LICENSE file for details.
This library is not officially supported by SpaceX. It relies on reverse-engineered API knowledge from the community. The API may change without notice, and usage is at your own risk.
- Community efforts in reverse-engineering the Starlink API
- Tools like
grpcurlandgrpc-reflectionthat enable API discovery
- grpcurl - Command-line gRPC client
- starlink-grpc-tools - Community Starlink tools
- dishykit - Starlink dish analysis tools
For issues and questions:
- Open an issue on GitHub
- Check existing community resources and documentation Python library for interacting with the Starlink API. This library provides a simple and intuitive interface to access Starlink's various API endpoints.
pip install starlink-connectivity-toolsOr install from source:
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
pip install -e .- Python 3.7+
- requests >= 2.25.0
Official API for managing Starlink accounts and devices, primarily targeted at enterprise users. It allows programmatic control over subscriptions, service lines, user terminals, and more.
Purpose: Manage accounts, addresses, data usage, routers, service lines, subscriptions, TLS configurations, and user terminals.
Base URL: https://web-api.starlink.com/enterprise
Documentation:
- Available via Swagger UI at https://web-api.starlink.com/enterprise/swagger/index.html
The Starlink Enterprise API uses OpenID Connect (OIDC) for authentication.
Well-known configuration URL: https://web-api.starlink.com/enterprise/api/auth/.well-known/openid-configuration
Authentication Process:
- Obtain access tokens from the OIDC provider
- Attach tokens to API requests using the Authorization header:
Authorization: Bearer <access_token>
Service Accounts:
- Service accounts can be created in the Starlink account settings under "Service Accounts"
- These accounts are specifically designed for API access
- Use service account credentials to authenticate and make API calls programmatically A Python library for interacting with Starlink satellite internet devices.
pip install -e .Or using the package directly:
python setup.py install
# Starlink Connectivity Tools
Python library for monitoring and managing Starlink dish connectivity with emergency mode support.
## Features
- Monitor Starlink dish status in real-time
- Detect emergency conditions (motor issues, obstructions, thermal problems)
- Emergency actions (stow/unstow dish, reboot)
- Simulated dish interface for testing and development
## Installation
# starlink_connectivity_tools.py
Python tools for monitoring Starlink connectivity.
## Usage Examples
### Basic Monitoring
Check the current status of your Starlink connection:
```bash
python tools/starlink_monitor_cli.py statusMonitor your Starlink connection continuously with a 30-second interval:
python tools/starlink_monitor_cli.py monitor --interval 30Crisis-optimized satellite connectivity monitoring and management tools
A comprehensive Python toolkit for managing Starlink connectivity in challenging environments, with real-time monitoring, automatic failover, and crisis-specific optimizations.
- Uses official
starlink-grpclibrary for real device communication - Real-time monitoring of dish status, obstructions, and performance metrics
- Automated issue detection and recovery (reboot, stow/unstow)
- Support for simulation mode when hardware isn't available
- Manage multiple satellite connections (Starlink, Iridium, Inmarsat, Thuraya)
- Real metrics from Starlink API instead of simulated data
- Automatic failover between primary and backup connections
- Priority-based connection selection
- Pre-configured scenarios: Normal, Humanitarian, Medical, Disaster, Conflict
- Adjustable thresholds for different crisis situations
- Persistent issue detection with automatic recovery
- Performance history tracking and reporting
starlink-monitorCLI for easy monitoring and management- Real-time status display with color-coded alerts
- Performance reporting and data export
- Quick access to reboot, stow/unstow commands
- Venezuela crisis scenario with realistic challenges
- Medical mission simulation with connectivity optimization
- Power outage, network congestion, and restriction simulations
- Integrated Starlink telemetry with diagnostic tools
- Historical performance tracking
- Automated alerting and issue resolution
- Comprehensive diagnostic reports
# Clone the repository
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
# Install dependencies
pip install -r requirements.txt
# Install the package
pip install -e .- Python 3.8+
- starlink-grpc >= 1.2.0
- click >= 8.1.0
- rich >= 13.0.0
- numpy >= 1.24.0
- pandas >= 2.0.0
- loguru >= 0.7.0
# Check Starlink status
starlink-monitor status
# Start real-time monitoring (normal scenario)
starlink-monitor monitor --interval 10
# Monitor with crisis scenario
starlink-monitor monitor --scenario humanitarian
# Generate performance report
starlink-monitor report --hours 24 --output report.json
# Run diagnostics
starlink-monitor diagnostics
# Reboot dish
starlink-monitor reboot
# Use simulation mode (no hardware required)
starlink-monitor status --simulation
starlink-monitor monitor --simulation --scenario disasterfrom starlink_connectivity_tools import (
StarlinkAPI,
SatelliteConnectionManager,
CrisisMonitor,
DiagnosticsEngine,
)
from starlink_connectivity_tools.satellite_connection_manager import ConnectionType
from starlink_connectivity_tools.crisis_monitor import ScenarioType
# Initialize Starlink API
api = StarlinkAPI(simulation_mode=True) # Set False for real hardware
# Get status
status = api.get_status()
print(f"Latency: {status['ping_latency_ms']} ms")
print(f"Downlink: {status['downlink_throughput_bps'] / 1_000_000} Mbps")
# Setup connection manager with failover
manager = SatelliteConnectionManager()
manager.add_connection("Starlink Primary", ConnectionType.STARLINK, priority=100)
manager.add_connection("Iridium Backup", ConnectionType.IRIDIUM, priority=50)
manager.connect()
# Setup crisis monitoring
monitor = CrisisMonitor(manager, scenario=ScenarioType.HUMANITARIAN)
health = monitor.check_health()
print(f"Status: {health['status']}")
# Run diagnostics
diagnostics = DiagnosticsEngine(manager)
report = diagnostics.run_full_diagnostic()
print(f"Overall status: {report['status']}")
# Cleanup
manager.close_all()
api.close()The toolkit includes pre-configured monitoring scenarios optimized for different crisis situations:
| Scenario | Max Latency | Min Bandwidth | Obstruction Tolerance | Use Case |
|---|---|---|---|---|
| Normal | 100ms | 20 Mbps | 5% | Standard operations |
| Humanitarian | 200ms | 10 Mbps | 15% | Aid coordination |
| Medical | 150ms | 15 Mbps | 10% | Telemedicine |
| Disaster | 300ms | 5 Mbps | 25% | Emergency response |
| Conflict | 250ms | 8 Mbps | 20% | Restricted areas |
You can also create custom scenarios:
monitor.set_custom_thresholds({
"max_latency_ms": 180,
"min_downlink_mbps": 12,
"min_uplink_mbps": 4,
"max_obstruction_percent": 0.15,
"min_snr": 6.0,
})The examples/ directory contains realistic crisis simulations:
python examples/venezuela_crisis_scenario.pyDemonstrates multi-satellite failover, network restrictions, and automatic recovery.
python examples/medical_mission_scenario.pyShows activity-based monitoring with medical-specific requirements.
python examples/power_network_scenario.pySimulates power outages, network congestion, and equipment failures.
See examples/README.md for detailed documentation.
starlink_connectivity_tools/
├── starlink_api.py # Starlink gRPC integration
├── satellite_connection_manager.py # Multi-satellite management
├── crisis_monitor.py # Crisis-optimized monitoring
├── diagnostics.py # Enhanced diagnostics
└── starlink_monitor_cli.py # Command-line interface
- Requires Starlink dish connected to network
- Default target:
192.168.100.1:9200 - Provides actual telemetry data
- Can control dish (reboot, stow/unstow)
api = StarlinkAPI() # Real mode
manager.add_connection("Starlink", ConnectionType.STARLINK, simulation_mode=False)- No hardware required
- Generates realistic synthetic data
- Perfect for testing and development
- All features work without dish
api = StarlinkAPI(simulation_mode=True) # Simulation mode
manager.add_connection("Starlink", ConnectionType.STARLINK, simulation_mode=True)- Latency (ping to Starlink PoP)
- Downlink/uplink throughput
- Signal-to-noise ratio (SNR)
- Obstruction percentage
- Dish state and alerts
- Connection failure detection
- Automatic reboot on persistent issues
- Failover to backup connections
- Issue resolution tracking
- Time-series data collection
- Statistical analysis (avg, min, max, percentiles)
- Long-term trend tracking
- Export to JSON for analysis
- Hardware alerts (motors stuck, thermal issues)
- Performance degradation detection
- Obstruction analysis with directional info
- Actionable recommendations
Ensure reliable connectivity for telemedicine with automatic failover and low-latency monitoring.
Coordinate relief efforts in challenging environments with crisis-optimized thresholds.
Maintain communications during emergencies with automatic recovery and redundant connections.
Monitor and manage satellite connectivity in areas with limited infrastructure.
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request Comprehensive tools for monitoring and managing Starlink satellite connectivity with CLI, configuration management, logging, and alerting capabilities.
- Real-time Monitoring: Track Starlink connection metrics including download/upload speeds, latency, signal strength, and more
- Performance Reports: Generate detailed performance reports over customizable time periods
- Connection Management: Manage satellite connections with automatic failover capabilities
- CLI Interface: Powerful command-line interface for all monitoring and management tasks
- Customizable Thresholds: Set custom alert thresholds for various metrics via config file
- Logging: Configurable logging levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Multiple Export Formats: Export data to JSON or CSV
- Unit Tests: Comprehensive unit tests for all CLI commands
- Docker Support: Containerized deployment with Docker and Docker Compose
- CLI Autocompletion: Bash completion script for enhanced usability
- Type Hints: Full type annotations throughout the codebase
- Config Validation: Automatic validation of configuration files A comprehensive Python toolkit for managing, monitoring, and optimizing Starlink satellite internet connections. This project provides essential tools for connection management, bandwidth optimization, power management, failover handling, and real-time monitoring.
- Connection Management: Intelligent Starlink connection handling with automatic reconnection and health monitoring
- Bandwidth Optimization: Traffic shaping, QoS, and bandwidth allocation strategies
- Power Management: Multiple power modes for battery operation and emergency scenarios
- Failover Handling: Automatic failover between Starlink and backup connections
- Real-time Monitoring: Live metrics tracking including signal quality, satellites, latency, and throughput
- Diagnostics: Comprehensive diagnostic tools for troubleshooting
- Web Dashboard: User-friendly web interface for monitoring and control
- CLI Tools: Command-line tools for monitoring and management
A robust framework for maintaining satellite connectivity in challenging crisis scenarios, with special attention to the specific needs of emergency response teams.
This project was inspired by connectivity challenges in Venezuela and other crisis scenarios where reliable communications are critical for emergency response and humanitarian aid.
- Automatic satellite switching based on quality metrics
- Crisis mode with relaxed requirements for emergency situations
- Continuous health monitoring
- Priority-based bandwidth allocation
- Critical communications (medical, SOS) receive guaranteed bandwidth
- Dynamic adjustment based on available bandwidth
- Multiple backup connection types (cellular, WiFi, secondary satellite)
- Cost-aware backup selection
- Automatic failover and failback
- Multiple power modes (Normal, Conservation, Crisis, Survival)
- Battery runtime optimization
- Scheduled sleep cycles for extreme power saving
- Full system health checks
- Historical tracking and reporting
- Automated issue detection and recommendations
- Special modes for humanitarian and medical operations
- Guaranteed minimum connectivity for emergency communications
- Optimized for crisis response teams and aid organizations A Python library for working with Starlink connectivity.
# Starlink Connectivity Tools
A Python library for managing Starlink connections with automatic failover capabilities.
## Features
- **Automatic Connection Failover**: Seamlessly switch between primary and backup connections when failures are detected
- **Configurable Health Checks**: Customize connection health monitoring with your own callback functions
- **Failure Threshold Management**: Set custom thresholds before triggering failover
- **Comprehensive Logging**: Track connection status and failover events
- **Failover History**: Review past failover events for analysis and debugging
## Installation
```bash
pip install -e .Configuration is stored in ~/.config/starlink_monitor/config.json. The default configuration includes:
{
"thresholds": {
"min_download_speed": 25.0,
"max_latency": 100.0,
"max_packet_loss": 5.0,
"max_obstruction": 10.0
},
"logging": {
"level": "INFO",
"format": "%(asctime)s - %(name)s - %(levelname)s - %(message)s",
"file": null
},
"monitor": {
"default_host": "192.168.100.1",
"history_size": 1000,
"default_interval": 60
}
}You can edit this file directly or use the CLI to modify thresholds interactively.
Check current Starlink status:
starlink-cli statusStart continuous monitoring:
starlink-cli monitor --interval 30Generate a performance report:
starlink-cli report --hours 48Export data to JSON:
starlink-cli export --output data.json --hours 24Export data to CSV:
starlink-cli export --output data.csv --format csv --hours 48Manage connection:
starlink-cli connectionSet monitoring thresholds:
starlink-cli thresholdsReboot Starlink dish (use with caution):
starlink-cli rebootControl logging output with command-line flags:
# Set log level
starlink-cli status --log-level DEBUG
# Log to file
starlink-cli monitor --log-file /var/log/starlink.log
# Combine options
starlink-cli monitor --log-level INFO --log-file /var/log/starlink.logfrom src.starlink_monitor import StarlinkMonitor
from src.connection_manager import SatelliteConnectionManager
from src.config import Config
# Load configuration
config = Config()
# Initialize monitor with config
monitor = StarlinkMonitor(config=config)
# Get current metrics
metrics = monitor.get_metrics()
print(f"Download: {metrics.download_speed} Mbps")
print(f"Latency: {metrics.latency} ms")
# Get performance report
report = monitor.get_performance_report(hours=24)
print(f"Availability: {report['availability_percent']}%")
# Update thresholds
config.set_thresholds(min_download_speed=50.0, max_latency=80.0)
# Connection management
manager = SatelliteConnectionManager(enable_starlink=True)
manager.scan_available_connections()
manager.connect("starlink_satellite")Run unit tests:
python3 -m unittest discover testsRun specific test file:
python3 -m unittest tests.test_cli -vdocker build -t starlink-monitor .# Check status
docker run -it --rm --network host starlink-monitor status
# Start monitoring
docker run -it --rm --network host starlink-monitor monitor --interval 30
# Export data
docker run -it --rm --network host -v $(pwd)/output:/app/output starlink-monitor export --output /app/output/data.csv --format csv# Start continuous monitoring
docker-compose up -d
# Check status
docker-compose run --rm status-check
# View logs
docker-compose logs -f
# Stop monitoring
docker-compose downEnable Bash completion for enhanced CLI usability:
# Install completion script
sudo cp starlink-cli-completion.sh /etc/bash_completion.d/
# Or source it in your current session
source starlink-cli-completion.sh
# Now you can use tab completion:
starlink-cli <TAB>
starlink-cli export --format <TAB>The configuration file is automatically validated on load. To manually validate:
from src.config import Config
config = Config()
is_valid, errors = config.validate()
if not is_valid:
for error in errors:
print(f"Error: {error}")- Python 3.7+
- Access to Starlink router (default: 192.168.100.1)
pip install -e .
pip install starlink-connectivity-tools A comprehensive Python toolkit for managing satellite connectivity in emergency and crisis scenarios, with focus on power management and battery optimization for remote operations.
- Power Management: Battery optimization with multiple power modes for extended runtime
- Component Control: Manage individual components to optimize power consumption
- Automatic Optimization: Intelligent power mode selection based on target battery runtime
- Sleep Scheduling: Schedule periodic sleep/wake cycles for extreme power conservation
A Python library for managing Starlink satellite connectivity with support for bandwidth optimization, connection management, and prioritized data transmission.
- Bandwidth Optimization: Efficiently allocate and manage bandwidth across multiple connections
- Priority Management: Prioritize critical connections (e.g., medical emergencies)
- Connection Management: Track and control multiple simultaneous connections
- Use Cases: Pre-built examples for common scenarios including medical emergency communications
A Python library for managing and monitoring Starlink connectivity, with built-in emergency mode support for critical situations.
- Emergency Mode: Automated monitoring and recovery for critical connectivity scenarios
- Status Monitoring: Real-time dish status and connectivity checks
- Alert Management: Detect and respond to dish alerts
- Automatic Recovery: Attempt automated recovery procedures when issues are detected
Clone the repository:
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.pyfrom starlink_connectivity_tools import FailoverHandler
# Create a failover handler
failover_handler = FailoverHandler(
failure_threshold=3, # Trigger failover after 3 consecutive failures
check_interval=5.0 # Check connection every 5 seconds
)
# Automatic failover when primary fails
if failover_handler.should_failover():
failover_handler.initiate_failover("Primary connection lost")import requests
from starlink_connectivity_tools import FailoverHandler
def check_connection_health():
"""Custom health check function."""
try:
response = requests.get("https://www.google.com", timeout=5)
return response.status_code == 200
except:
return False
failover_handler = FailoverHandler(
failure_threshold=3,
check_interval=10.0,
health_check_callback=check_connection_health
)
### Low Power Operation Example
Optimize satellite terminal for 24-hour battery life:
```bash
python3 examples/low_power_operation.pyThis example demonstrates:
- Automatic power optimization for target battery runtime
- Different power modes (Normal, Conservation, Crisis, Survival)
- Component-level power management
- Scheduled sleep cycles for extreme power savings
- Real-time power consumption monitoring
The PowerManager module provides intelligent battery optimization:
from src.power_manager import PowerManager
# Initialize with battery capacity (Watt-hours)
power_manager = PowerManager(total_battery_capacity=500.0)
# Optimize for 24-hour battery life
power_manager.optimize_for_battery_life(target_runtime_hours=24)
# Get power status report
report = power_manager.get_power_report()
print(f"Estimated runtime: {report['estimated_runtime_hours']:.1f} hours")
print(f"Total power: {report['total_power_consumption_w']:.1f} W")from src.power_manager import PowerMode
# Set specific power mode
power_manager.set_power_mode(PowerMode.CONSERVATION)
# Available modes:
# - PowerMode.NORMAL: Full performance
# - PowerMode.CONSERVATION: Reduced power (30-40% savings)
# - PowerMode.CRISIS: Minimal power (60-70% savings)
# - PowerMode.SURVIVAL: Maximum savings (85-90% savings)# Disable non-essential components
power_manager.disable_component('cellular_modem')
power_manager.disable_component('compute_unit')
# Re-enable when needed
power_manager.enable_component('cellular_modem')# Active for 5 minutes, sleep for 30 minutes
power_manager.schedule_sleep_cycle(
active_duration=300, # 5 minutes
sleep_duration=1800 # 30 minutes
)
No external dependencies are required for the basic examples.
A Python library for managing Starlink satellite connectivity with support for crisis mode and bandwidth optimization.
## Features
- **Connection Management**: Scan and connect to available Starlink satellites
- **Crisis Mode**: Prioritize connections during emergency scenarios with custom bandwidth and latency requirements
- **Bandwidth Optimization**: Optimize bandwidth usage for satellite connections
- **Status Reporting**: Get detailed connection metrics and performance data
## Quick Start
```python
import json
from src.connection_manager import SatelliteConnectionManager
from src.bandwidth_optimizer import BandwidthOptimizer
# Initialize connection manager
manager = SatelliteConnectionManager()
# Enable crisis mode for emergency scenarios
manager.enable_crisis_mode({
'crisis_min_bandwidth': 1.0, # Mbps
'crisis_max_latency': 1000 # ms
})
# Scan and connect
connections = manager.scan_available_connections()
if connections:
manager.connect(connections[0])
# Get status report
report = manager.get_connection_report()
print(json.dumps(report, indent=2))
# Starlink Connectivity Tools for Crisis Scenarios
A Python-based toolkit for optimizing satellite connectivity in crisis scenarios, inspired by challenges faced in Venezuela and other emergency situations.
## Features
- **Smart Connection Management**: Automatic satellite switching and optimization
- **Bandwidth Prioritization**: Critical communications get priority bandwidth
- **Failover Handling**: Automatic switch to backup connections
- **Power Management**: Optimize for limited power/battery scenarios
- **Comprehensive Diagnostics**: Full system health monitoring
- **Emergency Mode**: Special configurations for crisis situations
# Starlink Connectivity Tools
A comprehensive Python toolkit for managing satellite connectivity in emergency and crisis scenarios, inspired by real-world connectivity challenges in Venezuela and other regions.
## Features
- **Connection Management**: Scan, connect, and manage satellite connections
- **Bandwidth Optimization**: Intelligent bandwidth allocation with traffic prioritization
- **Crisis Mode**: Special emergency mode for critical communications only
- **Failover Handling**: Automatic connection failover with health monitoring
- **Power Management**: Battery optimization with multiple power modes
- **Diagnostics**: Comprehensive connectivity diagnostics and health checks
## Installation
```bash
pip install starlink_connectivity_toolsOr install from source: git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git cd starlink_connectivity_tools.py pip install -r requirements.txt
## Usage
```python
from starlink_connectivity_tools import StarlinkConnectivity, check_connection, format_speed
# Create a connectivity instance
conn = StarlinkConnectivity(dish_id="DISH-12345")
# Connect to the dish
conn.connect()
# Check connection status
print(conn.is_connected()) # True
# Get status
status = conn.get_status()
print(status) # {'dish_id': 'DISH-12345', 'connected': True}
# Use utility functions
print(check_connection("DISH-12345")) # True
print(format_speed(250.5)) # "250.50 Mbps"
print(format_speed(1500)) # "1.50 Gbps"
Run the test suite using pytest:
python -m pytest tests/Run tests with verbose output:
python -m pytest tests/ -vInstall development dependencies:
pip install -e ".[dev]"The emergency mode example demonstrates how to monitor and recover from connectivity issues: Run the emergency connectivity system demo:
python3 examples/emergency_mode.pyThis example demonstrates:
- Enabling emergency/crisis mode
- Establishing satellite connectivity
- Sending emergency SOS messages
- Synchronizing medical data with priority bandwidth
- Continuous monitoring and health checks
- Graceful shutdown with status reporting
Press Ctrl+C to gracefully shutdown the system.
Handles satellite connectivity, scanning, and connection management.
from src.connection_manager import SatelliteConnectionManager
manager = SatelliteConnectionManager()
connections = manager.scan_available_connections()
manager.connect(connections[0])Manages bandwidth allocation and traffic prioritization. A Python library for managing Starlink satellite connections, optimizing bandwidth usage, handling failover scenarios, and managing power consumption.
- Connection Management: Establish, monitor, and manage Starlink satellite connections
- Bandwidth Optimization: Optimize bandwidth usage and manage network traffic efficiently
- Failover Handling: Automatic failover to backup connections when primary connection fails
- Power Management: Manage power consumption with low-power modes for battery-powered scenarios
- Diagnostics: Comprehensive diagnostic tools and health checks for Starlink connections
starlink-connectivity-tools/
├── src/
│ ├── __init__.py
│ ├── connection_manager.py # Starlink connection management
│ ├── bandwidth_optimizer.py # Bandwidth optimization
│ ├── failover_handler.py # Failover management
│ ├── power_manager.py # Power consumption management
│ ├── diagnostics.py # Diagnostic tools
│ ├── starlink_monitor.py # Real-time monitoring
│ └── config/
│ └── settings.py # Configuration settings
├── tools/
│ ├── starlink_monitor_cli.py # Command-line monitoring tool
│ └── connectivity_dashboard.py # Web dashboard
├── examples/
│ ├── emergency_mode.py # Emergency mode example
│ ├── venezuela_scenario.py # Venezuela scenario example
│ └── low_power_mode.py # Low power mode example
├── requirements.txt
├── setup.py
└── README.md
# Clone the repository
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
# Install dependencies
pip install -r requirements.txt
# Install the package
pip install -e .pip install -e .[web]
│ ├── connection_manager.py # Connection establishment and monitoring
│ ├── bandwidth_optimizer.py # Bandwidth optimization and traffic management
│ ├── failover_handler.py # Automatic failover to backup connections
│ ├── power_manager.py # Power consumption management
│ ├── diagnostics.py # Diagnostic tools and health checks
│ └── config/
│ └── settings.py # Configuration management
├── tests/
│ ├── test_connection_manager.py # Tests for connection manager
│ └── test_bandwidth_optimizer.py # Tests for bandwidth optimizer
├── examples/
│ ├── emergency_mode.py # Emergency mode configuration example
│ └── low_power_mode.py # Low power mode configuration example
├── requirements.txt # Project dependencies
├── setup.py # Package setup configuration
└── README.md # This filegit clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
### From Source
```bash
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
pip install -e .from starlink_connectivity import BandwidthOptimizer
# Initialize optimizer with available bandwidth
optimizer = BandwidthOptimizer(total_bandwidth=100.0) # 100 Mbps
# Allocate bandwidth for a connection
allocation = optimizer.allocate_bandwidth(
connection_id="my_connection",
destination="data.endpoint",
requested_bandwidth=10.0
)
print(f"Allocated: {allocation.allocated_bandwidth} Mbps")
print(f"Status: {allocation.status}")Monitor your Starlink connection and automatically switch to a backup connection when the primary fails:
import time
from starlink_connectivity_tools import FailoverHandler
failover_handler = FailoverHandler(failure_threshold=3, check_interval=5.0)
while True:
if failover_handler.should_failover():
failover_handler.initiate_failover("Primary connection lost")
print(f"Switched to: {failover_handler.get_current_state().value}")
time.sleep(1)from starlink_connectivity_tools import FailoverHandler
import subprocess
def switch_to_backup():
"""Execute network switch commands."""
subprocess.run(["ip", "route", "add", "default", "via", "backup.gateway"])
failover_handler = FailoverHandler(failure_threshold=2, check_interval=3.0)
if failover_handler.should_failover():
failover_handler.initiate_failover("Primary connection timeout")
switch_to_backup()See the examples/ directory for complete working examples:
automatic_failover.py: Demonstrates automatic failover with simulated connection failures
Run an example:
cd examples
python automatic_failover.pyMain class for managing connection failover.
Constructor Parameters:
failure_threshold(int): Number of consecutive failures before triggering failover (default: 3)check_interval(float): Time in seconds between health checks (default: 5.0)health_check_callback(Callable): Optional callback function for custom health checks
Methods:
should_failover() -> bool: Check if failover should be initiatedinitiate_failover(reason: str) -> bool: Initiate failover to backup connectionget_current_state() -> ConnectionState: Get current connection stateget_failure_count() -> int: Get current consecutive failure countget_failover_history() -> list: Get history of failover eventsreset() -> None: Reset handler to initial state
Run the test suite:
# Run all tests
python -m pytest tests/
# Run with coverage
python -m pytest tests/ --cov=starlink_connectivity_tools
# Run specific test file
python -m unittest tests/test_failover.pyOperating satellite terminals in remote locations with limited solar or battery power:
# Optimize for 24-hour battery life
power_manager.optimize_for_battery_life(target_runtime_hours=24)Extend battery life during power outages:
# Switch to crisis mode immediately
power_manager.set_power_mode(PowerMode.CRISIS)
# Disable non-critical components
power_manager.disable_component('compute_unit')Maintain connectivity with periodic check-ins to conserve battery:
# Active 10 minutes every hour
power_manager.schedule_sleep_cycle(
active_duration=600, # 10 minutes active
sleep_duration=3000 # 50 minutes sleep
)Typical power consumption by component and mode:
| Component | Normal | Conservation | Crisis | Sleep |
|---|---|---|---|---|
| Satellite Modem | 60W | 40W | 20W | 5W |
| Router | 10W | 7W | 5W | 2W |
| Cellular Modem | 8W | 6W | 4W | 1W |
| Compute Unit | 25W | 15W | 10W | 3W |
| Total | 103W | 68W | 39W | 11W |
Example Runtimes (500 Wh battery):
- Normal mode: ~5 hours
- Conservation mode: ~7.5 hours
- Crisis mode: ~13 hours
- Survival mode: ~45 hours
- Sleep cycles (5m/30m): ~26 hours
Prioritize medical data transmission during emergency situations:
from starlink_connectivity import BandwidthOptimizer
optimizer = BandwidthOptimizer(total_bandwidth=100.0)
# Prioritize medical data transmission
optimizer.allocate_bandwidth(
connection_id="medical_evac",
destination="medical.data",
requested_bandwidth=10.0
)See the examples/medical_emergency.py for a complete medical emergency communications scenario.
Main class for managing bandwidth allocation.
allocate_bandwidth(connection_id, destination, requested_bandwidth, priority=0): Allocate bandwidth for a connectionrelease_bandwidth(connection_id): Release bandwidth from a connectionget_allocation(connection_id): Get allocation details for a connectionget_all_allocations(): Get all current allocationsget_available_bandwidth(): Get currently available bandwidth
# Medical emergency communications example
python examples/medical_emergency.pypip install -e .[dev]from src.connection_manager import ConnectionManager
from src.starlink_monitor import StarlinkMonitor
from src.power_manager import PowerManager, PowerMode
# Initialize components
connection = ConnectionManager()
monitor = StarlinkMonitor()
power = PowerManager()
# Connect to Starlink
connection.connect()
# Get current metrics
metrics = monitor.get_current_metrics()
print(f"Signal Quality: {metrics['signal_quality']}%")
print(f"Download Speed: {metrics['download_mbps']} Mbps")
# Set power mode
power.set_power_mode(PowerMode.ECO)# Live monitoring
python tools/starlink_monitor_cli.py monitor --interval 5
# Get statistics
python tools/starlink_monitor_cli.py stats --duration 60
# Run diagnostics
python tools/starlink_monitor_cli.py diagnostics
# Export metrics
python tools/starlink_monitor_cli.py export --format json --output metrics.json# Start the web dashboard
python tools/connectivity_dashboard.py --host 0.0.0.0 --port 5000
# Access at http://localhost:5000python examples/emergency_mode.py --simulate --duration 30python examples/venezuela_scenario.py --simulate-outage --duration 60python examples/low_power_mode.py --battery 1000 --target-hours 12 --monitorConfiguration can be customized via environment variables or by modifying src/config/settings.py:
# Starlink Configuration
STARLINK_ENDPOINT = "192.168.100.1"
STARLINK_GRPC_PORT = 9200
# Monitoring Configuration
MONITOR_INTERVAL_SECONDS = 30
METRICS_HISTORY_SIZE = 100
# Alert Thresholds
ALERT_SIGNAL_QUALITY_MIN = 70
ALERT_LATENCY_MAX_MS = 100- Optimized for extended battery operation
- Critical services prioritization
- Minimal power consumption
- Automatic failover to backup connections
- Power management for solar/battery systems
- Bandwidth optimization for limited capacity
- Real-time monitoring and alerts
- Diagnostic tools for troubleshooting
- Automatic power mode adjustment
- Battery runtime estimation
- Failover to backup connections during outages
- Continuous monitoring even during transitions
- Signal Quality: Real-time signal strength monitoring
- Satellite Tracking: Number of visible satellites
- Network Performance: Latency, jitter, packet loss
- Throughput: Download/upload speeds
- Obstructions: Detection and analysis
- Temperature: Dish temperature monitoring
- Alerts: Configurable thresholds with notifications
- Normal: Full features, maximum performance
- ECO: Balanced power consumption and features
- Low Power: Extended battery life, essential features only
- Emergency: Maximum battery life, critical communications only
- Automatic detection of primary connection failures
- Seamless switching to backup connections
- Configurable failover thresholds
- Automatic restoration of primary connection
- Support for multiple backup connections
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This is an independent project and is not affiliated with, endorsed by, or connected to SpaceX or Starlink. Use at your own risk.
- Built for communities with challenging connectivity scenarios
- Inspired by real-world needs in areas with unreliable power and internet access
- Special consideration for scenarios like Venezuela where reliable communications are critical
For issues, questions, or contributions, please visit the GitHub repository. pip install -e ".[dev]"
## Quick Start
```python
from starlink_connectivity_tools import StarlinkClient, AccountsAPI, AddressesAPI
# Initialize the client
client = StarlinkClient(base_url="https://api.starlink.com", api_key="your_api_key")
# Get account information
accounts_api = AccountsAPI(client)
account = accounts_api.get_account()
print(f"Email: {account['email']}")
# Create a new address
addresses_api = AddressesAPI(client)
address = addresses_api.create_address({
'street': '123 Main St',
'city': 'Seattle',
'state': 'WA',
'zip': '98101'
})
print(f"Address ID: {address['id']}")
This library provides access to the following Starlink API endpoints:
GET /account- Retrieve account details (email, customer info)
from starlink_connectivity_tools import StarlinkClient, AccountsAPI
client = StarlinkClient(api_key="your_api_key")
accounts = AccountsAPI(client)
account = accounts.get_account()POST /addresses- Create a new address for service activationGET /addresses/{id}- Get details of a specific address
from starlink_connectivity_tools import StarlinkClient, AddressesAPI
client = StarlinkClient(api_key="your_api_key")
addresses = AddressesAPI(client)
# Create address
new_address = addresses.create_address({
'street': '123 Main St',
'city': 'Seattle',
'state': 'WA',
'zip': '98101'
})
# Get address
address = addresses.get_address('addr_12345')GET /data-usage- Fetch data usage statistics for the account or devices
from starlink_connectivity_tools import StarlinkClient, DataUsageAPI
client = StarlinkClient(api_key="your_api_key")
data_usage = DataUsageAPI(client)
usage = data_usage.get_data_usage()GET /routers/{id}/config- Get router configuration
from starlink_connectivity_tools import StarlinkClient, RoutersAPI
client = StarlinkClient(api_key="your_api_key")
routers = RoutersAPI(client)
config = routers.get_router_config('router_12345')POST /service-lines- Create a new service line (for activation)GET /service-lines/{id}- Retrieve service line details
from starlink_connectivity_tools import StarlinkClient, ServiceLinesAPI
client = StarlinkClient(api_key="your_api_key")
service_lines = ServiceLinesAPI(client)
# Create service line
new_line = service_lines.create_service_line({
'address_id': 'addr_12345',
'product_id': 'prod_12345'
})
# Get service line
line = service_lines.get_service_line('line_12345')GET /subscriptions- List available or active subscription products
from starlink_connectivity_tools import StarlinkClient, SubscriptionsAPI
client = StarlinkClient(api_key="your_api_key")
subscriptions = SubscriptionsAPI(client)
subs = subscriptions.get_subscriptions()GET /user-terminals/{id}- Get user terminal (dish) details, including IDPOST /user-terminals- Activate or manage a user terminal
from starlink_connectivity_tools import StarlinkClient, UserTerminalsAPI
client = StarlinkClient(api_key="your_api_key")
terminals = UserTerminalsAPI(client)
# Get terminal
terminal = terminals.get_user_terminal('term_12345')
# Create/activate terminal
new_terminal = terminals.create_user_terminal({
'service_line_id': 'line_12345',
'serial_number': 'SN12345'
})GET /tls- Retrieve TLS configuration for secure communications
from starlink_connectivity_tools import StarlinkClient, TLSAPI
client = StarlinkClient(api_key="your_api_key")
tls = TLSAPI(client)
config = tls.get_tls_config()# Install development dependencies
pip install -e ".[dev]"
# Run tests
python -m pytest tests/
# Run with coverage
python -m pytest --cov=starlink_connectivity_tools tests/python -m unittest discover tests
from starlink_connectivity_tools import StarlinkManager
# Initialize the manager
manager = StarlinkManager()
# Enable emergency mode for crisis scenarios
manager.enable_emergency_mode()
# Monitor connection health
status = manager.get_connection_status()
print(f"Connection Status: {status}")from starlink_client import StarlinkClient
client = StarlinkClient() # Local connection
stats = client.get_network_stats()
print(f"Download: {stats.download_speed} Mbps, Latency: {stats.latency} ms")
client.reboot_dish()- Network Statistics: Retrieve download/upload speeds, latency, and connection status
- Device Control: Reboot your Starlink dish remotely
- Easy Integration: Simple Python API for Starlink device interaction
Main client class for interacting with Starlink devices.
client = StarlinkClient(host="192.168.100.1", port=9200, timeout=10)get_network_stats(): Returns aNetworkStatsobject with current network performance metricsreboot_dish(): Initiates a reboot of the Starlink dish
Data class containing network statistics:
download_speed: Download speed in Mbpsupload_speed: Upload speed in Mbpslatency: Latency in millisecondsuptime: Device uptime in secondsobstruction_percentage: Percentage of time obstructedconnected: Whether the dish is connected to satellites
See example.py for a complete example:
python example.pyInstall development dependencies:
pip install -e ".[dev]"
### Connection Management
The `SatelliteConnectionManager` class provides methods to manage satellite connections:
- `enable_crisis_mode(config)`: Enable crisis mode with custom configuration
- `scan_available_connections()`: Scan for available satellite connections
- `connect(connection)`: Connect to a specific satellite
- `get_connection_report()`: Get detailed status report of the current connection
### Bandwidth Optimization
The `BandwidthOptimizer` class helps optimize bandwidth usage:
- `enable_optimization(profile)`: Enable bandwidth optimization with a specific profile
- `disable_optimization()`: Disable bandwidth optimization
- `get_optimization_status()`: Get current optimization status
## License
See [LICENSE](LICENSE) for details.
### Smart Connection Management
```python
# Automatic satellite switching
manager.enable_auto_switching()
# Manual satellite selection
manager.select_satellite(satellite_id="sat-001")# Set priority for critical communications
manager.set_priority("emergency_calls", priority=1)
manager.set_priority("data_sync", priority=2)
manager.set_priority("general_web", priority=3)
### Basic Connection Management
```python
from src.connection_manager import ConnectionManager
# Create a connection manager
manager = ConnectionManager()
# Connect to Starlink
manager.connect()
# Check connection status
status = manager.get_status()
print(f"Connected: {status['connected']}")
# Disconnect
manager.disconnect()from src.bandwidth_optimizer import BandwidthOptimizer
optimizer = BandwidthOptimizer(total_bandwidth=100.0)
optimizer.enable_crisis_mode()
allocated = optimizer.allocate_bandwidth(
connection_id="emergency_msg",
destination="emergency.comms",
requested_bandwidth=5.0
)Manages connection failover and health monitoring.
optimizer = BandwidthOptimizer(max_bandwidth=100) # 100 Mbps limit
optimizer.enable_optimization()
optimizer.set_bandwidth_limit(50)
usage = optimizer.get_current_usage() print(f"Optimization enabled: {usage['optimization_enabled']}")
### Failover Configuration
```python
from src.failover_handler import FailoverHandler
handler = FailoverHandler()
healthy = handler.check_connection_health(latency=50.0, packet_loss=0.5)
if not healthy:
handler.initiate_failover(reason="High latency detected")
Manages power consumption and battery optimization.
from src.power_manager import PowerManager, PowerMode
power_mgr = PowerManager(total_battery_capacity=500.0)
power_mgr.set_power_mode(PowerMode.CRISIS)
power_mgr.optimize_for_battery_life(target_runtime_hours=48)Performs connectivity diagnostics and health checks.
from src.diagnostics import ConnectivityDiagnostics
diagnostics = ConnectivityDiagnostics()
report = diagnostics.run_full_diagnostic()Crisis mode prioritizes critical traffic only, reducing power consumption and ensuring essential communications remain operational:
- Emergency communications: SOS messages, emergency calls
- Medical data: Patient records, medical telemetry
- Coordination: Central command communications
Non-critical traffic is automatically denied to preserve bandwidth and battery life.
- Python 3.7+
- Standard library only (no external dependencies)
MIT License - see LICENSE file for details
Daniel Azevedo Novais
failover = FailoverHandler()
failover.enable_failover()
failover.add_backup_connection({"type": "cellular", "priority": 1}) failover.add_backup_connection({"type": "satellite_backup", "priority": 2})
result = failover.trigger_failover() print(f"Failover status: {result['status']}")
### Power Management
```python
# Enable power-saving mode
manager.enable_power_saving()
# Set battery threshold for emergency mode
manager.set_battery_threshold(20) # Switch to emergency mode at 20%
from src.power_manager import PowerManager
# Create power manager
power_mgr = PowerManager()
# Enable low power mode
power_mgr.enable_low_power_mode()
# Get power status
status = power_mgr.get_power_status()
print(f"Power mode: {status['power_mode']}")
print(f"Power consumption: {status['power_consumption']}%")
# Estimate battery runtime
runtime = power_mgr.estimate_runtime(battery_capacity=500) # 500 Wh battery
print(f"Estimated runtime: {runtime:.1f} hours")
# Get comprehensive system diagnostics
diagnostics = manager.run_diagnostics()
print(diagnostics.report())
# Monitor specific metrics
signal_strength = manager.get_signal_strength()
latency = manager.get_latency()
bandwidth = manager.get_available_bandwidth()Create a config.yaml file in your project directory:
starlink:
emergency_mode:
enabled: false
auto_activate: true
battery_threshold: 15
bandwidth_priorities:
emergency_calls: 1
medical_data: 2
emergency_messages: 3
general_traffic: 4
power_management:
power_saving_enabled: false
low_power_threshold: 30
critical_battery_level: 10
failover:
enabled: true
backup_connections:
- type: cellular
priority: 1
- type: mesh_network
priority: 2- Optimize connectivity during power outages
- Prioritize medical and emergency communications
- Efficient bandwidth usage in limited infrastructure
- Quick deployment and configuration
- Automatic failover when primary connections fail
- Battery-optimized operation for extended periods
- Intelligent satellite selection for best coverage
- Adaptive bandwidth management
- Real-time diagnostics and monitoring
- Python 3.8 or higher
- Network connectivity for satellite communication
- Compatible Starlink hardware (for production use)
# Clone the repository
git clone https://github.com/danielnovais-tech/starlink_connectivity_tools.py.git
cd starlink_connectivity_tools.py
# Install in development mode
pip install -e .from starlink_connectivity_tools import StarlinkDish
# Connect to the dish
with StarlinkDish() as dish:
# Get status
status = dish.get_status()
print(f"Connected satellites: {status['connected_satellites']}")
# Check for emergencies
emergency = dish.check_emergency_conditions()
if emergency:
print(f"Emergency detected: {emergency}")
dish.stow() # Protective actionRun the comprehensive emergency mode example:
python examples/emergency_mode.pyThis example demonstrates:
- Real-time status monitoring
- Emergency condition detection
- Interactive emergency handling
- Continuous monitoring mode
See examples/README.md for more details.
Main interface for interacting with Starlink dish.
Methods:
connect()- Establish connection to dishdisconnect()- Disconnect from dishget_status()- Get current dish statuscheck_emergency_conditions()- Check for emergency conditionsstow()- Stow dish to emergency positionunstow()- Return dish to normal operationreboot()- Reboot the dish
Context Manager Support:
with StarlinkDish() as dish:
# Automatic connection and cleanup
status = dish.get_status()The library monitors for various emergency conditions:
- MOTOR_STUCK: Dish motor malfunction
- HIGH_OBSTRUCTION: Objects blocking dish view (>10%)
- THERMAL_THROTTLE: Overheating causing performance degradation
- HIGH_LATENCY: Network latency exceeding thresholds (>100ms)
This is a simulated implementation for demonstration and testing. In production, it would connect to an actual Starlink dish via gRPC at 192.168.100.1:9200.
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .
pip install -r requirements-dev.txt
python -m pytest tests/
### Running Tests
```bash
pytest
black starlink_connectivity_tools/
ruff check starlink_connectivity_tools/- Python 3.8+
- grpcio >= 1.50.0
MIT License - see LICENSE file for details. python -m unittest discover tests
pytest
pytest --cov=starlink_connectivity_tools
pytest tests/test_connection_manager.py
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
We welcome contributions! Please follow these guidelines:
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
Please ensure your code:
- Follows PEP 8 style guidelines
- Includes appropriate tests
- Updates documentation as needed
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Disclaimer
This library is not officially affiliated with or endorsed by Starlink or SpaceX. Use at your own risk. Always refer to the official Starlink API documentation for the most up-to-date information.
## Acknowledgments
- Built on top of the excellent [starlink-grpc](https://github.com/sparky8512/starlink-grpc-tools) library
- Designed for crisis response and humanitarian applications
- Inspired by real-world connectivity challenges in remote areas
## Disclaimer
This is an independent project and is not affiliated with, endorsed by, or supported by SpaceX or Starlink. Use at your own risk. The authors are not responsible for any issues arising from the use of this software.
## Support
For issues, questions, or contributions, please use the [GitHub issue tracker](https://github.com/danielnovais-tech/starlink_connectivity_tools.py/issues).
- Inspired by real-world challenges in Venezuela and crisis scenarios
- Built with support from the open-source community
- Thanks to all contributors and supporters
## Support
For issues, questions, or contributions:
- Open an issue on [GitHub](https://github.com/danielnovais-tech/starlink_connectivity_tools.py/issues)
- Contact: daniel.novais@sempreceub.com
- Documentation: [GitHub Repository](https://github.com/danielnovais-tech/starlink_connectivity_tools.py)
## Roadmap
- [ ] Enhanced power optimization algorithms
- [ ] Multi-satellite mesh networking
- [ ] Mobile app for remote monitoring
- [ ] Integration with emergency response systems
- [ ] Advanced predictive failover
- [ ] Support for additional satellite providers
## Disclaimer
This tool is designed to assist in crisis scenarios and optimize satellite connectivity. Always follow local regulations and guidelines when deploying communication equipment. This software is provided "as is" without warranty of any kind.
from src.diagnostics import Diagnostics
# Create diagnostics instance
diag = Diagnostics()
# Run health check
health = diag.run_health_check()
print(f"Health status: {health['status']}")
# Test connectivity
connectivity = diag.test_connectivity()
print(f"Connectivity test: {connectivity['status']}")
# Get signal strength
signal = diag.get_signal_strength()
print(f"Signal strength: {signal['signal_strength']}")
Run the emergency mode example for automatic failover configuration:
python examples/emergency_mode.pyThis example will:
- Connect to a Starlink dish
- Perform an initial connectivity assessment
- Activate emergency mode if issues are detected
- Attempt automatic recovery procedures
- Monitor connectivity for a period
- Provide a detailed summary of operations
from starlink_connectivity_tools import StarlinkDish, EmergencyMode
# Connect to dish using context manager
with StarlinkDish(host="192.168.100.1") as dish:
# Create emergency mode handler
emergency = EmergencyMode(dish)
# Check connectivity
assessment = emergency.check_connectivity()
# Activate emergency mode if needed
if assessment and not assessment['operational']:
emergency.activate()
emergency.attempt_recovery()
# Monitor for a period
emergency.monitor(duration=60, interval=10)connect(): Establish connection to the dishdisconnect(): Disconnect from the dishget_status(): Get current dish statusget_alerts(): Get active alertsreboot(): Reboot the dish
activate(): Activate emergency modedeactivate(): Deactivate emergency modecheck_connectivity(): Assess current connectivityattempt_recovery(): Attempt automatic recoverymonitor(duration, interval): Monitor connectivity over timeprint_summary(): Print operation summary
This is a simplified implementation for demonstration purposes. In a production environment, you would integrate with the actual Starlink gRPC API using libraries like starlink-grpc-core.
See LICENSE file for details. This example demonstrates:
- Extended connection timeout and retry settings
- Automatic failover with multiple backup connections
- Health check monitoring
Run the low power mode example for battery-powered scenarios:
python examples/low_power_mode.pyThis example demonstrates:
- Reduced power consumption settings
- Bandwidth limiting and optimization
- Battery runtime estimation
# Run all tests
python -m unittest discover tests
# Run specific test file
python -m unittest tests.test_optimizer
python -m pytest tests/
# Run with coverage
python -m pytest --cov=src tests/
# Run specific test file
python -m pytest tests/test_connection_manager.pyThe library uses a centralized configuration system in src/config/settings.py:
from src.config.settings import Settings
# Create settings with custom config
config = {
"connection": {
"timeout": 60,
"retry_attempts": 5,
},
"power": {
"default_mode": "low_power",
},
}
settings = Settings(custom_config=config)
# Get configuration values
timeout = settings.get("connection.timeout")
# Update configuration
settings.set("connection.retry_attempts", 3)# Install development dependencies
pip install -e ".[dev]"
# Run tests with coverage
pytest --cov=starlink_connectivity tests/
### Code Style
This project follows Python best practices:
- PEP 8 style guide
- Type hints where appropriate
- Comprehensive docstrings
### Running Linters
```bash
# Format code with black
black src/ tests/ examples/
# Check code with flake8
flake8 src/ tests/ examples/
# Type checking with mypy
mypy src/MIT License - see LICENSE file for details This project is licensed under the Apache License 2.0 - see the LICENSE file for details. This project is licensed under the Apache License 2.0 - see the LICENSE file for details. This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Inspired by:
- starlink-client - Multi-language Starlink client libraries
- starlink-grpc-tools - Scripts and tools for Starlink gRPC
For issues and questions, please use the GitHub Issues page.
For issues and questions, please open an issue on the GitHub repository.
Designed for reliable satellite connectivity in remote, off-grid, and emergency scenarios where power management is critical. This library is designed to work with Starlink satellite internet connections, providing tools for optimized bandwidth management in various scenarios including critical communications during emergencies. Inspired by real-world connectivity challenges and the need for reliable emergency communication systems in crisis scenarios.
For issues, questions, or contributions, please visit the GitHub repository.