Continuing with the theme of Node-RED ( and MQTT ) from the last post ( 27.03.2021 ), I have also created a 'flow' for use with the UV Radiation Meter ( see 12.01.2021 ).
My Node-RED 'flow' for passing UV radiation data to the HiveMQ broker |
The 'flow' ( see image above ) starts by periodically reading the UV Index which was measured by the meter, assigns the appropriate W.H.O. level, joins the data as a single message and publishes it to the topic "SpacerLabs/Uvindex" on the HiveMQ MQTT broker. But only if the index has changed.
My messages published to the topic SpacerLabs/Uvindex |
Not surprisingly the status of the radiation meter was 'ONLINE' at the time the UV radiation measurements were being made in my backyard. When subscribing to a topic(s) the last message the broker has received from the publishing client, flagged as 'Retained', is displayed to confirm the connection straightaway, without the delay until the next message arrives. Quality of Service, QoS, ( 0, 1 or 2 with 2 being the highest ), is an important part of MQTT. QoS defines a level of guarantee of delivery of messages between broker and client. I selected QoS = 1.