question

jbakuwel avatar image

Proxy battery - [PROBLEM SOLVED but a few additional questions at the bottom]

Hi all,

I build a proxy battery based on victronenergy/dbus-systemcalc.py/scripts/proxybattery.py that takes the information from two BMV-702's in the system here and combines a couple of values. It averages voltages and SOC and it adds amps as the two BMV-702's are used on two parallel battery banks. As you can see in device-list.png, the new (virtual) battery monitor shows up in the Device list with the expected values. So far so good.

One of the reasons for this exercise was to be able to display the DC loads. As you can see on multi-selected-as-monitor.png, the DC loads are not there when the Multi is selected as the battery monitor, which makes sense: the Multi doesn't know about DC loads. When I select one of the BMV-702's as the battery monitor, I do see the DC loads, as expected, but the battery values shown are only those as measured by that one BMV-702 and thus only represent one of the two parallel battery banks.

When I select the new fancy virtual battery monitor as the Battery Monitor in Venus (see select-battery-combo-as-monitor.png) the main display looses all information.

Any suggestions?

kind regards,
Jan


New proxy battery shows up in the Device List as "battery.combo":


battery.combo values (V averaged, A and W added)


Multi selected as Battery Monitor (no DC loads):


One of the BMV's selected as Battery Monitor (battery power and amps only from one of the two parallel battery banks):


Selecting battery.combo as Battery Monitor:


Main display missing all values:

BMV Battery MonitorVenus OS
4 comments
10 |3000 characters needed characters left characters exceeded

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

This post was interesting as I didn't not know how to get devices to appear in the console device list. Is this a function of the script or was there some other way to get the device to appear in the list?

I am interested as I have some new device (a Humidity sensor) that would be nice to get into the device list.

I'll answer my own question now that I have found the answer and others might find it useful.

It Works Automatically

As long as you use the same base path as used by Victron e.g.

com.victronenergy.temperature
com.victronenergy.tank
com.victronenergy.system
etc. etc.

along with enough of the api mandatory paths populated, then devices will appear automatically in the device list on the console and also on the VRM. I now have three more temperature sensors showing on the VRM ( one from i2c and 2 from spare analogue ports on the 8 channel ADC on the Raspberry Pi.

The down-side of this is that new 'unknown' device types, such as the Humidity sensor in my setup (because it is for a boat and I would like to know how damp it might be getting). Will not appear. I not sure if I can fix that without the Victron team changing something?

hi, yes code change changes (to gui code that is not public) are necessary in order to list com.victronenergy.somethingnew. Thats all I can say at the moment - now is not the time to discuss making more "nice-only" changes: we need to finish v2.60

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ mvader (Victron Energy) ♦♦ ·

(and to continue to discuss that on some day, pls make a new thread rather than continuing on this one)

3 Answers
jbakuwel avatar image
jbakuwel answered ·

Hi all,

Additional note.

I've noticed that the DC load reading is all over the place. It's 1300 hrs here, the sun is trying to break through the clouds so the PV inverter's power is varying quite a bit. I don't expect to see the DC loads (nominal around 50W) to vary between something negative (?) and >100W though.

Just wondering which part of the VenusOS internals I'm observing :-)

Jan

Share
10 |3000 characters needed characters left characters exceeded

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

Markus avatar image
Markus answered ·

Hi,

nice work!

I moved this post to the modification space.

Hopefully, someone here has an answer for you!

Regards,

Markus

Share
10 |3000 characters needed characters left characters exceeded

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

jbakuwel avatar image
jbakuwel answered ·

Hi all,

I found the problem but still have a few more questions :-)

While writing/debugging the code I noticed that the units (V, A and W) were missing from the values as displayed by Venus:

so I added those units manually before calling service._dbusservice[path] = value and converted the value to a string in the process. Clearly that is not what I should do.

DC loads are now displaying nicely (as well as the correct battery load):

Being a bit of a perfectionist (but also building my understanding of VenusOS), I'm now looking for a way to display the values in the screen above with their respective units, ie. "48.16V" (not "48.16") and "-8.8A" (not "-8.8").

Somehow Venus knows the units for these values when it takes them from the BMV's (or Multi) but (apparently) not when taking those values from my virtual proxy battery.

Any suggestions how I can tell Venus what the units for those values is?

And my final question: I am current running my Python script explicitly/manually. What is the proper way to integrate this script in VenusOS, retain it across upgrades and having it started upon boot?

Jan


units-missing.png (44.6 KiB)
dc-displaying.png (40.3 KiB)
6 comments Share
10 |3000 characters needed characters left characters exceeded

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

Hi Jan, nice work! You must be having fun and some free time :-).


The answer to the units is the difference between the GetText and GetValue method calls, as well as values. See dbus api docs & our python code as well.

jbakuwel avatar image jbakuwel mvader (Victron Energy) ♦♦ ·

Hi Matthijs,

Got chased inside by the rain ;-)

Besides most of the work was already done.

Thanks for replying. I don't understand your answer though. My proxy battery is a producer of values (and I should not produce texts as I've discovered) so Something Else must be doing the "GetText". That Something Else is doing that correctly when retrieving the BMV's data but (apparently?) not when retrieving my proxy battery's data. How can I convince Something Else to treat my data the same as that produced by the BMV?


kind regards,
Jan

Try dbus -y com.victronenergy.battery.tty-somethjng / GetText

Do that on one of the original services.

Now do the same on your service.


Same with GetValue.

jbakuwel avatar image jbakuwel mvader (Victron Energy) ♦♦ ·

Hi Matthijs,

Thanks for the reply. I had used dbus-spy which shows the same info for both the BMV and my "combo" battery. I guess dbus-spy uses GetValue. Thanks for the pointers :-)

Jan

understood. You'll need to read the dbus-spy manual: see the T or t.


;-)

floyd avatar image floyd mvader (Victron Energy) ♦♦ ·

Hi,

How would one set the text value in Python?

i.e.

self._dbusservice['/Dc/0/Voltage'] = Voltage

Shows the value in CCGX without the 'V'

self._dbusservice['/Dc/0/Voltage'] = "{}V".format(Voltage)

Shows the 'V' in CCGX but stops VRM Logger and reboots (crashes) the CCGX at random times.