diff --git a/geocache.db b/geocache.db index cddc8d2..0c40788 100644 Binary files a/geocache.db and b/geocache.db differ diff --git a/src/pymd3_vue_location_sim/simulation_service.py b/src/pymd3_vue_location_sim/simulation_service.py index a085f29..0114e47 100644 --- a/src/pymd3_vue_location_sim/simulation_service.py +++ b/src/pymd3_vue_location_sim/simulation_service.py @@ -1,6 +1,5 @@ import asyncio import psutil -import datetime import math import random import traceback @@ -212,6 +211,16 @@ class SimulationService: if isinstance(data, dict) else getattr(data, "address", None) ) + item_type = ( + data.get("type") + if isinstance(data, dict) + else getattr(data, "type", None) + ) + instruction = ( + data.get("instruction") + if isinstance(data, dict) + else getattr(data, "instruction", None) + ) try: delay = self.parse_delay_seconds(delay) except ValueError as e: @@ -259,16 +268,24 @@ class SimulationService: "status": "queued", "start": new_time.isoformat(), "address": address, + "instruction": instruction, + "type": item_type, } resp = { "command_status": "OK", "command_class": "simulation_control", "command": "add", "message": f"Location {loc_id} added to the queue", - "data": { - "simulation": self.get_simulation_status(), - "location_item": location_item, - }, + "data": + { + "simulation": + { + "data": + { + loc_id: location_item, + } + } + } } self.add_item(loc_id, location_item) await self.enqueue_next_simulation_item() @@ -566,8 +583,8 @@ class SimulationService: def get_uptime(self) -> float: boot_time_timestamp = psutil.boot_time() - boot_time = datetime.datetime.fromtimestamp(boot_time_timestamp) - uptime = datetime.datetime.now() - boot_time + boot_time = datetime.fromtimestamp(boot_time_timestamp) + uptime = datetime.now() - boot_time return uptime def get_status(self) -> dict: