Etrel Inch Modbus TCP communication

Hey @ThomasMidgley. Great job!
How does this convert to 2kW?

value:
  - 16656
  - 0

I can’t seem to work it out from the floattohex link you provided.

@gisa, hi,

When you save a value to the lovelance card in the form of “value: [x,y]” it is saved in a different form:
value:
- a
- b

I never tried to figure out why and how this is working.

You don’t set the kW as such in charger, but the maximum aperage:
since I have only a 1phase 230V power supply: 2kW / 230V =~ 8A
8A = 0x41000000 = [0x4100, 0x0000]
in a lovelance card it is stored as:

value:
  - 16656
  - 0
Summary

image

other example:
32A = 0x42000000 = [0x4200, 0x0000]
or

value:
- 16640
- 0

in automations the original values are kept:

###################################
#                                 #
# Instellen laadsnelheid laadpaal #
#                                 #
###################################

# Floating Point to Hex Converter
# https://gregstoll.com/~gregstoll/floattohex/

# 23h00 - 07h30: 32A
# 07h30 - 13h00: 0A
# 13h00 - 17h00: 32A
# 17h00 - 22h00: 0A
# 21h15 - 23h00: 8A

- alias: "Laadsnelheid 00h00"
  trigger:
  - platform: time
    at: "23:00:00" 
  condition:
    - condition: state
      entity_id: input_boolean.auto_charge
      state: "on"
  action:
  - service: modbus.write_register
    data:
      address: 8
      slave: 255
      value: [0x4200, 0x0000] # 32A
      hub: etrel_inch

- alias: "Laadsnelheid 07h30"
  trigger:
  - platform: time
    at: "07:30:00" 
  condition:
    - condition: state
      entity_id: input_boolean.auto_charge
      state: "on"
  action:
  - service: modbus.write_register
    data:
      address: 8
      slave: 255
      value: [0x0000, 0x0000] # 0A
      hub: etrel_inch

- alias: "Laadsnelheid 13h00"
  trigger:
  - platform: time
    at: "13:00:00" 
  condition:
    - condition: state
      entity_id: input_boolean.auto_charge
      state: "on"
  action:
  - service: modbus.write_register
    data:
      address: 8
      slave: 255
      value: [0x4200, 0x0000] # 32A
      hub: etrel_inch

- alias: "Laadsnelheid 17h00"
  trigger:
  - platform: time
    at: "17:00:00" 
  condition:
    - condition: state
      entity_id: input_boolean.auto_charge
      state: "on"
  action:
  - service: modbus.write_register
    data:
      address: 8
      slave: 255
      value: [0x0000, 0x0000] # 0A
      hub: etrel_inch

- alias: "Laadsnelheid 21h15"
  trigger:
  - platform: time
    at: "21:15:00" 
  condition:
    - condition: state
      entity_id: input_boolean.auto_charge
      state: "on"
  action:
  - service: modbus.write_register
    data:
      address: 8
      slave: 255
      value: [0x4100, 0x0000] # 8A
      hub: etrel_inch
  - delay:
      minutes: 1
  - service: automation.trigger
    data:
      skip_condition: true
    target:
      entity_id: automation.notificatie_vermogen_laadpaal

hope this helps.

Great info @ThomasMidgley. It looks like it got things working!
The ultimate goal would be to use any excess solar pv production, but let’s see how this goes first :wink:

Hi Thomas, I like your code, I have the same ev charger. I would like to max the phase instead of max power. How did you know which variable is which in the modbus.

I would like to make a dynamic load balancing based on current available A in the house at that moment of charging.

Another question, I have two Etrel chargers, how can I control them both ? Add another modbus section ? but how to deal with the names and ids? I tried, but it gives errors.

Hi, in the first post there’s a link to the wiki of Etrel, containing an overview of the registers. Here’s a direct link to the excel

https://etrelchargingsolutions.atlassian.net/wiki/download/attachments/820707329/Etrel%20INCH%20(Duo)%20SmartHome%20Modbus%20TCPRegisters.xlsx?api=v2

I don’t understand what you mean with “max the phase”. Nevertheless, I’m afraid HA will not be fast enough to react to momentarily surges in power use. Your fuse will pop faster than HA will update the set point for the maximum current.

I use an Etrel load guard for this purpose:
https://etrel.com/charging-solutions/load-guard/

according to the documentation you should setup multiple connections
https://www.home-assistant.io/integrations/modbus/#configuring-multiple-connections

# Example yaml: multiple tcp connections
modbus:
  - name: modbus_hub
    type: tcp
    host: IP_ADDRESS_1
    port: 2020

  - name: modbus_hub2
    type: tcp
    host: IP_ADDRESS_2
    port: 502

make sure they don’t use the same ports.

Hi Thomas, thanks for the info, yes I have also load guard installed. Dont know if there are settings for that as well, I have also heatpump and batteries who are heavy consumers. Would love to use the load guard for all these devices. I kind of want to build that in HA.

Not sure how I can change the port on the etrel, since I don’t have login / pwd…

I found a way in, but in the web interface of etrel you cannot change the port 501 to something else. Is there another way ?

The default login and password can be found on the inside of the maintenance door of the charger.

the charger uses port 502, where as the load balancer uses port 503. see the excel of Etrel