I am creating an array from 4 different MQTT payloads that monitor a percentage. I then do a difference calculation and post the result to a dashboard. It works, but only if the broker sends message 1-4 during the measurement cycle.
However, debug shows there are times when not all messages are broadcasted during a measurement cycle and the array will randomly see duplicate inputs such as [2,3,2,4] instead of [1,2,3,4].
How would I load an array only when messages 1-4 are received? Any duplicates would be updated while waiting for the final message to arrive