OCPP support for Victron

Hello guys!

A while back I made a few posts in a thread about the (lack of) OCPP support: Is Victron intending to add OCPP 2.x protocol support to the EV chargers? - #35 by langestefan

In summary, I think Victron’s strategy on this topic is wrong. They are choosing to only support their own brand chargers, the EVCS, probably to boost its sales. In other topics you can find information about the many shortcomings of Victron’s EVCS chargers, I will not repeat them here. But their choice to only support EVCS, in combination with the lack of many features found in other brand chargers, has left many people frustrated. On the other hand, the platform is open enough to add support ourselves, gotta give victron props for that as well!

In an attempt to promote interoperability and enable universal charger support, I am happy to report I have made significant progress in adding OCPP driver support to Venus OS, powered by the open source python library GitHub - mobilityhouse/ocpp: Python implementation of the Open Charge Point Protocol (OCPP). · GitHub !

OCPP 1.6J support

Currently the driver only supports the widely adopted OCPP version 1.6. I have yet to run into an EV charger that does not support this protocol, but ofcourse YMMV. Since I only have an Alfen charger, I can only test with that. Support for more chargers is expected, or may already work today, I just have no way to test it right now.

Onboarding

You need some way to point the charging station to the OCPP server, which runs directly on the GX device. In my Alfen charger, I can do this by going to connectivity settings and configuring the CSMS URL.

Note that right now, that means that if you already pointed the CSMS at a charge point operator, or to collect ERE certificates for example, this will stop working. The solution is to use an OCPP proxy, but this is not implemented yet. Using the d-bus protocol the driver publishes the connection as a Victron EV charger and it will show up on your GX device as an EVCS.

Under settings → devices you now get a new device, the OCPP EV charger:

This has all the same EV charger options that victron offers, except there is one extra section named ‘scheduled charging’. The driver adds this as a gui-v2 plugin: one file under /data/apps/enabled/ that contains the page and attaches it to the charger.

Charging modes

These are the default charging modes supported by victron.

Manual is the most simple one, you start/stop the charger from within the GUI. Auto is currently not supported, because it is quite complicated to make this work with DESS and I am afraid they will just end up fighting each other for who gets the solar surplus. It will be added once I figured that out.

Scheduled charging

Right now scheduled charging is the most useful mode, it will retrieve your electricity prices from VRM and compute a schedule based on some parameters.

Unfortunately because we have no communication with the car itself, we can only set a charging target and a departure time. The driver will then calculate how much energy to add during the cheapest hours. Since there is no integration with DESS, it is very likely that during week days this energy will be charged from the battery instead of the grid. I am still experimenting with this. I understand that EVCS integration with DESS is currently in closed beta testing, so this should improve in the future.

Future

I currently consider this to be a ‘proof of concept’ rather than a functional, production ready driver. I will continue testing, improving and squashing bugs in the coming weeks to make it stable.

Once I feel the driver is ready for broader testing, I will invite a few people with a Victron system and an OCPP charger to further validate the driver. If you are interested in this, please drop a message below!

Once released the driver will be free for everyone, open source and MIT licensed. Once released you will find it on my github account at langestefan (Stefan de Lange) · GitHub.

Please also let me know if you have any questions or feature requests.

Cool Stefan! I really like the feature about the scheduled charging. I see the potential interference with DESS, what if you want ould push the charging schedule via the api to vrm? The there dess will adjust accordingly the schedule for the stationary battery.

Yes there should be more possibilities now to indicate EV charging load forecasts to DESS: VRM release notes: DESS Adjustable consumption, Split consumption categories, Multisite AI. Also I believe that as you use the charger more, DESS will also learn the EV charging pattern and adjust to it. Same as it does with solar and base load.

In the ideal case DESS plans the battery and the EV charger together. I believe this is the part that is still in closed beta, I cannot find any references to it in the API but I have seen footage for it on https://www.youtube.com/watch?v=BC-HjnvKj-k

However, this is planning. There is another problem with the auto mode. How do you decide who gets the solar energy surplus, the battery or the EV? DESS isn’t aware of the EV charger existing, planning for it doesn’t help in real time control. This needs a more hollistic approach where DESS is aware of the EV charger.

So apparently the fields are:

Field Meaning Written by
vrm_consum_evcs_fc VRM’s own forecast of EV charger consumption, learned from history VRM
vrm_consum_evcs_fc_adj Your adjustment of that forecast through the API
vrm_dess_to_evcs_fc Not documented. By its name: energy that DESS plans to send to the EV charger VRM

The EV charging plan is now automatically added to DESS as well! No guesswork or machine learning needed, because this is the plan that the driver has calculated and will execute.

Really cool! This is indeed what I tried to say, sending the charging schedule automatically towards VRM forcast.

Unfortunately I do have Zappi V2 (without WiFi, but with the hub), so there isn’t an OCPP function for it. Nice work though!

Have had it running for about a week now. It works very well! Will hopefully be able to test some more charging stations soon.

Well done, Stefan. I’m very curious how you send the schedule to VRM. Do you also do this via dbus? If so, what structure do you use for this?

Forecasts are handled by VRM. So I use the VRM API for that. Basically I write:

body = {
        EV_KEY: [
                {"timestamp": hour, "value": wh} for hour, wh in sorted(changes.items())
            ],
        TOTAL_KEY: [
                {"timestamp": hour, "value": wh} for hour, wh in sorted(totals.items())
            ]
}

# The adjustable EV charger part of the forecast in the VRM API
EV_KEY = "vrm_consum_evcs_fc_adj"
# The adjustable total, which includes the EV charger
TOTAL_KEY = "vrm_consumption_fc_adj"

If you adjust vrm_consum_evcs_fc_adj you need to also adjust the total vrm_consumption_fc_adj by the same amount.