question

Tim from Eat Sleep Van avatar image
Tim from Eat Sleep Van asked

Setting Tank Monitor Values Manually via API

I have a Color Controller in my motorhome and want to show the state of my tanks on the display. This has been a lot more difficult to figure out that I thought it should be.

Now as you can imagine, I don't want to spend $800 on the resistive tank level adapter, and even then I couldn't figure out what devices to buy to make it work. (It would be cheaper to by a Venus! Why are the adapters so expensive?!)

However I do have a raspberry Pi and could easily program it to tell the CC what the current levels are via an API or Modbus. I couldn't see how to change the values, or even make the tank levels show on the screen. It looks like on Modbus the values are read only.

My feature request is:

- Make it easy to set the values of the tank levels via an API (preferably), SSH command line or Modbus.

Or let me know if this is already possible, but I simply missed it.

I'd also like to see clear instructions on what products to buy for to make it work. Which senders work, what type of senders, which adapters needed for the CC etc. I asked the Victron dealers here in NZ but they didn't know anything about it. There also seems to be a disconnect between the language used by Victron (i.e. resistive, voltage or current type senders) and the products sold in NZ. None of which use any of those terms. e.g. https://www.marine-deals.co.nz/ultrasonic-tank-sender or http://www.rvsupplies.co.nz/products/view/electronic-tank-probe-290300

Any help welcome!

feature request
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stepir avatar image stepir commented ·

Hey Tim


did you find a solution? I'm exactly in the same situation: RV, CCGX and a raspberry onboard. Wish I'd able to monitor the tank level of my generator but the cost of the adapter is just overkill.


I live in Italy so Rob is not an option for me unfortunately.


THANKS

0 Likes 0 ·
Tim from Eat Sleep Van avatar image Tim from Eat Sleep Van stepir commented ·

Hi, no sorry, no solution yet. I'll definitely post here if I figure it out.

0 Likes 0 ·
2 Answers
ben avatar image
ben answered ·

It's pretty easy to inject your own tank values via MQTT, ModbusTCP, or dbus.

That's what I am doing today, because there is a limitation in the Victron NMEA2000 implementation that doesn't allow it to properly handle a sender that transmits multiple tanks.

Instead, I intercept the N2K tank values myself and turn around and post them right back to the Venus/CCGX. They show up fine after that.

11 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Tim from Eat Sleep Van avatar image Tim from Eat Sleep Van commented ·

Which dbus paths are you setting to make this work? I've managed to get the basics working with MQTT, including reading current battery voltage and SOC, and turning the inverter on/off. Thanks!

0 Likes 0 ·
ben avatar image ben ♦ Tim from Eat Sleep Van commented ·

Hey Tim,

I finally got back to my setup and grabbed a dump from dbus-spy. My service clones a tank level sensor that was input from Victron's N2K level sensor adapter.

https://pastebin.com/V3PXhVyJ

I don't think all of those fields are strictly necessary, but it was faster to just copy everything.

I took Victron's sample python dbus driver and modified it to publish all the level sensor fields.

You can see this tank sensor, along with any others, on the tile view screen on the stock Venus UI.

1 Like 1 ·
Tim from Eat Sleep Van avatar image Tim from Eat Sleep Van ben ♦ commented ·

Awesome, I'll give it a whirl when I have a chance and report back. Thanks for taking the time.

0 Likes 0 ·
Rob Duthie avatar image Rob Duthie Tim from Eat Sleep Van commented ·

Hi Tim/ Ben

I have tried that another way and i have all the tiles loaded showing the tanks and fuel levels on the front pages etc.

1 Like 1 ·
ben avatar image ben ♦ Tim from Eat Sleep Van commented ·

The important numbers on there are FluidType, which iirc is 5 for black tank and 1 for fresh water, and Level, which is a float from 0 to 100 (I had just emptied my tank when I took that screen dump). I don't think most of the rest of them really matter from a display perspective.

If you have a second tank, just bump the last digit of that dbus address ("com.victron...") by one.

Let me know how it goes.

1 Like 1 ·
ben avatar image ben ♦ Tim from Eat Sleep Van commented ·
I’ll grab a sample tank for you when I get back home next week. I’m away from the system right now, and the Venus is firewalled.


I had it easy, because I already had a real tank being posted by my n2k adapter. I just copied it field for field.

0 Likes 0 ·
Tim from Eat Sleep Van avatar image Tim from Eat Sleep Van ben ♦ commented ·

Thanks! After a bit more research I suspect what I want to do is not possible, as the Venus has the tank details built in. But because the color controller doesn't have tank inputs, it doesn't the built in software dbus-adc which makes the analog DBUS tank paths available.

0 Likes 0 ·
ben avatar image ben ♦ Tim from Eat Sleep Van commented ·

I’m 90% sure you don’t need dubs-adc. You just write your own dbus “driver” that posts your values to the bus.


I think it will work just fine.

1 Like 1 ·
stepir avatar image stepir ben ♦ commented ·

root@ccgx:~# dbus -y com.victronenergy.tank.socketcan_can1_di0_uc01 /FluidType SetValue 5

Traceback (most recent call last):

File "/usr/bin/dbus", line 364, in <module>

ret = obj.object.get_dbus_method(method.name, iface.name)(*args)

File "/usr/bin/dbus", line 160, in object

self._object = self.bus.get_object(self.service, self.path)

File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object

follow_name_owner_changes=follow_name_owner_changes)

File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 248, in __init__

self._named_service = conn.activate_name_owner(bus_name)

File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner

self.start_service_by_name(bus_name)

File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name

'su', (bus_name, flags)))

File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking

message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.victronenergy.tank.socketcan_can1_di0_uc01 was not provided by any .service files


0 Likes 0 ·
stepir avatar image stepir stepir commented ·
root@ccgx:~# dbus --system-bus com.victronenergy.tank /FluidType SetValue 1
Traceback (most recent call last):
  File "/usr/bin/dbus", line 364, in <module>
    ret = obj.object.get_dbus_method(method.name, iface.name)(*args)
  File "/usr/bin/dbus", line 160, in object
    self._object = self.bus.get_object(self.service, self.path)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python2.7/site-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name com.victronenergy.tank was not provided by any .service files

0 Likes 0 ·
stepir avatar image stepir stepir commented ·

@mvader (Victron Energy) can we just ask if this is possible? thanks

0 Likes 0 ·
Rob Duthie avatar image
Rob Duthie answered ·

Hi Tim

Rob here from Rotorua NZ of course I have a Raspi 3B + working with all the tank sensors temp sensors all work OK and showing up on the touch screen etc.

If you want local contact details here for a catch up etc. might be able to help each other out.

As i have one last hurdle to get over and that is to get the Digital I/O GPIO going for the Raspi units then it would be complete unit with the function of the CCGX and the Venus GX.

RD Electronics & Electrical & R&G Energy Systems ltd

Electronic Design & Service

Email: raduthie@xtra.co.nz

Ph: 07 3456043

Mobile: 0272898824

Address: 11 Selwyn Rd

Rotorua,3010

NZ


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Related Resources

The feature requests topic tag can help Victron R&D find feature suggestions for products. 

There are many factors that go into the Victron product roadmap, and feedback from end-users can help.