This repoistory will allow you to spin up Emergency Generators producing fake IoT data. Each generator will write to its own MQTT topic the following values:
- Load
- Voltage
- Fuel Level
- Temperature
The payload will look like this:
{"generatorID": "generator1", "lat": 40.68066, "lon": -73.47429, "temperature": 186, "power": 186, "load": 2, "fuel": 277}
There are two ways to setup this Sim: Docker + Locally
- Install the Mosquitto MQTT Broker onto your device:
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update
sudp apt-get install mosquitto
- Start the Mosquitto broker:
sudo systemctl enable Mosquitto
sudo systemctl start Mosquitto
- Clone this repo to your local system:
git clone https://github.com/Jayclifford345/mqtt-emergency-generator.git
- Naviage to this folder
cd mqtt-emergency-generator/tree/master/generator_simulator
- Install the pip requirements
RUN python3 -m pip install --no-cache-dir -r requirements.txt
- Setup your enviroment variables
export GENERATORS=3
export BROKER=localhost
- Run the the simulator
python3 src/emergency_generator.py
- Clone this repo to your system
git clone https://github.com/Jayclifford345/mqtt-emergency-generator.git
- Build the simulator docker image:
docker build generator_simulator/. -t emergency-generator:latest
- Deploy the docker-compose file:
docker-compose up -d
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.