freakent / dbus-mqtt-devices

A driver for Victron VenusOS GX devices to support use of dbus-mqtt/flashmq-mqtt
MIT License
111 stars 24 forks source link

GPS Driver #14

Closed trinler007 closed 2 years ago

trinler007 commented 2 years ago

Hi,

on my camper I've a router with an external GPS antenna. This device could easily send the position data to my Cerbo GX via MQTT.

I’m already using dbus-mqtt-devices for tank and temperature devices. Would it be possible to add a GPS driver?

Thanks!

Markus

freakent commented 2 years ago

Hi Markus,

Great to hear you have Temperature and Tank devices working? What device do you use as a client?

I also have a GPS enabled router, a Teltonika RUTX-11. I have looked into this but so far it seems Victron do not expose GPS interface through DBUS-MQTT. It seems the simplest solution for GPS is actually to use SOCAT. https://community.victronenergy.com/questions/17470/venus-gx-to-pull-gps-coordinates-from-onboard-rout.html

trinler007 commented 2 years ago

Hi Martin,

I use various Homematic and Zigbee sensors for the temperature, and get the filling level of the tank via ModbusTCP from a barometric sensor. I process this information with node-red and send it to dbus-mqtt-devices.

For GPS (and LTE) I'm using a Mikrotik LtAP (https://mikrotik.com/product/ltap_lte6_kit). These devices are able to use MQTT in scripts.

Since I'm already processing the position whit a script and sending it to a tracking server, it would have been very simple to send the position to the Victron device with adding just a few lines of additional code.

If I connect a USB GPS device, I see the determined data in the MQTT. Does this help in any way?

freakent commented 2 years ago

So, after your first message, you got me thinking..... So I added GPS settings to services.yml on my test system, ran a simulation and it appears to be working. I can see the GPS device on my Venus console I am just waiting to see if the GPS coordinates are being sent to VRM.

image
freakent commented 2 years ago

VRM just updated, and guess what, it works!

image

Even I'm surprised!

trinler007 commented 2 years ago

Awesome! That was extremely fast! Thanks!

freakent commented 2 years ago

If I share my updated services.yml file with you, would you be able to replace your existing services.yml with this patched version?

gharshaw commented 2 years ago

Martin, Not to hijack this GPS thread but I'd be curious to know if Markus is having the same mqtt stability problem on the Cerbo GX

Gene

trinler007 commented 2 years ago

If I share my updates services.yml file with you, would you be able to replace your existing services.yml with this patched version?

Yes, of course. I'm very happy to test that.

trinler007 commented 2 years ago

Hi Gene, so far I haven't found any issues with MQTT on my Cerbo.

freakent commented 2 years ago

Find a zip file attached. I also included my simulator script so you can see which mqtt topics to use. gps-dbus-mqtt-devices.zip

freakent commented 2 years ago

After device registration, to see the GPS device in the Venus GX Console, from the main menu choose settings > GPS. You have to scroll down to find both options.

trinler007 commented 2 years ago

It works like a charm!

image

freakent commented 2 years ago

OK, I'll plan to make another release with the GPS support added. In the mean time if you encounter any problems with it please raise another issue so I can decide whether it is safe for making generally available.