From 6b103f397b79ce121ddfd77c5ae1f4c9366aa543 Mon Sep 17 00:00:00 2001 From: simonox Date: Wed, 22 Feb 2023 15:43:48 +0100 Subject: [PATCH] added a random number generator --- software/firmware/energy-monitor/00-simulator/simulate.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 software/firmware/energy-monitor/00-simulator/simulate.sh diff --git a/software/firmware/energy-monitor/00-simulator/simulate.sh b/software/firmware/energy-monitor/00-simulator/simulate.sh new file mode 100755 index 0000000..e545d47 --- /dev/null +++ b/software/firmware/energy-monitor/00-simulator/simulate.sh @@ -0,0 +1,8 @@ +#!/bin/sh +echo Publishing random values to topic '/iot-platform/energy-monitor/test-device‘ +while true +do + mosquitto_pub -h localhost -p 1883 -t '/iot-platform/energy-monitor/test-device/watt' -m $((1 + $RANDOM % 10 * 500)) + printf '%s' "." + sleep 1 +done \ No newline at end of file