Connection Module

seestarpy.connection.find_available_ips(n_ip, timeout=2)

Find all Seestars on the local network using parallel mDNS lookups.

Resolves hostnames seestar.local, seestar-2.local, …, seestar-<n_ip>.local in parallel and updates the module-level AVAILABLE_IPS dictionary with the results. Use this when controlling multiple Seestars from a single script.

Parameters:
  • n_ip (int) – Maximum Seestar index to search for. For example, n_ip=3 will probe seestar.local, seestar-2.local, and seestar-3.local.

  • timeout (float, optional) – Maximum time in seconds to wait for all lookups. Default is 2.

Examples

>>> from seestarpy import connection as conn
>>> conn.find_available_ips(3)
✓ Found seestar.local at 192.168.1.243
✓ Found seestar-2.local at 192.168.1.244
✗ seestar-3.local has no active IP address
Use connection.AVAILABLE_IPS to get active addresses
>>> conn.AVAILABLE_IPS
{'seestar.local': '192.168.1.243', 'seestar-2.local': '192.168.1.244'}
seestarpy.connection.find_seestar()

Find a Seestar on the local network using mDNS hostname resolution.

Attempts to resolve seestar.local via DNS. This function is called automatically when the seestarpy package is imported, and its result is used to set DEFAULT_IP.

If the Seestar is not found (e.g. you are connected to a different network), DEFAULT_IP falls back to "10.0.0.1" — the Seestar’s own Wi-Fi hotspot address.

Returns:

The IP address of the Seestar if found, otherwise None.

Return type:

str or None

Examples

>>> from seestarpy import connection as conn
>>> conn.find_seestar()
Seestar found at: 192.168.1.243
'192.168.1.243'
seestarpy.connection.multiple_ips(func)

Decorator that allows a function to run against multiple IP addresses. Pass ips at call time to override DEFAULT_IP.

seestarpy.connection.resolve_ips(call_time_ips)

Resolve the ips= kwarg to a flat list of IP-address strings.

Accepts the same shapes as multiple_ips(): None (current DEFAULT_IP), an int (2seestar-2.local), a hostname or IP string, the literal "all", or a list mixing any of these. Unknown entries are dropped (with a warning printed) so the result is always a non-empty list of resolved IPs when input is valid.

seestarpy.connection.send_command(params)

Send a JSON-RPC command to the Seestar over TCP.

Opens a short-lived TCP socket to DEFAULT_IP on port DEFAULT_PORT, sends the JSON payload, and waits for a \r\n-terminated response.

Most users will not call this directly — use the functions in seestarpy.raw or the top-level convenience API instead.

Parameters:

params (dict) – A dictionary with at least a "method" key. An optional "params" key provides method-specific arguments. For example: {"method": "scope_park", "params": {"equ_mode": True}}.

Returns:

On success, a parsed JSON-RPC response dictionary with keys 'jsonrpc', 'Timestamp', 'method', 'result', 'code', and 'id'. If the response cannot be parsed as JSON, the raw response string is returned instead.

Return type:

dict or str

Examples

>>> from seestarpy.connection import send_command
>>> send_command({"method": "test_connection"})
{'jsonrpc': '2.0', 'Timestamp': '...', 'method': 'test_connection',
 'result': 'ok', 'code': 0, 'id': 1}
seestarpy.connection.set_default_ip(n)

Set DEFAULT_IP to the n-th Seestar in AVAILABLE_IPS.

This is a convenience shorthand so you can switch between Seestars with a single integer instead of typing full hostnames or IPs.

The mapping follows the Seestar naming convention:

  • 1seestar.local

  • 2seestar-2.local

  • 3seestar-3.local

  • etc.

Parameters:

n (int) – Seestar number (1-based).

Raises:

KeyError – If the corresponding hostname is not in AVAILABLE_IPS. Call find_available_ips() first to populate the dictionary.

Examples

>>> from seestarpy import connection as conn
>>> conn.find_available_ips(3)
>>> conn.set_default_ip(2)
DEFAULT_IP → 192.168.1.83 (seestar-2.local)