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

WRITE vs PUBLISH (with retain flag) #5

Open
christianruppert opened this issue May 30, 2023 · 1 comment
Open

WRITE vs PUBLISH (with retain flag) #5

christianruppert opened this issue May 30, 2023 · 1 comment

Comments

@christianruppert
Copy link

I am not sure if I am doing something wrong, but could it be that your persistance is not supported by PubSubClient.

See my thread here: Imroy/pubsubclient#96

I guess the retain flag is not working (have to use write API) - which is not supported by a lot of clients (NodeRed, PubSub).

Workaround is "Rule" in your backend and forward a publish via write to other topic (but requires new topic to avoid loop).

Any ideas, input, feedback?

Thanks,
Chris

PS: For others, if you really need persistent topics with libraries only supporting publish you might have to use the workaround to set up a rule which takes TOPIC_A publish and WRITES it to TOPIC_A_Persistant

@christianruppert
Copy link
Author

Addition: In the samples (e.g. here https://github.com/beebotte/bbt_arduino_examples/blob/master/examples/TempHumidReporting.ino) around line 60 it looks like its possible to get the desired behaviour by using more complex JSON format - I will try that, if that works would be a workaround - though a lot of code to e.g. send a simple short string like "Status" with retain=1 would be much nicer :-)

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