mirror of
https://github.com/tcivie/meshtastic-metrics-exporter.git
synced 2025-01-12 14:27:51 -08:00
Merge pull request #56 from tcivie/50-ingest-from-multiple-mqtt-topics-and-servers-this-somewhat-goes-with-the-other-request
Added support for multiple topics (comma seperated)
This commit is contained in:
commit
36ce36287e
2
.env
2
.env
|
@ -13,7 +13,7 @@ MQTT_PORT=1883
|
|||
MQTT_USERNAME=meshdev
|
||||
MQTT_PASSWORD=large4cats
|
||||
MQTT_KEEPALIVE=60
|
||||
MQTT_TOPIC='msh/#'
|
||||
MQTT_TOPIC='msh/EU_868/#,msh/US/#'
|
||||
MQTT_IS_TLS=false
|
||||
|
||||
# MQTT protocol version (default: MQTTv5) the public MQTT server supports MQTTv311
|
||||
|
|
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
uses: actions/checkout@v4
|
||||
|
||||
- name: Start Docker Compose
|
||||
run: docker-compose up -d
|
||||
run: docker compose up -d
|
||||
|
||||
- name: Wait for containers to start
|
||||
run: sleep 60 # 1 Minute
|
||||
|
@ -23,11 +23,11 @@ jobs:
|
|||
|
||||
for service in "${services[@]}"
|
||||
do
|
||||
container_id=$(docker-compose ps -q $service)
|
||||
container_id=$(docker compose ps -q $service)
|
||||
|
||||
if [ -z "$container_id" ]; then
|
||||
echo "Error: Container for $service not found"
|
||||
docker-compose logs $service
|
||||
docker compose logs $service
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -37,14 +37,14 @@ jobs:
|
|||
if [ "$status" != "running" ]; then
|
||||
echo "Error: Container $service ($container_id) is not running. Current status: $status"
|
||||
echo "Last logs for $service:"
|
||||
docker-compose logs --tail=50 $service
|
||||
docker compose logs --tail=50 $service
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$restarts" -gt 0 ]; then
|
||||
echo "Error: Container $service ($container_id) has restarted $restarts times"
|
||||
echo "Last logs for $service:"
|
||||
docker-compose logs --tail=50 $service
|
||||
docker compose logs --tail=50 $service
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -65,4 +65,4 @@ jobs:
|
|||
|
||||
- name: Clean up
|
||||
if: always()
|
||||
run: docker-compose down -v
|
||||
run: docker compose down -v
|
||||
|
|
4
main.py
4
main.py
|
@ -30,7 +30,9 @@ def release_connection(conn):
|
|||
|
||||
def handle_connect(client, userdata, flags, reason_code, properties):
|
||||
print(f"Connected with result code {reason_code}")
|
||||
client.subscribe(os.getenv('MQTT_TOPIC', 'msh/israel/#'))
|
||||
topics = os.getenv('MQTT_TOPIC', 'msh/israel/#').split(',')
|
||||
topics_tuples = [(topic, 0) for topic in topics]
|
||||
client.subscribe(topics_tuples)
|
||||
|
||||
|
||||
def update_node_status(node_number, status):
|
||||
|
|
Loading…
Reference in a new issue