Compare commits

..

2 Commits

Author SHA1 Message Date
hasslesstech bc0977588e [P] Add second agent in docker-compose.yaml
Component testing / Hub testing (push) Successful in 21s
Component testing / Store testing (push) Successful in 22s
Component testing / Integration smoke testing (push) Has been cancelled
2026-03-25 22:34:50 +02:00
hasslesstech 3d2b02c0c6 [P] Add GPS file selection to agent 2026-03-25 22:34:50 +02:00
3 changed files with 24 additions and 8 deletions
+3 -4
View File
@@ -1,18 +1,17 @@
import os
def try_parse(type, value: str):
try:
return type(value)
except Exception:
return None
USER_ID = try_parse(int, os.environ.get("USER_ID")) or 1
# MQTT config
MQTT_BROKER_HOST = os.environ.get("MQTT_BROKER_HOST") or "mqtt"
MQTT_BROKER_PORT = try_parse(int, os.environ.get("MQTT_BROKER_PORT")) or 1883
MQTT_TOPIC = os.environ.get("MQTT_TOPIC") or "agent"
# Delay for sending data to mqtt in seconds
# Data-related config
USER_ID = try_parse(int, os.environ.get("USER_ID")) or 1
DELAY = try_parse(float, os.environ.get("DELAY")) or 1
GPS_SOURCE = os.environ.get("GPS_SOURCE") or "data/gps.csv"
+1 -1
View File
@@ -42,7 +42,7 @@ def run():
# Prepare mqtt client
client = connect_mqtt(config.MQTT_BROKER_HOST, config.MQTT_BROKER_PORT)
# Prepare datasource
datasource = FileDatasource(16384.0, "data/accelerometer.csv", "data/gps.csv", "data/parking.csv")
datasource = FileDatasource(16384.0, "data/accelerometer.csv", config.GPS_SOURCE, "data/parking.csv")
# Infinity publish data
publish(client, config.MQTT_TOPIC, datasource)
+20 -3
View File
@@ -14,8 +14,7 @@ services:
mqtt_network:
fake_agent:
container_name: agent
agent1:
build:
context: .
dockerfile: agent/Dockerfile
@@ -26,7 +25,25 @@ services:
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
DELAY: 0.1
DELAY: 1.2
USER_ID: 2
networks:
mqtt_network:
agent2:
build:
context: .
dockerfile: agent/Dockerfile
depends_on:
- mqtt
environment:
PYTHONUNBUFFERED: 1
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
GPS_SOURCE: "data/route2.csv"
DELAY: 1.0
USER_ID: 3
networks:
mqtt_network: