ditto
ditto copied to clipboard
Retrieving the state of a thing in a Javascript incoming payload mapper
When working with IoT devices, sometimes we need to compute things that are not immediately available on the incoming payload. For example:
- A device connects to an MQTT broker, and publishes its sampling rate
- In subsequent messages, the device only sends a counter and a value
To calculate the timestamp of a message, we would need the registration time and the sampling rate. Is this possible using a javascript incoming payload mapper? I guess it is possible by publishing the entire state of the device to mqtt and reading it again, but this seems redundant.
Thank you.