tillsteinbach / WeConnect-mqtt

MQTT Client that publishes data from Volkswagen WeConnect
MIT License
69 stars 13 forks source link

*_writetopic not working after MQTT reconnect #140

Closed boredomwontgetus closed 1 year ago

boredomwontgetus commented 2 years ago

Hi Till!

To me it looks like after weconnect_mqttlost and reestablished the connection to the MQTT-Server the writeable topics are not working any more.

This is what the logs show: 2022-07-11T14:14:38+0000:INFO:weconnect_mqtt_base:Client unexpectedly disconnected (7), trying to reconnect 2022-07-11T14:14:49+0000:INFO:weconnect_mqtt_base:Connected to MQTT broker 2022-07-11T14:14:49+0000:INFO:weconnect_mqtt_base:Update data from WeConnect

From this moment on, publishing start or stopto weconnect/0/vehicles/WVXXXXXXXX/controls/charging_writetopicdoes not do anything. there is no answer wit a status, operation or body at all ever coming back. Other information (not related to a write) is still coming in fine.

Before it loses connection for the first time everything works just fine.

BR Tom

tillsteinbach commented 2 years ago

I will try to reproduce that.

cr0ste commented 2 years ago

I think I might have the same issue. After a short power outage the readable topics are still working, but I e.g. couldn't start climatisation anymore. After a restart of my containers (yours and FHEM) it's working again.

boredomwontgetus commented 2 years ago

Not meant to apply any pressure, is there any news on this issue tho?

tillsteinbach commented 2 years ago

Hey! It is not forgotten, I'm struggeling to reproduce it on my side currently. Do you have maybe more instructions for me.

boredomwontgetus commented 2 years ago

Hi!

First of all, thank you very much for still looking into this.

So this is a rundown on how i can reproduce this:

  1. Check for working mqtt-subscriptions --> OK
  2. Check for working mqtt-publish --> OK
  3. See if Car reacts to the command published --> OK
  4. Break the Internet connection in some way
  5. Check for working mqtt-subscriptions --> OK
  6. Check for working mqtt-publish --> OK
  7. See if Car reacts to the command published --> NOK (published commands seam to never get to the Volkswagen Servers from point 4 on)

Hope that helps. BR Tom

tillsteinbach commented 2 years ago

Ah, so far I thought it is when the connection to the MQTT broker was broken. But are the commands received from WeConnect-mqtt? Can you see output in the logs?

boredomwontgetus commented 2 years ago

Well, i just tried to reproduce it but couldn't for some reason. ;( I will try again but maybe somebody else can also try to answer this question.

DeBaschdi commented 1 year ago

Hi, I probably have a similar problem. However, this occurs reproducibly after a long time (in my case 24 hours), I have been observing for 3 days that _writetopic instructions are not being processed, after a restart (I use Docker) everything works again.

I myself have an ID4. I start the docker with -vvv , but after issuing a _writetopic statement exactly nothing happens in the container log.

tillsteinbach commented 1 year ago

Does your broker support MQTTv5? I have the suspicion that this might occur with v3 only. Could you check that?

DeBaschdi commented 1 year ago

mosquitto version 2.0.14 , how can i check mqttv5 support ?

tillsteinbach commented 1 year ago

I think 2.0.14 should already have v5 support. You only need to add —mqtt-version 5 when starting WeConnect-mqtt

DeBaschdi commented 1 year ago

Okay, i added --mqtt-version 5 to ADDITINAL_PARAMETERS, will report back tomorrow :)

boredomwontgetus commented 1 year ago

just to let you know....--mqtt-version 5 changed a lot for me. _writetopics are working all of the sudden. Thank you very much.

DeBaschdi commented 1 year ago

For me, same Issue, afer long idle time, all write Topics no more working :/

tillsteinbach commented 1 year ago

And changing to MQTT 5 did not help for you?

boredomwontgetus commented 1 year ago

For me, same Issue, afer long idle time, all write Topics no more working :/

OK, i forgot to add that i did not test this after long runtimes, yet. For me writetopics were not working at all recently even after a fresh start of the container. I will check to see how this behaves after a while. Can you ballpark what timeframe you are talking about when you say "long idle times"?

tillsteinbach commented 1 year ago

I finally understood the problem, I will try to come with a fix soon.

tillsteinbach commented 1 year ago

Can someone please check in the 0.43.0 release if the problem is gone?

DeBaschdi commented 1 year ago

seems to work, i'll keep an eye on it :) THX

tillsteinbach commented 1 year ago

Great, please reopen when the error is not gone.