This is a simple MQTT client publishing some bogus values to simulate for the excercise for IoT Ark course on HAMK in 2022. See video below how it will look in Node-RED.
The file for this last excercise is: hamk-iot_maps.py.
You can see how the Arctic Circle is operating as it will publish coordinates of several entities. 😀
During publish, sensor name is appended to the MQTT topic, which allows you to subscribe to single sensor updates (or multiple with for example "#
").
Latest implementation connects each sensor as separate MQTT client (incl. own client id).
Made by: Visa Hannula
Topic format is MQTT_TOPIC/<sensor name>
In the topic, space characters in name are replaced with underscore. So for example sensor name "Santa Claus" will become: hamk/iot-python-client/Santa_Claus
.
It provides a sensor class which defines name and location coordinates of the sensor. Sensor can be given speed values for how fast it will move on the coordinate system.
Uses Paho MQTT (you might need to import, see requirements.txt).
Broker is "localhost" as default but you can define environment var MQTT_BROKER
as broker hostname or IP-address.
export MQTT_BROKER=192.168.0.2; python hamk-iot_maps.py
See the attached flow file HAMK.IoTArk.3.Maps.json (it is very simple but uses node-red-contrib-web-worldmap)