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 plugin doesn't seem to remove values from the valueMap after sending #22

Open
caluml opened this issue Dec 11, 2024 · 2 comments
Open

Comments

@caluml
Copy link

caluml commented Dec 11, 2024

Hi @fr3ts0n

I just installed v2.6.13 today which fixed a problem reading from the OBD device - thanks!

I am trying to use the MQTT plugin, and it seems to be working, apart from the fact that it sends the same data over and over.

Looking at the code in MqttPlugin, I can't see anywhere that it removes the sent data from valueMap after publishing it. Am I correct? (I am viewing it on Github, rather than in an IDE, so might be missing something).

Also, I am thinking of adding an HttpPlugin, to submit data to a configurable POST endpoint - any thoughts/advice? My plan is to take the MqttPlugin and use that as the template.
I'm thinking of submitting as a JSON payload, but might just submit it as something simpler if JSON makes it too complicated in Android and leave deserialising and interpretting to the server side.

@caluml
Copy link
Author

caluml commented Dec 14, 2024

I've understood more now what was happening.

I had gone to the car, used the app, and then turned the car off and come into the house with the app still active.

This meant that there were no new OBD updates being received, so it kept sending the last values over and over.

Maybe it makes more sense to clear the valueMap inside the synchronized block just after sending all the data?

@fr3ts0n
Copy link
Owner

fr3ts0n commented Dec 20, 2024

Indeed, the plugin runs as long as the APP does. So the plugin re-published the last seen data readings.

Since data retrieval (AndrOBD) and data publishing (plugin) run asynchronously, it would contradict any data updating rules to clear data after send update. Worst case you get published empty data values sporadically. (which is a hassle to diagnose).

I could imagine to send an empty value list towards any publishing plugin in a "NO data" condition of the vehicle communication.

Would that solve your problem?

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

2 participants