henne49/dbus-opendtu

Device inverter instead of pvinverter possible?

TheGrumpyBadger opened this issue · 73 comments

My HM-350 is connected to a LFP battery, which is charged by a Victron MPPT.
Is it possible to show the HM-350 as an inverter, as it is using DC power instead of PV ?

as long as you have a DTU like ahoy or opendtu, that we can read data from, it can be displayed in venus OS

ude6 commented

Hi,
I agree. I am currently using your code to display the inverter (connected to the battery) as
a PV-Inverter. It runs very well. BUT it assumes the energy comes from PV where in reality it comes from the battery.

So when the inverter runs I see for example:

Battery (via dbus-serialbattery) -600w
PV-Inverter ( via your dbus-opendtu) +600w
DC-Power (calculated by victron) +600w

The problem is that the cerbo is not netting the DC-Power (which is the input to the inverter)
with the PV-Inverter.

So the question is: Can the Opendtu (or Ahoy) be used as an inverter that is powered by DC load?
image

Thanks

Andreas

We create a PV inverter in DBUS https://github.com/victronenergy/venus/wiki/dbus#pv-inverters

I guess you would need another service to make that correct

ude6 commented

Yes, I would assume that something like this would be through the com.victronenergy.vebus.
It would need to look like a Multiplus to the Cerbo (I guess)....

Maybe also com.victronenergy.multi would work..

I planned something for shelly #32, but it was not working. This requires some rework, give it a try and you can submit a PR to include into the code. But wait until we Merged #43

ude6 commented

Sounds great!

we did a merge, your link is a different use case. Maybe that project is a better bit for your use case

ude6 commented

I will try to ask the autor there for a possible update to disble the steering of the HM input.

Head commented

Was just reading the code and then found this issue.
This project simulates the opendtu as a pvinverter: https://github.com/victronenergy/venus/wiki/dbus#pv-inverters
We would need an inverter: https://github.com/victronenergy/venus/wiki/dbus#inverter

It shouldn't be that hard to take this code and change com.victronenergy.pvinverter to com.victronenergy.inverter and also change the paths in the update funtion https://github.com/henne49/dbus-opendtu/blob/main/dbus-opendtu.py#L423 to match the ones required by the inverter interface. But maybe that should ne another project/fork of this one... Or maybe a config flag?

I think it needs to be a config flag, which allows for different mode. If you are interested, please create a fork and test, we can help with the code and Pull Request. We would include this into code for sure, just have no time yet to do it myself.

Maybe, the change #53 (based on feature request #52) will also help in this case. I will be able to configure servicename com.victronenergy.inverter.

Closing this because of #53. Please reopen or create a new issue if necessary.

Reopening, as we need to also implement it for ahoy and opendtu and not just template

Hi,

I have added the customization of servicename for dtu now as well.
grafik

As I do not have any of these devices, what would you want to see and how to display?
https://github.com/victronenergy/venus/wiki/dbus#dcsystem

#62

### Only needed for OpenDTU and ahoy
# AcPosition 0=AC input 1; 1=AC output; 2=AC output 2
# 1st inverter
[INVERTER0]
Phase=L1
DeviceInstance=34
AcPosition=0
Servicename=com.victronenergy.inverter

# 2nd inverter
[INVERTER1]
Phase=L1
DeviceInstance=35
AcPosition=0
Servicename=com.victronenergy.pvinverter

Inverter0 shows at not connected, Interverter1 works fine.

Screenshot 2023-03-28 181654

I think for inverter there are other variables:
https://github.com/victronenergy/venus/wiki/dbus#inverter

Screenshot 2023-03-28 182636

correct, but I would need to know, which one to present to dbus.

I think we will need:

/Dc/0/Voltage <- Battery voltage
/Ac/Out/L1/V <- AC Output voltage
/Ac/Out/L1/I <- AC Output current
/Ac/Out/L1/P <- Not used on vedirect inverters
/State <- 0=Off; 1=Low Power; 2=Fault; 9=Inverting

