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

Retained topics sometimes removed, found solution #363

Open
H4nsie opened this issue Oct 14, 2024 · 0 comments
Open

Retained topics sometimes removed, found solution #363

H4nsie opened this issue Oct 14, 2024 · 0 comments

Comments

@H4nsie
Copy link

H4nsie commented Oct 14, 2024

I noticed when sometimes data is missing in de VW app (don't know why, but see screenshot attached; available km range and available % fuel is not displayed in the app when this happens), it is also directly missing in the raw jason, and then WeConnect-mqtt removes the topic from the broker. (My home-automation sets the values then to zero, causing problems in my sensors/scripts, I'd rather prefer retaining the old topics and values, and wait a few hours for data available again at the VW's server.)

A retained topic is removed from a broker by publishing the topic with the retain-flag and a null ('') payload. WeConnect-mqtt does this on line 544, by sending this command to the broker. I've commented out this command:

544c544
<             self.publish(topic=f'{self.prefix}{element.getGlobalAddress()}', qos=1, retain=True, payload='')
---
>             #self.publish(topic=f'{self.prefix}{element.getGlobalAddress()}', qos=1, retain=True, payload='')

Now topics are always retained. Perhaps you could make this configurable with a parameter? (--alwaysretain)?

I've tested a few days and the number of topics stay the same on my broker. Now I can confirm it working for the VW California 6.1 camper, with mosquitto version 2.0.11, Domoticz 2024.7 using domoticz-mqttmapper-plugin

IMG_4600

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