OCPP Server Plugin for linking electric car chargers!

OCPP is the Open Charge Point Protocol, and it’s OPEN. It’s the protocol that electric car chargers use to communicate their status and to control charging. Many electric vehicle chargers support this standard, and now any charger in the UK that gets grant money for installation requires OCPP 1.6 compliance. It’s more popular in europe than in the US, but it’s the standard that everybody’s gravitating towards.

Open source charging equipment (The OpenEVSE for example) is making moves to get this standard working for the community (but it’s a heavy lift for a small micro-controller, so it’s still being hashed out)

Either way, this seems like a good fit for Homeassistant. An open source project can be found here:

The protocol is developed by https://www.openchargealliance.org/

and I copy/paste:

The Open Charge Alliance (OCA) is a global consortium of public and private electric vehicle infrastructure leaders that have come together to promote open standards through the adoption of the Open Charge Point Protocol (OCPP) and the Open Smart Charging Protocol (OSCP).<

Of course, I’m a hardware dummy, so I can’t program, which is why I’m suggesting this to the community.

Cheers!

Also the amazing lincomatic has done some work on OCPP libraries. Lincomatic does a lot of electric vehicle-centric code, include OpenEVSE firmware.

Regards,

Not a real solution by itself, but maybe a workaround: Node-Red seems to have OCPP nodes. (Disclaimer: I have not tested this)

This may help you get that data into Home Assistant; I have recently received my Charge Point, so this is the path I will try to follow.

1 Like

I am working on a OCPP implementation in Python that just have been open sourced. Could that be useful? You can find it here: https://github.com/mobilityhouse/ocpp

5 Likes

The biggest problem I see with OCPP is that if you want to write a client, you have to know what server it’s for, because a wss connection requires a certificate and the method of exchanging certificates with an unknown server is completely unclear. At least I haven’t been able to make it work.

I am not sure if I understand you correctly, but my opinion home assistant should be the OCPP server where a OCPP compatible charger can connect to.

You raise a valid point about the certificates. But using certificates is not mandatory with OCPP 1.6.

2 Likes

The point of OCPP is “open” - your client has to be able to play with any server, otherwise you cannot sell anything that isn’t specifically tied to a particular server. I.e. if I use HomeAssistant, do I then tell GreenLots they better get themselves that server if I want them to do public billing for my clients?
Besides, OCA saw the error of their ways and they published a certificate fix in 2018, a year after I wrote my stuff.

1 Like

OCPP integration in home-assistant might not work for your use case. If I understand you correctly you want to connect multiple chargers and bill clients using those chargers. I agree with you, you shouldn’t want to do that with home assistant.

I was more thinking about a private person having his own charger. It would be awesome if you could connect that to home-assistant to see some details about an ongoing transaction.

3 Likes

@OrangeTux I am an OCPP expert at one of the major charging station manufacturers. Also a “home assistant” enthusiast as a hobby.

I would like to utilise your library within my home assistant, however I am not confident how to deploy your library. Do you have any directions?

3 Likes

Hello @KEM_Hass ,

A library is not a ready thing to use with Home Assistant. You need to develop the interface between the library and Home Assistant to use it. A library is just a ready thing for being able to program something without knowing the details how, for instance a protocol like OCPP works.

1 Like

@KEM_Hass Or to put it another way, every home assistant integration relies on an open source python library (that also has to be on pypi). @OrangeTux’s python library is open source and also appears on pypi. Box 1 ticked.

The second part is the home assistant integration itself. There is plenty of info on development, and an answer is usually available from discord or this forum pretty quickly. The ha source code provides good inspiration too.

1 Like

@KEM_Hass Sorry for the very late response. I’m not really using this forum. If you’re still interested in integrating OCPP in HA I would love to help you out.

I think it’s best to reach out to me using the issues page of the OCPP project in Github. Than i’ll definitely receive a notification.

1 Like

I’m currently working on an integration. But I’m not sure what people expect from the integration? Anyone that can share his or her expectation; what should the integration do?

2 Likes

I started with OCPP integration. The code can be found here.

  sensor:
    - platform: ocpp
      monitored_variables:
      - "Current.Import"
      port: 9000
      scan_interval:
        seconds: 10

Using the key ‘monitored_variables’ you can select the measurands you want to monitor. A a list of all measurands can be found here.

port is used to configure the port where the central system (the OCPP server) is accepting connections.
scan_interval is used by HA core as refresh rate of the sensor on the UI.

Note that this is a very early version. So several things need to be fixed. But let me know what you think! I’m happy to receive feedback.

6 Likes

Glorious work! Well done.

Great work.
Does the integration provide a service (or switch) to start/stop charging? Does it support assigning a charge to a (virtual) charging account?

1 Like

Is the BMW Wallbox Plus supported by this plugin? It’s technically a Keba P30.

@OrangeTux good idea to include your OCPP python lib into home assistant as a server. I have a Mennekes AMTRON Xtra 22 C2 online - it should support OCPP 1.6. So, I am ready to test. But I do not find a way to tell the AMTRON to connect to an OCPP server :unamused:

I am about to get a plug-in hybrid and a charger that has OCPP 1.6. So I am keen for this integration. Specifically, I want to be able to monitor my solar power generation (HA already doing this) and control the charger so that it matches the output. So I want: charger on/off, charger on x watts.
Can an OCPP charger see the charge status of the battery in the car it it charging?

Unfortunately no AC / level 2 / non-fast chargers support reading the cars state of charge. It’s just a part of the J1772 standard. The cars don’t support it either. DC CCS fast charging does. And DC chargers DO support OCPP. But plug in hybrids do NOT support DC charging, plus the cheapest one is about $10,000 USD and needs 100 amps.

1 Like