# balenaSense - MQTT\_PUB\_INTERVAL

**URL:** <https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467>\
**Category:** balenaSense\
**Tags:** raspberrypi3\
**Created:** [January 21, 2023, 11:39am UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467 "2023-01-21T11:39:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcjhn](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mcjhn](https://forums.balena.io/u/mcjhn)\
**Post date:** [January 21, 2023, 11:39am UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/1 "2023-01-21T11:39:12Z")

</div>

Hi,

I’m very new to this and I apologies for the basic question. How do you change the reporting interval from the default 8 seconds to another value? From the link below, I think it’s something to do with MQTT\_PUB\_INTERVAL?

> **[GitHub - balena-labs-projects/sensor: Auto-detects connected i2c sensors and...](https://github.com/balena-labs-projects/sensor#readme)**
>
> Auto-detects connected i2c sensors and published data on HTTP or MQTT. - GitHub - balena-labs-projects/sensor: Auto-detects connected i2c sensors and published data on HTTP or MQTT.

Any help greatly appreciated.

---

<div class="post-metadata">

**Author:** ![mcjhn](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mcjhn](https://forums.balena.io/u/mcjhn)\
**Post date:** [January 23, 2023, 5:02pm UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/2 "2023-01-23T17:02:11Z")

</div>

I think my release (2.3.1) has this version of the BalenaSense Sense block from May 6, 2021 without the MQTT\_PUB\_INTERVAL variable

> <https://github.com/balena-labs-projects/sensor/commit/663a6b8469e204b0ad1c73194c32d6f09315baaf>

Is it possible to get the latest version?

---

<div class="post-metadata">

**Author:** ![mcjhn](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mcjhn](https://forums.balena.io/u/mcjhn)\
**Post date:** [January 24, 2023, 9:17am UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/3 "2023-01-24T09:17:42Z")

</div>

I was able to change the line 128 in sensor.py in the Sensor block to:  
time.sleep(58)  
and line 24 in update-dashboards.py in the Dashboard block to:  
time.sleep(60)

But I think the Influxdb block is still asking the Sensor block to report a reading every 10 seconds?

---

<div class="post-metadata">

**Author:** ![mcjhn](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mcjhn](https://forums.balena.io/u/mcjhn)\
**Post date:** [January 24, 2023, 7:11pm UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/4 "2023-01-24T19:11:24Z")

</div>

I followed the end of the guide and used [GitHub - balena-io-experimental/simple-sensor: Read sensor data and send via MQTT](https://github.com/balena-io-experimental/simple-sensor) and that worked a lot better (it has the latest version of the Sensor block)

---

<div class="post-metadata">

**Author:** ![builder555](https://avatars.discourse-cdn.com/v4/letter/b/cc9497/32.png) [@builder555](https://forums.balena.io/u/builder555)\
**Post date:** [January 24, 2023, 10:36pm UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/5 "2023-01-24T22:36:29Z")

</div>

Hello,

The Sensor block on balena hub should have the latest version.  
Are you using `image: bh.cr/balenalabs/sensor-<arch>` in your docker-compose.yml?

Here are all the sensor blocks:  
[balenaHub: an easier way to find and publish fleets, apps, and blocks for edge devices](https://hub.balena.io/blocks?0%5B0%5D%5Bt%5D=Any%20field&0%5B0%5D%5Bn%5D=any&0%5B0%5D%5Bo%5D%5Bslug%5D=full_text_search&0%5B0%5D%5Bo%5D%5Blabel%5D=contains&0%5B0%5D%5Bv%5D=sensor)

---

<div class="post-metadata">

**Author:** ![mcjhn](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@mcjhn](https://forums.balena.io/u/mcjhn)\
**Post date:** [January 25, 2023, 7:27am UTC](https://forums.balena.io/t/balenasense-mqtt-pub-interval/366467/7 "2023-01-25T07:27:55Z")

</div>

No that’s a little too advanced for me at the moment. I set it up by clicking ‘Deploy with balena’ on this beginners guide, thanks for looking into it.

> **[balenaSense v2: Updated temperature, pressure, and humidity monitoring for...](https://blog.balena.io/balenasense-v2-updated-temperature-pressure-and-humidity-monitoring-for-raspberry-pi/)**
>
> We updated balenaSense to v2, featuring less code by including balenaBlocks. Measure and monitor your environment, store and visualize your data.
