mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-06-11 00:34:46 +02:00
dfacfeade8
Introduces a 'set format and forget' workflow for MQTT brokers. Users
reference a bundled preset by name inside the existing brokers: list,
and the package supplies the endpoints, audiences, and TLS settings.
Endpoint changes ship via 'pip install -U' instead of manual edits.
What changes
- New repeater/presets/ package with a tiny lazy YAML loader and two
bundled presets: waev (mqtt-{a,b}.waev.app) and letsmesh (EU + US).
- New format-family constant MC2MQTT_FORMATS = ('meshcoretomqtt',
'letsmesh', 'waev') replaces the inline tuple in topic resolution.
The legacy 'mqtt' format keeps its custom-topic semantics unchanged.
- Two-pass broker assembly in mqtt_handler.py: pass 1 expands every
{preset: <name>} entry inline; pass 2 collapses duplicates by name
with later-wins semantics. Place override entries AFTER preset
entries.
- Hard-coded LETSMESH_BROKERS constant deleted; its data now lives in
repeater/presets/letsmesh.yaml.
- convert_letsmesh_to_broker_config() collapsed from ~70 to ~25 lines
by emitting {preset: letsmesh} plus disable overrides for unwanted
brokers. Honors broker_index in (-1, 0, 1), additional_brokers, and
enabled flag exactly as before.
- update_mqtt_config API endpoint accepts {preset: <name>} entries and
passes them through unchanged so the web UI can author them when the
frontend is updated.
- config.yaml.example documents the preset entry shape, the override
rule, and the format family hierarchy.
- pyproject.toml ships presets/*.yaml as package data.
How to use
mqtt_brokers:
iata_code: "LAX"
brokers:
- preset: waev
# Override a single preset broker:
brokers:
- preset: waev
- name: waev-b
enabled: false
Tests
- tests/test_presets.py: 9 tests covering loader, expand/merge,
MC2MQTT topic-family parity, and parametrized legacy migration.
Co-Authored-By: Oz <oz-agent@warp.dev>
93 lines
2.2 KiB
TOML
93 lines
2.2 KiB
TOML
[build-system]
|
|
requires = ["setuptools>=61.0", "wheel", "setuptools_scm>=8.0"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[project]
|
|
name = "pymc_repeater"
|
|
dynamic = ["version"]
|
|
authors = [
|
|
{name = "Lloyd", email = "lloyd@rightup.co.uk"},
|
|
]
|
|
description = "PyMC Repeater Daemon"
|
|
readme = "README.md"
|
|
license = {text = "MIT"}
|
|
requires-python = ">=3.8"
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Intended Audience :: Developers",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Operating System :: POSIX :: Linux",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.8",
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Topic :: Communications",
|
|
"Topic :: System :: Networking",
|
|
]
|
|
keywords = ["mesh", "networking", "lora", "repeater", "daemon", "iot"]
|
|
|
|
|
|
dependencies = [
|
|
"pymc_core[hardware] @ git+https://github.com/rightup/pyMC_core.git@dev",
|
|
"pyyaml>=6.0.0",
|
|
"cherrypy>=18.0.0",
|
|
"paho-mqtt>=1.6.0",
|
|
"cherrypy-cors==1.7.0",
|
|
"psutil>=5.9.0",
|
|
"pyserial>=3.5",
|
|
"pyjwt>=2.8.0",
|
|
"ws4py>=0.6.0",
|
|
]
|
|
|
|
|
|
|
|
[project.optional-dependencies]
|
|
# SX1262/SPI support (Linux only; required for Raspberry Pi HATs)
|
|
hardware = [
|
|
"pymc_core[hardware] @ git+https://github.com/rightup/pyMC_core.git@dev",
|
|
]
|
|
# RRD metrics (Performance Metrics chart); system librrd required (e.g. apt install rrdtool)
|
|
rrd = [
|
|
"rrdtool",
|
|
]
|
|
dev = [
|
|
"pytest>=7.4.0",
|
|
"pytest-asyncio>=0.21.0",
|
|
"black>=23.0.0",
|
|
"isort>=5.12.0",
|
|
"mypy>=1.7.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
pymc-repeater = "repeater.main:main"
|
|
pymc-cli = "repeater.local_cli:main"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["."]
|
|
include = ["repeater*"]
|
|
|
|
[tool.setuptools.package-data]
|
|
repeater = [
|
|
"web/html/*.html",
|
|
"web/html/*.ico",
|
|
"web/html/assets/**/*",
|
|
"web/*.yaml",
|
|
"web/*.html",
|
|
"presets/*.yaml",
|
|
]
|
|
|
|
[tool.black]
|
|
line-length = 100
|
|
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
|
|
|
|
[tool.isort]
|
|
profile = "black"
|
|
line_length = 100
|
|
|
|
[tool.setuptools_scm]
|
|
version_scheme = "guess-next-dev"
|
|
local_scheme = "no-local-version"
|
|
version_file = "repeater/_version.py"
|