pyBROTlib
Python interface to BROT telescopes, talking to the telescope's TwinCAT/PLC control system over MQTT.
Installation
uv add pybrotlib
Usage
Connect a transport (currently MQTT) to a named telescope and drive it through the BROT
object:
import asyncio
from pybrotlib import BROT
from pybrotlib.transport import MQTTTransport
async def main() -> None:
transport = MQTTTransport(host="localhost", port=1883)
brot = BROT(transport, "MyTelescope")
# the transport needs its own task to receive telemetry/publish commands
asyncio.create_task(transport.run())
await asyncio.sleep(2) # give it a moment to connect and receive first telemetry
await brot.telescope.track(ra=10.5, dec=41.2)
print(brot.telescope.status)
asyncio.run(main())
transport.telemetry holds the live telemetry tree (see pybrotlib/telemetry.py), which is
kept up to date by messages received on <telescope>/.../Telemetry topics and read by the
component properties below.
Components
Each BROT instance exposes one component per subsystem, all constructed from the same
transport and telescope name:
telescope(BROTTelescope) — pointing (track,move), offsets (set_offset_ha,set_offset_dec,set_offset_alt,set_offset_az), power/park/stop/reset, and status (status,motion_state,global_status).focus(BROTFocus) —position,set(focus),powered,referenced.dome(BROTDome) — shutter/tracking state,open,close,start_tracking,stop_tracking,park,reset.roof(BROTRoof) — roll-off roof state,open,close,stop,reset.mirrorcovers(BROTMirrorCovers) —status,open,close.
All commands are fire-and-forget MQTT publishes; callers are expected to poll telemetry (directly, or via the component's status properties) to observe the result.
Weather
pybrotlib.weather publishes live temperature/humidity/pressure onto a telescope's
{site}/Telescope/SET topic, for sites where a Python process has access to a weather source.
Pick a WeatherSource and hand it to a WeatherPublisher alongside your transport:
from pybrotlib.weather import PyobsWeatherSource, WeatherPublisher
# or: from pybrotlib.weather import FileWeatherSource
source = PyobsWeatherSource("https://weather.example.org")
weather = WeatherPublisher(transport, "MyTelescope", source, interval=60, max_age=300)
asyncio.create_task(weather.run())
max_age (seconds) guards against publishing a stale reading: BROTLib has no way to tell a fresh
value from a stale one once it's received, so a source that's alive but returning an old cached
reading is caught here instead. A reading missing one field (e.g. a broken pressure sensor) still
publishes the fields it does have.
Development
uv sync --group dev
uv run pytest
Metadata
Release files for pyBROTlib 1.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pybrotlib-1.3.1.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pybrotlib-1.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.8 kB
Release files / pybrotlib-1.3.1.tar.gz
| Download URL | pybrotlib-1.3.1.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8e26b280c5e11ee2fd632d897d90de1261e8f4e7552ef818c9eb5a5def7424b
|
|
BLAKE2b-256 checksum How to use checksums |
9470e1fd2c6f774ed174f97f5f3566779c2b488c9a33ffb4d88b31b7d35e0424
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pybrotlib-1.3.1-py3-none-any.whl
| Download URL | pybrotlib-1.3.1-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
acd1aab2ea5003cc93500d374046ed9afffc2ba711824676d38bc0c94f536ff5
|
|
BLAKE2b-256 checksum How to use checksums |
2962df452d8b71792dee85d97a7a4dec2e0f482dd01555adb499052016e65a3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|