with Servicename=com.victronenergy.inverter

Dear all, was this feature request from @TheGrumpyBadger already built in ? I tried to use the Servicename=com.victronenergy.inverter for Inverter0, but without luck. Seems it is not yet implemented...

Yes, setting the servicename was implemented in #53. But it seems there are devices (servicenames) where it is not sufficient to only set the servicename and some more attributes need to be set. This is why THIS ticket ist still open.

Hey @Tom051276 would you mind to post the debug log?

Logging=DEBUG

Right now it looks correct for me.

if dtuvariant != constants.DTUVARIANT_TEMPLATE:
            logging.info("Registering dtu devices")
            servicename=get_config_value(config, "Servicename", "INVERTER", 0, "com.victronenergy.pvinverter")
            service = DbusService(
                servicename=servicename,
                paths=paths,
                actual_inverter=0,
            )

Maybe there's something wrong with the getter. I'm not able to debug that right now.

As far as I see the paths are only implemented for pv inverter:
paths = { "/Ac/Energy/Forward": { "initial": None, "textformat": _kwh, }, # energy produced by pv inverter "/Ac/Power": {"initial": None, "textformat": _w}, "/Ac/L1/Voltage": {"initial": None, "textformat": _v}, "/Ac/L2/Voltage": {"initial": None, "textformat": _v}, "/Ac/L3/Voltage": {"initial": None, "textformat": _v}, "/Ac/L1/Current": {"initial": None, "textformat": _a}, "/Ac/L2/Current": {"initial": None, "textformat": _a}, "/Ac/L3/Current": {"initial": None, "textformat": _a}, "/Ac/L1/Power": {"initial": None, "textformat": _w}, "/Ac/L2/Power": {"initial": None, "textformat": _w}, "/Ac/L3/Power": {"initial": None, "textformat": _w}, "/Ac/L1/Energy/Forward": {"initial": None, "textformat": _kwh}, "/Ac/L2/Energy/Forward": {"initial": None, "textformat": _kwh}, "/Ac/L3/Energy/Forward": {"initial": None, "textformat": _kwh}, }

The paths for a "non-pv"-inverter I posted above.

Got you. I created a new branch feature-non-pv-inverter. I'm not able to test it yet but maybe it's a start

I will give feedback this afternoon.

@0x7878 Would you like to contact me via Discord?

Yes, I got values:
image

But no visual:
image

2023-04-27 14:04:38,184 root DEBUG calling http://192.168.178.200/api/livedata/status with timeout=2.5
2023-04-27 14:04:38,191 urllib3.connectionpool DEBUG Starting new HTTP connection (1): 192.168.178.200:80
2023-04-27 14:04:38,261 urllib3.connectionpool DEBUG http://192.168.178.200:80 "GET /api/livedata/status HTTP/1.1" 200 1401
2023-04-27 14:04:38,265 root DEBUG function fetch_url finished in 81 ms
2023-04-27 14:04:40,972 root DEBUG _get_value_handler called for /
2023-04-27 14:04:40,973 root DEBUG {'Mgmt/ProcessName': dbus.String('/data/dbus-opendtu/dbus_service.py', variant_level=1), 'Mgmt/ProcessVersion': dbus.String('Unkown version, and running on Python 3.8.13', variant_level=1), 'Mgmt/Connection': dbus.String('OpenDTU HTTP JSON service', variant_level=1), 'DeviceInstance': dbus.Int32(34, variant_level=1), 'ProductId': dbus.Int32(65535, variant_level=1), 'ProductName': dbus.String('OpenDTU', variant_level=1), 'CustomName': dbus.String('HM350-Akku', variant_level=1), 'Connected': dbus.Int32(1, variant_level=1), 'Latency': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'FirmwareVersion': dbus.Double(0.1, variant_level=1), 'HardwareVersion': dbus.Int32(0, variant_level=1), 'Position': dbus.Int32(1, variant_level=1), 'Serial': dbus.String('112183215725', variant_level=1), 'UpdateIndex': dbus.Int32(0, variant_level=1), 'StatusCode': dbus.Int32(0, variant_level=1), 'Ac/Energy/Forward': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/Power': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L1/Voltage': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L2/Voltage': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L3/Voltage': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L1/Current': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L2/Current': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L3/Current': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L1/Power': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L2/Power': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L3/Power': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L1/Energy/Forward': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L2/Energy/Forward': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/L3/Energy/Forward': dbus.Array([], signature=dbus.Signature('i'), variant_level=1), 'Ac/Out/L1/I': dbus.Double(1.059999943, variant_level=1), 'Ac/Out/L1/V': dbus.Double(234.1000061, variant_level=1), 'Dc/0/Voltage': dbus.Int32(49, variant_level=1)}

Perhaps the /state has to be 0 when /Ac/Out/L1/I is 0 and 9 when /Ac/Out/L1/I is > 0.
And /Mode to 2 when working.

@dsteinkopf I have no idea how to contact you on Discord. Just add me there Maurice#2144

@TheGrumpyBadger I'll change/check this later. As I said I couldn't test it ;-)

        "/Mode": {"initial": 2, "textformat": None},
        "/State": {"initial": 9, "textformat": None}

did it.

Line 87/88 in dbus-opendtu.py

image

image

Great job! 👍

@0x7878 will you update the branch and create the PR? Well done guys

@0x7878 @TheGrumpyBadger Awesome !!! I will give it a new try this weekend. Sounds great, Thank you for your work.

ude6 commented

Hi,
great progress and I am excited to use this.
When I tried the branch on a spare Rspi I found that for me the changes requested by @TheGrumpyBadger looked like they were not in the code?
For ref:
" "/Mode": {"initial": 2, "textformat": None},
"/State": {"initial": 9, "textformat": None}
did it.

Line 87/88 in dbus-opendtu.py"

Also the inverter is inverter no2 in my list and it did not get any values. (But that may be due to my hasty / maybe faulty setup of the raspi..

Thanks!

ude6

Hey ude6,

this two lines has to be added to the code, has to look like this:

        "/Ac/Out/L1/I": {"initial": None, "textformat": _a},
        "/Ac/Out/L1/V": {"initial": None, "textformat": _v},
        "/Ac/Out/L1/P": {"initial": None, "textformat": _w},
        "/Dc/0/Voltage": {"initial": None, "textformat": _v},
        "/Mode": {"initial": 2, "textformat": None},
        "/State": {"initial": 9, "textformat": None}
    }

@henne49 : I created a pull request for this to lines.

This is not necessary as I am still working on it. Dbus_opendtu.py isn't really the best place to put the code either. In this section are some functions with some callbacks on text format.

The last commit broke some things that I already fixed but didn't push. I hope I'll be done with that tomorrow. I will also check why you might not be getting the values.

@TheGrumpyBadger Is the total consumption calculated correct? I am wondering that now only the net in is summed up, but not the ac-out delivered from the hoymiles…
Before these change the hoymiles deliver was summed up in PV Power in, which was also not correct… Not sure how to solve this… I do not have the DC module like you have…

This look good on my side:
image

in VRM it look not fine, but its ok for me:
image

@TheGrumpyBadger Ah okay, then you have the same problem on vrm site like I have. Any ideas how to solve this miscalculation on vrm?
Would be great if vrm site can also be fixed...

As far as I see there are no Victron inverters that can synchronize with die grid.
So the usecase we have is not supported in VRM. It is not possible to add grid and inverter power in the charts.

I found some miscalculations in VRM with AcPosition=1.
Doing some more testing, but AcPosition=0 seems to be better for the inverter.

Good to know. If so, such information belongs to the readme. I also figured out that (at least in my installation) it takes up to 10 minutes before the VRM-Portal starts showing the live values of an e.g. (PV-)inverter.

The 10 minutes can be configured in vrm or Venus, as the graphs you see are historical, that is why you have a delay.

I would at least use a delay of 10 minutes, as too short delays, you can have historical errors in case of unreachable or reboot of opendtu when opendtu shows 0

@henne49 ah yes, that's probably the rease for the delay. I am "happily" using 1 Minute.

I found some miscalculations in VRM with AcPosition=1. Doing some more testing, but AcPosition=0 seems to be better for the inverter.

It's in the config.ini: # 0=AC input 1; 1=AC output; 2=AC output 2. Yes, it should also be in the readme. But it's no "soft decision", it's a fact that must be configured correctly (where is the inverter connected), isn't it?

looks good so far:
image

image

@TheGrumpyBadger : Where do we have to look in your images? I was expecting an "inverter" instead of pvinverter.

In general: If a device becomes an inverter, the device in the middle (with the Victron logo) represents that device. This is why there is a label "Inverting, Off, etc.".

Furthermore, it works like that: The inverter takes Energy from the Battery and pushes it to AC-Loads. which then shows up in "consumption".

Feel free to correct me if something that I said isn't right.

You are right. On the screenshot are two HM-350 on a single openDTU-onbattery.
The first one ist an L1 and the inverter, it is feeded by an 24V LFP battery,
second one is on L3 and is a normal pvinverter on L3.
Both are now on AcPosition=0 and the numbers seems to be right.

The (now correct) numbers are showing that I got 0.2 kWh from the grid and feeded 0.
From solar I got 0.9 kWh so far. Alltogether I used 0.5 kWh, 0.6 kWh were loaded to the battery.

It's in the config.ini: # 0=AC input 1; 1=AC output; 2=AC output 2. Yes, it should also be in the readme. But it's no "soft decision", it's a fact that must be configured correctly (where is the inverter connected), isn't it?

for the inverter config it's indeed a soft decision. An inverter has no "AC input", so I thought "AC output" must be right, but perhaps not. That's why I'm in testing.
The positions are normaly from the view of a MultiPlus/Quadro which here is not exisiting.

My mistake in thinking was to assume you had a Multiplus (then, it is clear where your inverter is connected).

If you have none, I understand that you have to experiment. And your result "AcPosition=0" (->"AC input 1") seems plausible, as "AC input 1" is the one that is connected to the grid. And your inverter is also connected to the grid, if I understood correctly.

Hello,

first thanks for this Project!
I have installed it too and my HM-300 is connected to with a Lifepo Battery and with the AC-IN from a Multiplus.
So far ir works good but the Remote Console from the Cerbo shows me the HM-300 as a PV Inverter on the AC-Out.
Is it possible that it shows the HM-300 correct on the AC-IN?

I have these Settings in the config.ini:

### Only needed for OpenDTU and ahoy
# AcPosition 0=AC input 1; 1=AC output; 2=AC output 2
# 1st inverter
[INVERTER0]
Phase=L1
DeviceInstance=34
AcPosition=0
#Servicename=com.victronenergy.inverter (i have change it to .inverter, standart was it a .charger)

Here a Screenshoot from this:
cerbo

Thank you!

Hey 👋
Please remove the hash sign "#" otherwise it will work as default (in this case PV inverter). After that check the values on your cerbo or via the terminal. See the readme for useful commands

Thank you... you mean it so or:

config

Unfortunately in the Cerbo is the HM-300 Status then unknown:
Cerbo

That's right. I'll try your setup with a test device the next days. It could be that an Inverter does not have ac in which lead to your problem. Could you try ac out?

Not so easy... but i have activate the AC-IN from the Multiplus, unfortunately still the same.

Ok I see. First of all this setup was implemented without a Multiplus in place. But still... I'm wondering why there are no values at all in your setup. I'll try to figure it out but because of "Vatertag" it has to wait ;-)

