From f808edf725bf52942245ba2033b529a5e0b1ba3b Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Mon, 23 Jan 2023 21:17:39 +0100 Subject: [PATCH] [evcc] Adjust to breaking API change & Add new channel (#14245) * [evcc] Adjust to breaking API changes Fixes #14231. See https://github.com/evcc-io/evcc/discussions/5522. * [evcc] Add battery capacity channel * [evcc] Version & openHABian note * [evcc] Use already defined constants in ChannelTypeUIDs * [evcc] Correct header in evcc.properties Signed-off-by: Florian Hotze --- bundles/org.openhab.binding.evcc/README.md | 121 ++++++++-------- .../evcc/internal/EvccBindingConstants.java | 131 ++++++++++-------- .../binding/evcc/internal/EvccHandler.java | 85 ++++++------ .../evcc/internal/api/dto/Loadpoint.java | 8 +- .../binding/evcc/internal/api/dto/Result.java | 16 ++- .../binding/evcc/internal/api/dto/Status.java | 2 +- .../resources/OH-INF/i18n/evcc.properties | 4 +- .../resources/OH-INF/thing/thing-types.xml | 7 + 8 files changed, 208 insertions(+), 166 deletions(-) diff --git a/bundles/org.openhab.binding.evcc/README.md b/bundles/org.openhab.binding.evcc/README.md index 792c28d0b..5bcf7853e 100644 --- a/bundles/org.openhab.binding.evcc/README.md +++ b/bundles/org.openhab.binding.evcc/README.md @@ -1,6 +1,9 @@ # evcc Binding This binding integrates [evcc - electric vehicle charging control](https://evcc.io), a project that provides a control center for electric vehicle charging. +The binding requires evcc [version 0.111.0](https://github.com/evcc-io/evcc/releases/tag/0.111.0) or newer and is tested with this version. + +You can easily install and upgrade evcc on openHABian using `sudo openhabian-config`. 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 management systems from many manufacturers as well as electric vehicles from over 20 car manufacturers. @@ -37,6 +40,7 @@ Please note that some of them are only available when evcc is properly configure | Channel | Type | Read/Write | Description | |----------------------------|----------------------|------------|--------------------------------------------------------------------------------------------------------------| +| general#batteryCapacity | Number:Energy | R | Capacity of (home) battery. | | general#batteryPower | Number:Power | R | Current power from battery. | | general#batterySoC | Number:Dimensionless | R | Current State of Charge of battery. | | general#batteryPrioritySoC | Number:Dimensionless | R | State of State of Charge for which the battery has priority over charging the ev when charging mode is "pv". | @@ -91,42 +95,43 @@ Thing evcc:device:demo "evcc Demo" [url="https://demo.evcc.io", refreshInterval= ```java // General -Number:Power evcc_demo_batteryPower "Battery Power [%.1f kW]" {channel="evcc:device:demo:general#batteryPower"} -Number:Dimensionless evcc_demo_batterySoC "Battery SoC [%d %%]" {channel="evcc:device:demo:general#batterySoC"} -Number:Dimensionless evcc_demo_batteryPrioritySoC "Battery Priority SoC [%d %%]" {channel="evcc:device:demo:general#batteryPrioritySoC"} -Number:Power evcc_demo_gridPower "Grid Power [%.1f kW]" {channel="evcc:device:demo:general#gridPower"} -Number:Power evcc_demo_homePower "Home Power [%.1f kW]" {channel="evcc:device:demo:general#homePower"} -Number:Power evcc_demo_pvPower "PV Power [%.1f kW]" {channel="evcc:device:demo:general#pvPower"} +Number:General evcc_batteryCapacity "Battery Capacity [%.0f kWH]" {channel="evcc:device:demo:general#batteryCapacity"} +Number:Power evcc_batteryPower "Battery Power [%.1f kW]" {channel="evcc:device:demo:general#batteryPower"} +Number:Dimensionless evcc_batterySoC "Battery SoC [%d %%]" {channel="evcc:device:demo:general#batterySoC"} +Number:Dimensionless evcc_batteryPrioritySoC "Battery Priority SoC [%d %%]" {channel="evcc:device:demo:general#batteryPrioritySoC"} +Number:Power evcc_gridPower "Grid Power [%.1f kW]" {channel="evcc:device:demo:general#gridPower"} +Number:Power evcc_homePower "Home Power [%.1f kW]" {channel="evcc:device:demo:general#homePower"} +Number:Power evcc_pvPower "PV Power [%.1f kW]" {channel="evcc:device:demo:general#pvPower"} // Loadpoint -Number evcc_demo_loadpoint0_activePhases "Active Phases [%d]" {channel="evcc:device:demo:loadpoint0#activePhases"} -Number:ElectricCurrent evcc_demo_loadpoint0_chargeCurrent "Charging current [%.0f A]" {channel="evcc:device:demo:loadpoint0#chargeCurrent"} -Number:Time evcc_demo_loadpoint0_chargeDuration "Charging duration [%1$tH:%1$tM]"