Evcc Binding - electric vehicle charging control (BETA)

logo

This binding integrates evcc - electric vehicle charging control, a project that provides a control center for electric vehicle charging.

PLEASE NOTE: This binding is now included in the official openHAB 3.3.0 distribution. Use the officially shipped version instead of this marketplace version!

PLEASE NOTE: This addon requires evcc version >= 0.111.0!

evcc controls your wallbox(es) with multiple charging modes and allows you to charge your ev with your photovoltaik’s excess current.

To provide an intelligent charging control, evcc supports over 30 wallboxes and over 20 energy meters/home energy managment systems from many manufacturers as well as electric vehicles from over 20 car manufacturers.

README (and source code) is available at openhab-addons/README.md at evcc-0.7 · florian-h05/openhab-addons · GitHub.

Changelog

Version 0.7

  • Adjust to breaking API changes in evcc version 0.111.0
  • Add new battery capacity channel

Version 0.5

  • Extend accepted command types
  • onvert QuantityType commands to required units
  • Allow evcc URL to end with a slash

Version 0.4

Version 0.3

  • Update channels for evcc version 0.91
  • Improvements and refactorings from code review

Version 0.2

  • Improve channel descriptions
  • Add German translations

Version 0.1

  • initial release

Resources

!https://github.com/florian-h05/openhab-addons/releases/download/evcc-0.7/org.openhab.binding.evcc-3.4.1.jar

source code: openhab-addons/bundles/org.openhab.binding.evcc at evcc-0.7 · florian-h05/openhab-addons · GitHub

5 Likes

Thanks for your excellent work!
Works like a charm.

1 Like

Nice one, thanks.

Today some stuff like a vehicle’s battery capacity can only be configured in evcc.yaml.
I know EVCC themselves are still working on their ability to be configured via UI rather than .yaml, but when they’re done I’d love to be able to configure EVCC from OH.
Please, could you add channels for vehicles, too ?

Most channels of the general category are readonly today. Hope they will become RW, too.
I noticed the bindings docs claim RW on targetSoC, and I’m wondering if that’s correct. When I tried sending a new value there the value does not change. When I update the item, it gets reset on next evcc update back to what evcc thinks is still the value (as set in evcc.yaml)

I wanted to, but as I have no car to connect to evcc I have no clue how the API response for vehicles is and I have also checked the evcc demo, they have no vehicle configured too.
Due to the lack of a full API documentation I built the binding by inspecting the API response from /api/state.

I have just checked with my installation (evcc Version 0.94 & openHAB 3.3.0.M6) and targetSoC works properly.

does openhab:send really change the value in EVCC ? For me it does not, and on next update from the evcc thing, the SoC item is reset to its previous value.
I run the same SW versions.
I don’t see any command arrive at EVCC in logging when I change the item in OH.

I ran the following commands in the openhab console:

openhab> openhab:send evcc_loadpoint0_targetSoC 85
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_targetSoC 90
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_minSoC 90
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_minSoC 30
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_minSoC 80
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_minSoC 30                                                                    
Command has been sent successfully.
openhab> openhab:send evcc_loadpoint0_targetSoC 80                                                                 
Command has been sent successfully.

And every time ran a command, I was able to see the target SoC and the minimal SoC changing in the evcc Web-UI.

So yes, it really changes the value in evcc.

The issue is not in the binding, it must be somewhere else.

Question:
Are your channels linked properly (does the UI show the channel links)?
And is anything logged in openHAB?

I have ABB Terra AC charger so I wonder whether this binding supports my charger.

This binding integrates evcc, not the chargers directly.

Support for your charger depends on whether evcc supports it.

Please have a look at Wallboxen | evcc - Sonne tanken ☀️🚘 to see whether evcc supports your charger.
I know that the docs are in German, but for example you can use Google Chrome, which can auto-translate any website in real time.

I looked at the link and it seems that evcc supports ABB Terra:

ABB Terra AC 💚

chargers:
  - name: my_charger
    type: template
    template: abb      
    
    # Modbus TCP
    modbus: tcpip
    id: 1
    host: 192.0.2.2 # Hostname
    port: 502 # Port 