Thank you... it would be nice if it works with a Multiplus too :). But first i wish you a great "Vatertag" ;).

Hello,
Thanks for the good integration into the Victron world ( Cerbo GX ).
I have a Shelly 3EM working on the grid, which I have successfully connected via https://github.com/fabian-lauer/dbus-shelly-3em-smartmeter.
I have a Victron 150/35 MPPT pv-charger for my battery 48V.
From the battery, I feed a Hoymiles HM-800 into the L3 grid.
A second Hoymiles HM-600 (PV inverter) feeds PV directly to L3 in the grid ( 1st inverter ).
This has all been integrated correctly,
except that the HM-800 (inverter) feeds into L1 according to the display.

I have set it to L3 in config.ini ( 2nd inverter ).
Bildschirmfoto 2023-05-21 um 12 14 46

How can I change it to L3?

Bildschirmfoto 2023-05-21 um 12 16 44 Bildschirmfoto 2023-05-21 um 12 12 55 Bildschirmfoto 2023-05-21 um 12 12 15 Bildschirmfoto 2023-05-21 um 12 12 33

Thanks

Victron doesn't support it.
Screenshot_20230521-130644
They have no other endpoint than L1 and I didn't test a different one because it would then be an undocumented endpoint.

OK, then I have to live with it.
Thanks

