Skip to content

Repository files navigation

ABL-Wallbox Web-App

ESP32 Projekt for controlling the ABL eMH1/eMH2 Wallbox with an easy to use Web-Application and simple REST-API to home automation software.

(no need for Android or iPhone App, just open in Web-Browser)

Functions

  • Monitor and control your ABL-Wallbox with an WEB-Application and integrate it (optional) in your homeautomation software with simple REST-Interface (see example for DOMOTICZ below)
  • Display wallbox-status and actual parameter (I-max, kw-charge, kW/h, charging-time)
  • "Quick-set" predefined Ipwm values to ABL-Box
  • Set Ipwm (Current per phase)
  • Set Pmax (Power sum for all phases)
  • CONFIG-DATA: set and store parameter and WiFi-credentials and the the "Quick-Set" charge-current
  • EVENT-LOG: Serial debug logging
  • UPDATE: over-the-air (Wifi) Software update
  • HISTORY: Set and Store total kW/h sum in internal FLASH
  • INFO: Version, Build, Temp(ESP-intern), IP, Timeout, Charge-Cnt, RSSI
  • WEB-API for Limit to german 'Par 14a Limitation' to 4.2kW (see Example at 'External setting for Pmax')
  • ... for less than 10€ (with ESP32-S2-mini) or 30€ (ready to use WAVESHARE-DIN-RAIL-Modul).

NEW: german Par14a Limit per Digital-Input

License

Android-App

Android-App Android-App Android-App Android-App

Supported ABL Wallbox

  • eMH1 11kW ( old version) --> Power calculation with internal current values
  • eMH1 11kW ( > Q2-2021 no internal current sensor) --> 'virtual' Power calculation
  • eMH1 22kW --> Power calculation with internal current values
  • eMH2 22kW (StandAlone Modus) --> Power calculation with internal current values

'Virtual' consumption for ABL-Boxes without phase current sensor

For (new) ABL-Boxes without internal per phase current sensor, the current could "pre-measured" external and defined in the APP-configuration per Imax setting. So it is possible to have a "poor man's" power and consumption measurement. If you charge every time the same car, the typical power for a defined Ipwm is near to the real measurement with a current-sensor, but with current sensor there is also an error, because the voltage 'U' for power calulation (P=U*(I1+I2+I2) is not measured.

I get the power from my "offical" smartmeter and set them into the config-file.

If the Box has a current-sensor it was automatic detected and the value is calculated based on the current sum of the 3-phases...For future versions it would be possible to expand the software to get the power or current over the WEB-API from an external meter.

ESP32 Hardware

NEW in V2.0: Waveshare ESP32-S2 RS485 Modul

Solderless “plug and play” alternative with integrated RS485 Converter. USB-C port for program upload and debug. This is a ready to use solution (no need for any onboard wiring or additional Signal-Converter)

German Paragraph 14a EnWG Limit (4.2kW)

works out of the box on Waveshare ESP32-S2 RS485 Modul

Howto for Waveshare ESP32-S3 RS485

connect extra IO-connector (small plug with 4 cable below USB-Port)

  • Limit-ON: GPIO_01=yellow -connect to-> GROUND=black)
  • Limit-OFF: no connection

...for all other hardware define 'PAR14LIMIT_GPIO' Pin in platformio.ini

Waveshare

ESP32-S2 mini

My first adapter is realised with an 'ESP32-S2 mini' board and an 'MAX485 TTL to RS485' Converter.

Additionally, have a look a the GPIO PINs as specified here: https://www.olimex.com/Products/IoT/ESP32/ESP32-POE/resources/ESP32-POE-GPIO.png ...but any other ESP-Board could be used with small modifications in the code and platformio.ini.

Fritzing prototype (board is cut to fit in a DIN hat rail case)

other Hardware (not testet)

The Olimex ESP32-POE has integrated Ethernet, supports Power over Ethernet and has a 5V/GND output for powering the "MAX485 TTL to RS485" Converter. You need to build the ESP firmware by yourself with platformIO. Have a look at the platformio.ini and adjust as you need it.

Manual Charge Current- and Power-Setting

Android-App

Configuration

Android-App

goto "Setup" --> "Config-Data"

REMARK

!! no quotation marks for Strings

!! ';' at the End of each Variable definition

Set-Values:

varDEVICE_s_Name=ABL-Wallbox;
varWIFI_s_Mode=STA; // AP=conect to AccessPoint, STA=standalone Station (IP:192.168.4.1)
varWIFI_s_Password=mypassword;
varWIFI_s_SSID=myssid;

