Heidelberg Wallbox Energy Control integration

Has onymone managed to integrate this into HA?
Seems to work on ioBroker

1 Like

Hello,
yes I was able to do this. I have used this ESPHome config as a baseline:
Heidelberg Wallbox · martgras/esphome Wiki (github.com)

I reduced the sensors to a minimum:

uart:
  id: mod_bus
  tx_pin: GPIO03
  rx_pin: GPIO01
  baud_rate: 19200
  stop_bits: 1
  parity: even

modbus:
  id: modbus_heidelberg_wallbox
  send_wait_time: 200ms
  uart_id: mod_bus
  
modbus_controller:
  - id: heidelberg_wallbox_id01
    address: 0x1
    modbus_id: modbus_heidelberg_wallbox
    command_throttle: 200ms
    setup_priority: -10
    update_interval: 5s

sensor:
  - platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01  
    id: charg_state
    name: "charging state"
    address: 0x0005
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  - platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01  
    id: watchdog
    name: "watchdog"
    address: 0x0101
    unit_of_measurement: "ms"
    register_type: holding
    value_type: U_WORD
    skip_updates: 0

  - platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01  
    id: max_current
    name: "max current"
    address: 0x0105
    unit_of_measurement: "A"
    register_type: holding
    value_type: U_WORD
    skip_updates: 0
    accuracy_decimals: 0
    filters:
      - multiply: 0.1

  - platform: homeassistant
    entity_id: input_number.wb_max_current #Slider from HASS, create as Helper
    id: wb_max_current
    internal: true
    on_value:
      then:
        - lambda: |-
            uint16_t payload = id(wb_max_current).state * 10;
            ESP_LOGI("main", "set max current %d", payload);
            // Create a modbus command item with the max current value as the payload
            esphome::modbus_controller::ModbusCommandItem set_payload_command = esphome::modbus_controller::ModbusCommandItem::create_write_single_command(heidelberg_wallbox_id01, 0x0105, payload);
            // Submit the command to the send queue
            heidelberg_wallbox_id01->queue_command(set_payload_command);

The Charging State signals if a car is connected and if charging is required. For the automation and managing the load I use Node-Red.
When the state switches to 4 or 5 (car is connected, no charging request) the charging state will be set to 6 (6A). This is the minumim charging allowed by Heidelberg.
This will allow charging and when the car requires charging the state will switch to 7.
The next flow will check every 5 seconds for the charging state (7) and than will check on what will still be transfered to the grid.

My Mercedes allows 2 phase charging - so 1A x 230V * 2 phases is 460kW. When more than 460kW will go to the grid, the Max Current will be increased by one (and if not, it will be decreased).

I just finshed yesterday and still testing. But first test was successful.

Br,
walzing

Hi Walzing,

thank you for your time and effort. I recently integrated our PV system into HA, now the next step is to integrate our Heidelberg Energy Control via Modbus into HA, and make the two “talk to each other”.

I have to admit that I have limited knowledge on programming and IT in general. Do you know of a source that describes your implementation in a more detailed way? A step-by-step procedure would be amazing of course, but anything with more detail would help a lot.

Any additional info is greatly appreciated, thank you!

Aleks

1 Like

Hello, how is the status?
I have also an Heidelberg Wallbox.
Can I help somehow?

Sorry for my late reply. I haven’t seen your requests.

I can help. I assume both of you have a working esphome and a RS485 modul connected to your Heidelberg?

1 Like

Hello,
I tried to connect my heidelberg energy control wallbox to esphome. On the oscilloscope I see the wallbox does answer to a read request, but I allways get crc error
Modbus CRC Check failed! C022!=0E

I used the following setup:

uart:
id: mod_bus
tx_pin: GPIO23
rx_pin: GPIO22
baud_rate: 19200
stop_bits: 1
parity: even

modbus:
id: modbus_heidelberg_wallbox
flow_control_pin : GPIO32
send_wait_time: 200ms
uart_id: mod_bus

modbus_controller:

  • id: heidelberg_wallbox_id01
    address: 0x1
    modbus_id: modbus_heidelberg_wallbox
    command_throttle: 200ms
    setup_priority: -10
    update_interval: 5s

sensor:

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: charg_state
    name: “charging state”
    address: 0x0005
    register_type: read
    value_type: U_WORD
    skip_updates: 0

Hello,
i tried to get the communication to the heidelberg energy control wallbox working.
I used the used above, but added the flow control pin.
On the oscilloscope i see some communication, but in ESPHome i get crc errors.

captive_portal:

Treiber: MAX485 ESA

DE : 3V3

DI : GPIO23

\RE : GND

RO : GPIO22

uart:
id: mod_bus
tx_pin: GPIO23
rx_pin: GPIO22
baud_rate: 19200
stop_bits: 1
parity: even

modbus:
id: modbus_heidelberg_wallbox
flow_control_pin : GPIO32
send_wait_time: 200ms
uart_id: mod_bus

modbus_controller:

  • id: heidelberg_wallbox_id01
    address: 0x1
    modbus_id: modbus_heidelberg_wallbox
    command_throttle: 200ms
    setup_priority: -10
    update_interval: 5s

sensor:

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: charg_state
    name: “charging state”
    address: 0x0005
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: wallbox_heidelberg_leistung
    name: “Wallbox Heidelberg_Leistung”
    address: 14
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: wallbox_heidelberg_spannung_L1
    name: “Wallbox Heidelberg Spannung L1”
    address: 10
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: wallbox_heidelberg_spannung_L2
    name: “Wallbox Heidelberg Spannung L2”
    address: 11
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: wallbox_heidelberg_spannung_L3
    name: “Wallbox Heidelberg Spannung L3”
    address: 12
    register_type: read
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: watchdog
    name: “watchdog”
    address: 0x0101 #257
    unit_of_measurement: “ms”
    register_type: holding
    value_type: U_WORD
    skip_updates: 0

  • platform: modbus_controller
    modbus_controller_id: heidelberg_wallbox_id01
    id: max_current
    name: “max current”
    address: 0x0105 #261
    unit_of_measurement: “A”
    register_type: holding
    value_type: U_WORD
    skip_updates: 0
    accuracy_decimals: 0
    filters:

    • multiply: 0.1
  • platform: homeassistant
    entity_id: input_number.wb_max_current #Slider from HASS, create as Helper
    id: wb_max_current
    internal: true
    on_value:
    then:
    - lambda: |-
    uint16_t payload = id(wb_max_current).state * 10;
    ESP_LOGI(“main”, “set max current %d”, payload);
    // Create a modbus command item with the max current value as the payload
    esphome::modbus_controller::ModbusCommandItem set_payload_command = esphome::modbus_controller::ModbusCommandItem::create_write_single_command(heidelberg_wallbox_id01, 0x0105, payload);
    // Submit the command to the send queue
    heidelberg_wallbox_id01->queue_command(set_payload_command);

Hi, how did you set the DIP Switches?
Have you added the 120ohm resistor?
What cable have you used and how long is it?