corvy / ha-addons

Apache License 2.0
6 stars 2 forks source link

Missing / losing track attribute #34

Closed henripalmroth closed 2 months ago

henripalmroth commented 3 months ago

Looks like integration is not providing track (course) attribute if GPS is stationary and then starts moving after addon is started. Restart enables the attribute once more. However it can disappear for some reason and won't recover without restart.

corvy commented 3 months ago

Ok, understand. Let me have a look at that.

corvy commented 3 months ago

I have added more debugging to a new beta version in the beta repository. That should print all the JSON to be published to MQTT and we need to see if the attribute is actually there before the publish or not. I will go for a drive with the boat today and will have a look if I can see if it is actually there but just not picked up.

corvy commented 3 months ago

I have tested manually posting attributes to the MQTT topic with MQTT explorer, and that works fine, so the attribute should be published if is received at least.

corvy commented 3 months ago

I struggle to reproduce this error on the new 2024.8.0 beta version. Every restart of the addon I get both track and magtrack which seems to be the attributes you are looking for. The logging in debug should now publish all the data received from the GPS, both early in the script (connect to the device) and also what is published to MQTT after changes done by the script.

"RAW GPS data" in the log -> This is the data received from the GPS "Processed TPV data" in the log -> This is the data processed by the addon, and what is actually published to MQTT. We should compare these two and check if track and/or magtrack is in the RAW part, but missing the Processed part.

For me now, the track and magtrack are always there, even if my boat is stationary. So please if you could have a look at the beta version with debug enabled to see if you get logs whilst missing the track attribute, and preferrably start to move to force the attribute to "show-up" so to speak.

Thanks!

henripalmroth commented 3 months ago

Thanks. I need to investigate this next time I'm on the boat.

corvy commented 3 months ago

Perfect! 👍 I have discovered that it seems the attribute gets expired if not reported for a while. When GPSD is just started the attributes gets reported, but after a while it stops reporting on those two (for unknown reason - but probably because it gets a better position and stops reporting movement - even if there are small-small changes in position). I have tried to change the script so that the attributes gets reported will a null value to see if that will retain them there. If that does not work I will change it so that it reports the last known value until a new is received. No we will have to wait and see if the track and magtrack will expire again or not. Could be fixed in b3 but more testing is needed.

corvy commented 3 months ago

Did you have time to look into this?

corvy commented 2 months ago

I have been running the revised version for some time and it seems stable. I will release this soon if I do not get other feedback from you. Also that will close this ticket.

henripalmroth commented 2 months ago

Let's just close it. I have been running stable because there is also a lot of other things going on. I don't want to risk my data by switching beta channel. I can still let you know if it makes any difference on stable after you have released it.

corvy commented 2 months ago

Ok great. Lets release. It should not break anything 🤞