varABL_i_A_soll_low = 6; // Quick Setting for Low-Current
varABL_i_A_soll_high = 10; // Quick Setting for High-Curent
varABL_i_Scantime_ms = 10000; // Scantime to ABL-Wallbox (Values > 60000 --> Software-Sleep of ABL-Wallbox)

varABL_i_U_netz = 231;  // in V (used for Power-calculation)

varABL_i_Phase_count   = 3; // 1..3 (depending on car onboard-charger or external wireing)
varABL_i_I_limit       = 12; // Current Limit (per Phase!)

WEB-API for External charge-Current and charge-Power Setting (WEB-API)

With the WEB-API the state and consumption values of the Wallbox could be monitored and charge-current could be set from 6A up to 16A in external applications like homeautomation software.

Fetch aktual Values and State

fetch

http://<your-ip>/fetch

Receive: 8.00,0.00,A1,0.00,103980,00:00:00

decoded: <Imax [A]>,<aktual Power [kW]>,<Status>,<aktual Work [kW/h]>,<Sum Work [W/h]>,<charge-time>

Fetch actual Values and State in key=value pair

This includes the "Status" as an Integer Value, too.

fetchkv

http://<your-ip>/fetchkv

Receive:

Imax=16 A 
ActPower=11 kW
Status=C2
IntStatus=194
ActWork=0.92 kW/h
SumWork=2926 W/h
ChargeTime=00:15:02

fetchjson

http://<your-ip>/fetchjson

Receive:

{
  "ipwm": 16,
  "kw": 11,
  "status": "A1",
  "wh": 0.92,
  "whsum": 2926,
  "ctime": "00:15:02"
}

Web-API for settting Imax

Set Wallbox Imax Current (per Phase)

http:<your-ip>//fetch?imax=xx (xx= 6, 7...16)

Web-API for setting Pmax

Set ABL-Wallbox Pmax (!! Sum [Watt] for all Phase !! limited by 'varABL_i_I_limit' per phase)

http:<your-ip>//fetch?pmax=xx (xx= 4000, ....16000)

Example or setting to german Par14a limit of 4.2kW:

Remark: Value depends on 'varABL_i_Phase_count' and is rounded to set Imax als Integer value (6...16)

http:<your-ip>//fetch?pmax=4200

Example for Home-Assistent Integration

...see above 'WEB-API' for other external integration (e.g. other homeautomation software)

HOMEASSI

add to configuration.yaml:

rest:
    scan_interval: 20
    resource: http://192.168.2.108/fetch
    sensor:
      - name: "ABL-Wallbox Imax"
        unique_id : "sensor_abl_imax"
        icon: "mdi:ev-station"
        value_template: '{{value.split(",")[0]}}'
        unit_of_measurement: "A"
        device_class: current

      - name: "ABL-Wallbox kw"
        unique_id : "sensor_abl_kw"
        icon: "mdi:ev-station"
        value_template: '{{value.split(",")[1]}}'
        unit_of_measurement: "kW"
        device_class: power

      - name: "ABL-Wallbox-Status"
        unique_id : "sensor_abl_status"
        icon: "mdi:ev-station"
        value_template: '{{value.split(",")[2]}}'
      
      - name: "ABL-Wallbox-kWh akt."
        unique_id : "sensor_abl_kwhakt"
        icon: "mdi:ev-station"
        value_template: '{{float(value.split(",")[3])/1000}}'
        unit_of_measurement: kWh
        device_class: energy
     
      - name: "ABL-Wallbox-kWh Gesamt"
        unique_id : "sensor_abl_kwhsum"
        icon: "mdi:ev-station"
        value_template: '{{float(value.split(",")[4])/1000}}'
        unit_of_measurement: kWh
        device_class: energy
        state_class: total

rest_command:
  abl_set_imax_6a:
    url: "http://192.168.2.108/fetch?imax=6"
    method: GET
  abl_set_imax_16a:
    url: "http://192.168.2.108/fetch?imax=16"
    method: GET

Example for 'Domoticz' Integration

...see above 'WEB-API' for other external integration (e.g. other homeautomation software) Domoticz

Domoticz Configuration

Domoticzpoller

LUA polling script for Domoticz (ablpoller.lua)

-- Polling of ABL-Web-App
--
-- This function split a string according to a defined separator
-- Entries are returned into an associative array with key values 1,2,3,4,5,6...
local function split(str, sep)
 if sep == nil then
  sep = "%s"
 end
 local t={} ; i=1
 local regex = string.format("([^%s]+)", sep)
  for str in str:gmatch(regex) do
   t[i] = str
   i = i + 1
  end
 return t
end

-- Retrieve the request content
s = request['content'];