My problem is that I don’t know how to configure the modbus tcpip settings on Terra. I have looked at ChargerSync and Terraconfig apps on my Android phone but there are no settings for modbus.

I‘m sorry, but I don’t have the time to help you with the setup of your charger for evcc.
Maybe some Googling helps.

I have now got my vehicle, but checking the vehicles array, it is only a string array that contains the names of the vehicles configured. But no vehicle data.

I have meanwhile gotten the EVCC integration to work via HTTP, part of my energy management system. If you’re interested, there’s a demo at https://storm.house/isntallation#demo .

FWIW, vehicles was just deprecated by EVCC so no need to support it any more.

1 Like

Continuing the discussion from Evcc Binding - electric vehicle charging control:

Good morning everyone,

I use Openhab 3.4.0.M4 Milestone Build on RPi3B.
I installed EVCC Service in the openhabian-config and copied my evcc.yaml config to my openhab Pi (first another Pi was running only for evcc). EVCC works really well, I can monitor and control the charge process in EVCC UI.

Only one thing I am working on is controlling of EVCC in my openhab enviroment. For example I want to change the charging mode or the maxChargingCurrent via openhab. Command is noticed but in the same second item state changes back. I think I only change the item and not the variable in EVCC.

Just trying it with a simple script:

EVCC_Loadpoint0_MaxCurrent.sendCommand(9)

Log:

2022-11-23 07:42:38.563 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'EVCC_Loadpoint0_MaxCurrent' received command 9
2022-11-23 07:42:38.566 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'EVCC_Loadpoint0_MaxCurrent' predicted to become 9
2022-11-23 07:42:38.584 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EVCC_Loadpoint0_MaxCurrent' changed from 16 A to 9
2022-11-23 07:42:38.638 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EVCC_Loadpoint0_MaxCurrent' changed from 9 to 16 A

It is still the same when send command:

EVCC_Loadpoint0_MaxCurrent.sendCommand(9 | A)

It doesn’t matter if my car is connected or not or charging is in process or not.

Any idea whats the fault?

Thanks!

Unfortunately, no, not yet.
Can you please enable debug or trace logging?

In the openHAB console, run

log:set TRACE org.openhab.binding.evcc

Then please post your log output.

Thank you for your quick response. Here is the evcc trace:

2022-11-23 15:14:08.344 [DEBUG] [ab.binding.evcc.internal.EvccHandler] - Handling command 6 (class org.openhab.core.library.types.DecimalType) for channel evcc:device:4d99bcba7d:loadpoint0#maxCurrent
2022-11-23 15:14:08.346 [DEBUG] [ab.binding.evcc.internal.EvccHandler] - Running refresh job ...
2022-11-23 15:14:08.355 [TRACE] [ab.binding.evcc.internal.api.EvccAPI] - GET http://192.168.XXX.XXX:7070//api/state - {"result":{"auth":{"vehicles":null},"batteryConfigured":false,"bufferSoC":0,"currency":"EUR","gridConfigured":false,"homePower":0,"loadpoints":[{"chargeCurrent":0,"chargeCurrents":[0,0,0],"chargeDuration":8250000000000,"chargePower":0,"chargeTotalImport":1096.9202441666657,"chargedEnergy":1330.3241729736328,"charging":false,"connected":false,"connectedDuration":11969936021956,"enabled":false,"maxCurrent":16,"minCurrent":6,"minSoC":0,"mode":"pv","phaseAction":"inactive","phaseRemaining":0,"phasesActive":3,"phasesConfigured":3,"phasesEnabled":0,"pvAction":"inactive","pvRemaining":0,"targetSoC":100,"targetTime":null,"targetTimeProjectedStart":null,"title":"Wallbox","vehicleDetectionActive":false,"vehicleIdentity":""}],"prioritySoC":0,"pvConfigured":true,"pvPower":935,"residualPower":0,"savingsAmount":6.201111770292997,"savingsEffectivePrice":0.20996544909044956,"savingsGridCharged":40.68792924213777,"savingsSelfConsumptionCharged":28.186871683149977,"savingsSelfConsumptionPercent":40.92479586797763,"savingsSince":1667468807,"savingsTotalCharged":68.87480092528774,"siteTitle":"Home","sponsor":"XXX","tariffFeedIn":0.08,"tariffGrid":0.3,"vehicles":["unavailable"],"version":"0.107.1"}}
2022-11-23 15:14:08.357 [DEBUG] [ab.binding.evcc.internal.EvccHandler] - Found 1 loadpoints on site Home.
==> /var/log/openhab/events.log <==
2022-11-23 15:14:08.335 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'EVCC_Loadpoint0_MaxCurrent' received command 6
2022-11-23 15:14:08.338 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'EVCC_Loadpoint0_MaxCurrent' predicted to become 6
2022-11-23 15:14:08.348 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EVCC_Loadpoint0_MaxCurrent' changed from 16 A to 6
2022-11-23 15:14:08.372 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EVCC_GeneralPvPower' changed from 959 W to 935 W
2022-11-23 15:14:08.485 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'EVCC_Loadpoint0_MaxCurrent' changed from 6 to 16 A
==> /var/log/openhab/openhab.log <==
2022-11-23 15:14:11.067 [DEBUG] [ab.binding.evcc.internal.EvccHandler] - Running refresh job ...
2022-11-23 15:14:11.096 [TRACE] [ab.binding.evcc.internal.api.EvccAPI] - GET http://192.168.XXX.XXX:7070//api/state - {"result":{"auth":{"vehicles":null},"batteryConfigured":false,"bufferSoC":0,"currency":"EUR","gridConfigured":false,"homePower":0,"loadpoints":[{"chargeCurrent":0,"chargeCurrents":[0,0,0],"chargeDuration":8250000000000,"chargePower":0,"chargeTotalImport":1096.9202441666657,"chargedEnergy":1330.3241729736328,"charging":false,"connected":false,"connectedDuration":11969936021956,"enabled":false,"maxCurrent":16,"minCurrent":6,"minSoC":0,"mode":"pv","phaseAction":"inactive","phaseRemaining":0,"phasesActive":3,"phasesConfigured":3,"phasesEnabled":0,"pvAction":"inactive","pvRemaining":0,"targetSoC":100,"targetTime":null,"targetTimeProjectedStart":null,"title":"Wallbox","vehicleDetectionActive":false,"vehicleIdentity":""}],"prioritySoC":0,"pvConfigured":true,"pvPower":935,"residualPower":0,"savingsAmount":6.201111770292997,"savingsEffectivePrice":0.20996544909044956,"savingsGridCharged":40.68792924213777,"savingsSelfConsumptionCharged":28.186871683149977,"savingsSelfConsumptionPercent":40.92479586797763,"savingsSince":1667468807,"savingsTotalCharged":68.87480092528774,"siteTitle":"Home","sponsor":"XXX","tariffFeedIn":0.08,"tariffGrid":0.3,"vehicles":["unavailable"],"version":"0.107.1"}}
2022-11-23 15:14:11.099 [DEBUG] [ab.binding.evcc.internal.EvccHandler] - Found 1 loadpoints on site Home.

That’s quite interesting …
Seems like the binding does not make a request to evcc to set the maximum current, but I can’t say why without looking into it.

I’ll have a look at this ASAP.

Thank you alot. If you need additional information please let me know!

I think that I found the problem. The binding requires QuantityType for the command, but your command is DecimalType.
Can you please share your Item configuration? That would help me to reproduce your problem and test my fix.

@Breezy
I’ve created a fix, can you please download the artifact from Release evcc Binding - v0.5 · florian-h05/openhab-addons · GitHub and place it inside the addons folder of openHAB?
(For openHABian: /srv/openhab-addons, otherwise probably /usr/share/openhab/addons.)

@mstormi
For QuantityType commands, unit conversion is also supported now.

FYI: this will set the unit, too

What does this exactly mean for me? That all decimal type commands which use a dimension automatically become a QuantityType or what?