balena-labs-projects / sensor

Auto-detects connected i2c sensors and published data on HTTP or MQTT.
14 stars 6 forks source link

Allow user specified measurement interval for MQTT push #3

Closed kb2ma closed 3 years ago

kb2ma commented 3 years ago

If the user configures the sensor block to push data measurements via MQTT, the measurement interval is fixed at 8 seconds. However, a user may have a strong opinion on this value based on the context for the measurement. The interval could range from sub-second to once an hour. The interval may change dynamically depending on the circumstances. Communication bandwidth may affect this value as well.

It would be useful to have a default value for the interval but allow the user to specify it via a device variable.

It also would be useful to specify in the README that the sensor block pushes data via MQTT while it expects an external service to pull data via HTTP.

alanb128 commented 3 years ago

This value can now be set with the MQTT_PUB_INTERVAL device variable.