Compare commits

..

1 Commits

Author SHA1 Message Date
hasslesstech b58167f0de [P] Fix wrong row sending order
Component testing / Hub testing (push) Successful in 35s
Component testing / Store testing (push) Successful in 26s
Component testing / Integration smoke testing (push) Successful in 2m37s
2026-03-25 23:26:39 +02:00
6 changed files with 10 additions and 29 deletions
-2
View File
@@ -2,5 +2,3 @@ import os
STORE_HOST = os.environ.get("STORE_HOST") or "localhost"
STORE_PORT = os.environ.get("STORE_PORT") or 8000
TRACK_ID = int(os.environ.get("TID") or '1')
+1 -2
View File
@@ -4,7 +4,6 @@ from kivy_garden.mapview import MapMarker, MapView
from kivy.clock import Clock
from lineMapLayer import LineMapLayer
from datasource import Datasource
import config
line_layer_colors = [
[1, 0, 0, 1],
@@ -88,7 +87,7 @@ class MapViewApp(App):
self.car_markers[user_id].lat = lat
self.car_markers[user_id].lon = lon
if user_id == config.TRACK_ID:
if user_id == 1:
self.mapview.center_on(lat, lon)
def set_pothole_marker(self, point):
+4 -3
View File
@@ -1,17 +1,18 @@
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"
# Data-related config
USER_ID = try_parse(int, os.environ.get("USER_ID")) or 1
# Delay for sending data to mqtt in seconds
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", config.GPS_SOURCE, "data/parking.csv")
datasource = FileDatasource(16384.0, "data/accelerometer.csv", "data/gps.csv", "data/parking.csv")
# Infinity publish data
publish(client, config.MQTT_TOPIC, datasource)
+3 -20
View File
@@ -14,7 +14,8 @@ services:
mqtt_network:
agent1:
fake_agent:
container_name: agent
build:
context: .
dockerfile: agent/Dockerfile
@@ -25,25 +26,7 @@ services:
MQTT_BROKER_HOST: "mqtt"
MQTT_BROKER_PORT: 1883
MQTT_TOPIC: "agent_data_topic"
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
DELAY: 0.1
networks:
mqtt_network:
+1 -1
View File
@@ -45,7 +45,7 @@ async def websocket_endpoint(websocket: WebSocket, user_id: int):
try:
# send already available data
r = processed_agent_data.select()
r = processed_agent_data.select().order_by(processed_agent_data.c.timestamp)
stored_data = SessionLocal().execute(r).fetchall()
jsonable_data = [{c.name: getattr(i, c.name) for c in processed_agent_data.columns} for i in stored_data]