Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mqtt-all.py example: use retained publications #118

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

andypiper
Copy link
Contributor

Per the change I suggested to the Pico-based Enviro code, with this change, the MQTT messages will be published with the retain flag set, so that if a consumer is not subscribed, the most recent set of readings can still be read by a future subscriber later.

This supports the homebridge-enviroplus plugin better, so that a publication is more likely to exist on the topic even if the Pi with Enviroplus / this example code is not running at the time.

Additional update to consider would be to align the message data formats between this sample and the newer Enviro product line.

Per [the change I suggested to the Pico-based Enviro code](pimoroni/enviro#2), with this change, the MQTT messages will be published with the retain flag set, so that if a consumer is not subscribed, the most recent set of readings can still be read by a future subscriber later. 

This supports the [homebridge-enviroplus plugin](mhawkshaw/homebridge-enviroplus#2 (comment)) better, so that a publication is more likely to exist on the topic even if the Pi with Enviroplus / this example code is not running at the time. 

Additional update to consider would be to align the message data formats between this sample and the newer Enviro product line.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2881761635

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.531%

Totals Coverage Status
Change from base Build 2733823958: 0.0%
Covered Lines: 121
Relevant Lines: 128

💛 - Coveralls

@Gadgetoid Gadgetoid merged commit c8eb2c1 into pimoroni:master Aug 19, 2022
@Gadgetoid
Copy link
Member

Good idea, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants