Skip to content

Device Simulator ​

This script simulates a Sensor device sending uplink messages with sensor data. It can send these messages either via HTTP POST to a backend endpoint, or both.

Installation ​

The simulator requires Python 3.11+ and the libraries listed in pyproject.toml.

Mit UV (empfohlen) ​

bash
# Dependencies installieren
uv sync

# Simulator starten
uv run python app.py

Mit pip (alternativ) ​

bash
pip install -r requirements.txt
python app.py

Running the Simulator ​

You can run the simulator directly using Python:

bash
uv run python app.py

The simulator's behavior can be configured using environment variables.

Configuration ​

The following environment variables can be used to configure the simulator:

VariableDescriptionDefault Value
DEVICE_NAMEName of the simulated device.Simulator-001
DEVICE_EUIDevice EUI (DevEUI). If not set, a random one is generated.eui-<random_hex>
SLEEP_TIMETime in seconds between sending messages.5
BACKEND_API_URLBase URL of the backend API for HTTP uplinks.http://localhost:8000

If an invalid value is provided, a warning will be logged, and no messages will be sent.

Message Format ​

The simulator generates messages mimicking the Helium webhook format, including simulated sensor data (distance, battery, tilt) within the object and base64 encoded in the data field.