Dummy sensor data generator for testing IoT/ML pipelines
Project description
dummysensors
A lightweight generator of dummy sensor data for IoT and ML testing. Provides a simple Python API and CLI, supports running multiple sensors in parallel, photovoltaic domain sensors, and splitting output streams into files.
Installation
From PyPI (recommended):
pip install dummysensors
Quick Start (API)
from dummysensors import TemperatureSensor, VibrationSensor
# create sensors
temp = TemperatureSensor(min_val=18, max_val=24, noise=0.2)
vib = VibrationSensor(base_hz=50.0, amp=1.0, noise=0.05)
print(temp.read()) # e.g. 21.3
print(vib.read(t_s=0.123)) # sinusoidal signal with noise
Config file (YAML)
Instead of passing long --spec strings, you can define your setup in a YAML file.
By default, dummy-sensors run --config config.sensors.yaml will look for a file named config.sensors.yaml in the current directory.
Example config.sensors.yaml
rate: 2
count: 5
partition_by: type
outputs:
- type: jsonl
for: temp
path: out/temp.jsonl
- type: csv
for: vibration
path: out/vibration.csv
devices:
- id: engine-A
sensors:
- kind: temp
count: 1
- kind: vibration
count: 1
- id: plant-1
sensors:
- kind: irradiance
count: 1
params: {peak: 900.0, day_period_s: 10.0, sunrise: 0.0, sunset: 10.0}
- kind: pv_power
count: 1
params: {stc_kw: 5.0, inverter_eff: 0.95, p_kw_max: 4.8}
- kind: load
count: 1
params: {base_kw: 0.3, morning_kw: 0.8, evening_kw: 1.2}
- kind: soc
count: 1
params: {capacity_kwh: 10.0, soc0: 50.0}
Run with:
dummy-sensors run --config config.sensors.yaml
Quick Start (CLI)
Generate a single temperature stream to JSONL:
dummy-sensors generate --rate 5 --duration 2 --jsonl out/temp.jsonl
Run multiple sensors and devices, split by type into separate files:
dummy-sensors run \
--rate 5 \
--count 30 \
--spec "device=engine-A: temp*1,vibration*2; device=room-101: temp*2" \
--out "temp=out/temp.jsonl" \
--out "vibration=out/vib.jsonl" \
--out "*=stdout"
👉 Check out a full demo with live plotting and JSONL logging here: dummysensors demo (ds-test)
--spec format
The --spec string describes devices and sensors:
device=<ID>: <type>*<count>[, <type>*<count> ...] ; device=<ID2>: ...
Examples:
device=A: temp*3— device A with three temperature sensorsdevice=eng: temp*1,vibration*2; device=room: temp*2
As of
v0.3, supported sensor types:temp,vibration,irradiance,pv_power,load,soc. You can define setups either with--spec(quick inline config) or using a YAML file (--config config.sensors.yaml) for more complex scenarios.
Python API
TemperatureSensor
- Parameters:
min_val=15.0,max_val=30.0,noise=0.5,period_s=86400 - Methods:
read(t_s: float | None = None) -> float
VibrationSensor
- Parameters:
base_hz=50.0,amp=1.0,noise=0.1,spike_prob=0.0 - Methods:
read(t_s: float | None = None) -> float
IrradianceSensor
- Simulates solar irradiance with day/night cycle.
- Parameters:
peak,day_period_s,sunrise,sunset
PVPowerSensor
- Converts irradiance into PV output.
- Parameters:
stc_kw,inverter_eff,p_kw_max
LoadSensor
- Simulates household/plant consumption profile.
- Parameters:
base_kw,morning_kw,evening_kw,day_period_s
BatterySoCSensor
- Integrates charge/discharge depending on PV vs load.
- Parameters:
capacity_kwh,soc0
Sensor Registry
dummysensors.registry.SENSOR_REGISTRY— maps stringkind→ classdummysensors.registry.make_sensor(kind: str, **params)
Orchestrator
-
dummysensors.orchestrator.run_stream(...)- Creates instances based on
spec_strorconfig, respects priority and per-sensor rate_hz. writer_for_typeis a dicttype → callable(sample_dict).*= default writer.
- Creates instances based on
Output Format
JSON Lines (one record per line):
{
"ts_ms": 171234,
"device_id": "engine-A",
"sensor_id": "vibration-1",
"type": "vibration",
"value": -0.124
}
Also supported: CSV. Planned: Kafka, Redis Stream, WebSocket.
Roadmap
v0.2✅ — CSV writer, partitioning, YAML configv0.3✅ — Smart photovoltaic sensors (irradiance,pv_power,load,soc), per-sensorrate_hz, priority-based orchestrationv0.4🚧 — AnomalyInjector (spike, dropout, drift), new sensors (humidity,rpm,battery_voltage,gps,accel-3axis)v0.5🚧 — Outputs: Kafka, Redis Stream, WebSocket live preview
Development
git clone https://github.com/SculptTechProject/dummysensors
cd dummysensors
pip install -e .
pip install -r requirements.txt
- Project layout: src-layout
- Tests:
pytest -q - Lint/format:
ruff check src testsandruff format
License
MIT © Mateusz Dalke
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dummysensors-0.3.2.tar.gz.
File metadata
- Download URL: dummysensors-0.3.2.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1b1691fa7b2b0a51baca5a0bbb14c3894eea1c77a05ff638325fd3c00e93eaa
|
|
| MD5 |
80ef1e6a31c7e76186f7e36fdf3e6f88
|
|
| BLAKE2b-256 |
f20ac45853c42f90acc83d9bf45a2af7214d61775958c98c612e7ba94ac768c7
|
Provenance
The following attestation bundles were made for dummysensors-0.3.2.tar.gz:
Publisher:
publish.yml on SculptTechProject/dummysensors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dummysensors-0.3.2.tar.gz -
Subject digest:
b1b1691fa7b2b0a51baca5a0bbb14c3894eea1c77a05ff638325fd3c00e93eaa - Sigstore transparency entry: 480441376
- Sigstore integration time:
-
Permalink:
SculptTechProject/dummysensors@a56f3a95658d0450488cca505ab76b20fc5eafc2 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/SculptTechProject
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a56f3a95658d0450488cca505ab76b20fc5eafc2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file dummysensors-0.3.2-py3-none-any.whl.
File metadata
- Download URL: dummysensors-0.3.2-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
207af04a476cab19c3e90ec0abe0f0447587b3c1407ffc63cc01af491b82b722
|
|
| MD5 |
6bdc253cbcaee5fe5b50f0d235a6d360
|
|
| BLAKE2b-256 |
81c1a079eda75a7b3ff97eec83f30559c9e957bfd31a5b20249a047690da8790
|
Provenance
The following attestation bundles were made for dummysensors-0.3.2-py3-none-any.whl:
Publisher:
publish.yml on SculptTechProject/dummysensors
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dummysensors-0.3.2-py3-none-any.whl -
Subject digest:
207af04a476cab19c3e90ec0abe0f0447587b3c1407ffc63cc01af491b82b722 - Sigstore transparency entry: 480441390
- Sigstore integration time:
-
Permalink:
SculptTechProject/dummysensors@a56f3a95658d0450488cca505ab76b20fc5eafc2 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/SculptTechProject
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a56f3a95658d0450488cca505ab76b20fc5eafc2 -
Trigger Event:
release
-
Statement type: