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

Publish to mqtt with the retain flag? #313

Open
bikeymouse opened this issue Apr 12, 2023 · 1 comment
Open

Publish to mqtt with the retain flag? #313

bikeymouse opened this issue Apr 12, 2023 · 1 comment

Comments

@bikeymouse
Copy link

Hi,

Thanks for your great software. I'm using this to publish the measurements to mqtt which works fine. I only would like to have the messages published with the retain flag set.

In that way the consumers of the data would get the latest state immediately after connecting to my mqtt broker.

Is there a way to configure this?

@bikeymouse
Copy link
Author

bikeymouse commented Apr 12, 2023

Ah, I found it: I changed line 136 in mqtt.go from
go m.Publish(topic, false, message)
to
go m.Publish(topic, true, message)

Now the messages are retained ;-)

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

No branches or pull requests

1 participant