print("ABL-Wallbox-Poller:"..s);
-- Split the content into an array of values
local values = split(s, ",");

-- Update devices 
-- ACHTUNG: Index beginnt in LUA mit 1

--                    xx  mit aktueller IDX anpassen
--                    vv
domoticz_updateDevice(63,'',values[1]) -- Imax
domoticz_updateDevice(65,'',tonumber(values[2])*1000) -- Watt !!
domoticz_updateDevice(62,'ABL-Status',values[3]) -- Status-String
domoticz_updateDevice(66,'',values[4]) -- kW/h
domoticz_updateDevice(67,'',values[5]) -- W/h SUM

Helpful Infos and links and investigations (most in german)

Software

my shared investigations and notes: my-doc

...others sources https://github.com/ThKls/Wallbox-Test

https://www.goingelectric.de/forum/viewtopic.php?f=34&t=38749&start=60

https://www.goingelectric.de/forum/viewtopic.php?p=1550459#

ABL-Wallbus Modbus-Connector

modbus-connector-1 connect RS485 to Pin1 (=A) and Pin2 (=B) of left RJ45-Connector in Wallbox the termination Jumper may be optional (worked for me with and without)

Other Modbus-Connector Variants

modubus-rj12_belegung modubus-jr12_buchse

...more infos: evcc-io/evcc#2801

Licence

Licensed under the European Union Public License (EUPL)-1.2-or-later

Why licensed under EUPL-1.2: it is compatible to GPL and compatible to EU-rights and regulations

Download and Installation

  • To download click the DOWNLOAD ZIP button, rename the uncompressed folder 'ESP32_ABL' ...or clone it with git

PlatformIO and Arduino-IDE

Projekt was build and testet with PlatformIO.

Take care to upload the 'data' folder to the SPIFFS filesystem see: https://randomnerdtutorials.com/esp32-vs-code-platformio-spiffs/

With the following two command you can create and upload the SPIFFS image:

pio run --target buildfs
pio run --target uploadfs

Flash Program (without PlatformIO or Arduino-IDE)

If you do not want to compile the program from source:

for the ESP32-S2 mini board I supply the actual firmware-version

  • got to subfolder firmware/lolin_s2_mini/V1_2

  • put ESP32-S2 board to flash-mode:

  • disconnect USB then press and hold "0"-button

  • reconnect USB hold "0"-button

  • then release "0"-button --> now the board is in program-mode

  • run flash.sh (for Linux) or flash.bat (for Windows) (needs 'esptool.py') --> ask google

  • after flashing reset or disconnect USB

  • search WIFI connection for "ESP_ABL_AP"

  • connect (without password)

  • start your webbrowser at "192.168.4.1" (this is the startpage for the APP) to connect to your home-route navigate to "Setup" --> "Config-Data" and change:

varWIFI_s_Mode=STA; 
varWIFI_s_Password=mypassword;
varWIFI_s_SSID=myrouter;

Version History

V1.0 initial version, first test with real charging car (VW ID.3)

V1.1 ABL-Box without internal current-sensor: calculate power and consumption from premeasured config-values.

V 1.2 index-page redesign, fixes for kW/h-calculation, fetch kW/h sum, Info-page, display chargetime, bugfixes.

V1.2.2 Bugfix for 'virtual kW/h-calculation' and Modbus timeouts

V1.2.3 More granular Imax Setting in 1A Steps (from 6A, 7A...16A) for external Imax setting.

V2.0.0 initial version with support for 2 Wallboxes, "Waveshare ESP32-S3 RS485" Modul support.

V2.1.0 add internal and external Setting for Pmax in Watt ('2100....16000') Sum for all Phases.

V2.2.1 load management (load sharing (max 8A) per Box, or priority for one Wallbox) for 2 Wallboxes

V2.3.0 german Paragraph 14a Limit (4.2kW) on Waveshare ESP32-S3 (Limit-ON: GPIO1=yellow -connect to-> GROUND=black)

V2.3.1 bugfix for load management 2 Boxes

other ESP32 Hardware (not tested)

add Ethernet port to esp32:

https://www.roboter-bausatz.de/p/wt32-eth01-esp32-modul-mit-ethernet-bluetooth-wifi

https://mischianti.org/esp32-ethernet-w5500-with-plain-http-and-ssl-https/

https://www.waveshare.com/rs485-to-eth-b.htm

About

Monitor and control your ABL-Wallbox with an WEB-Application and integrate it in your homeautomation software with simple REST-Interface

Topics

Resources

Stars

16 stars

Watchers

7 watching

Forks

Releases

Packages

Contributors

Languages