We are currently (atm) doing several experiments, but yes, it seems Victron does not support it... At least not this way, maybe there is another one...

Please keep in mind Victron never intended to use an inverter on a system conncted with the grid.
Perhaps it better to mimic a Multiplus.

Yes, will certainly be better,
to imitate Multiplus.

What do you mean by mimic/imitate a Multiplus?

Ok I see. First of all this setup was implemented without a Multiplus in place. But still... I'm wondering why there are no values at all in your setup. I'll try to figure it out but because of "Vatertag" it has to wait ;-)

Hello,

gives it already a Solution or is it not possible :)

0x7878 commented

We're still experimenting but it seems that it does not work as a an Inverter. I'll rebuild the code base to support more device's. I cannot tell when I start because I'm also busy right now. :-(

I have expanded my PV system and included a Cerbo-SGX. So fare everything is working fine . There is just one thing that is not shown correctly! The “total solar (2379 W)" value” always adds the power that the Hoymiles HM 1500 feeds in (367 W) to the PV power that comes from the MPPT trackers (2011 W). The inverter load should not be addd as it is unloading the battery. I tried all possible combinations of (AC-position from 0-2 and Servicename = pvinverter, charger and inverter). The attached config is currently running on my cerbo and is displaying at least the "AC-Loads" correctly.
My PV-System consists of 2 Victron mppt trackers, a Daly BMS with LifePo4 cells.
Furthermore, a "Hoymiles HM1500 inverter with opdendtu" and a "Shelly Pro 3EM" and as well as mentioned the Cerbo-sgx.

Does anyone have an idea how to solve the problem?
I think it has to do with the "servicename" but I am not sure. As said I tried all 3 to me known servicenames. No one made a difference, nor was solving the issue. The "AC-Position" must set to "0" otherwise the "AC-Load" values are incorrect.
2024-08-02 15_26_20-192 168 1 110 - PuTTY

2024-08-02 15_40_17-CMO-Solar-Keller - VRM Portal

If I got you right, you want to tell victron that your hoymiles is actually an ac-inverter rather than an pv-inverter. If I remember right there is currently no solution for this use case. I'd like to emulate a Multiplus for this situation but I think there is much more that has to be implemented.

Just a note: In your config you did not comment out the service name. So it won't work like this. Feel free to try some other variations but I'm not sure if it works.

Yes, that is exactly what I try to achive. I do not have an victron inverter in my installation. Only the Hoymiles HM1500 which is running as an ac-inverter. I found an emulation for victron multiplus inverters. But this implementaion was also not solving the problem. It is a shame that there is not solution available. Anyhow thanks for your clarification on this issue :-(

Yes I am aware the in the attached file the servicename was comment out. On my cerbo it is not.