Connecting the ABL eMH1 EV charger as ESPHome Component

Been looking at communication with my charger.
Found another project that communicated with this charger.
It used ESP S2 Mini so ordered one and it worked out of the box with all of my TTL - RS485 converters.
I decided to try this project on that S2 Mini in case there is something wrong with my ESP32 Wroom but had same issues in S2 Mini.
I happened to look at TTL signals from ESPs with scope and noticed that bit rate seems different with these 2 projects. After some calculations this project seems to push out 115200 baud on both ESPs even though configurations state 38400.

At this point still no idea where things go wrong and how would fix it.

Ok i fixed it by comment out this sensor :wink:

Does someone knows if its possible to get the SOC of the car as an Sensor

Can you share you yaml for this?
Hoping I could find something that would explain my issues.

Hi, sorry for the Late answer. Here is my yaml.


substitutions:
  name: esp-abl-emh1-garage
  device_description: "Monitor and configure ABL eMH1 Charger via RS485/Modbus-ASCII"
  external_components_source: https://github.com/jrv/esphome-abl-emh1
  tx_pin: "GPIO1"
  rx_pin: "GPIO3"
  flow_control_pin: "GPIO12"

esphome:
  name: ${name}
  comment: ${device_description}
  friendly_name: ESP_abl_emh1_Garage
  project:
    name: "jrv.esphome-abl-emh1"
    version: 0.0.1

esp8266:
  board: nodemcu

external_components:
  source:
    type: git
    url: ${external_components_source}
    ref: main
  refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp-Abl-Emh1-Garage"
    password: "xxx"

ota:
  - platform: esphome
    password: "xxx"

logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

uart:
  id: uart_2
  baud_rate: 38400
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  parity: EVEN

emh1_modbus:
    uart_id: uart_2
    flow_control_pin: ${flow_control_pin}
    id: modbus0

abl_emh1:
  emh1_modbus_id: modbus0
  update_interval: 5s

preferences:
  flash_write_interval: 5min

text_sensor:
  - platform: abl_emh1
    mode:
      name: "Status"
    serial_number:
      name: "Serial number"
      disabled_by_default: true
#  - platform: template
#    name: Chargemode
#    id: chargemode
#    icon: "mdi:car"
#    update_interval: 5s
#    disabled_by_default: true
#    lambda: |-
#      int phaseCnt = 0; 
#      if (id(outlet_state).state == 0xC2) {
#        if (id(l1_current).state > 1.0)
#          phaseCnt++;
#        if (id(l2_current).state > 1.0)
#          phaseCnt++;
#        if (id(l3_current).state > 1.0)
#          phaseCnt++;
#      }
#      std::__cxx11::string result;
#      switch (phaseCnt){
#        case 0: 
#          result = "None";
#          break;
#        case 1:
#          result = "1 Phase";
#          break;
#        default:
#          result = "3 Phase";
#      }
#      return result;

sensor:
  - platform: abl_emh1
    l1_current:
      name: "L1 current"
      state_class: "measurement"
      accuracy_decimals: 0
      id: l1_current
    l2_current:
      name: "L2 current"
      state_class: "measurement"
      accuracy_decimals: 0
      id: l2_current
    l3_current:
      name: "L3 current"
      state_class: "measurement"
      accuracy_decimals: 0
      id: l3_current
    max_current:
      name: "Max current"
      state_class: "measurement"
      id: max_current
      disabled_by_default: true 
      accuracy_decimals: 0
    en1_status:
      name: "EN1 status"
      disabled_by_default: true 
    en2_status:
      name: "EN2 status"
      disabled_by_default: true 
    duty_cycle_reduced:
      name: "Reduced Duty Cycle (max_current)"
      disabled_by_default: true 
    ucp_status:
      name: "Ucp Status <= 10V"
      disabled_by_default: true 
    outlet_state:
      name: "Outlet state"
      disabled_by_default: true
      id: outlet_state
  - platform: uptime
    name: Uptime Sensor
    id: abl_uptime
    update_interval: 15s

number:
  - platform: template
    name: "Max Amps"
    id: set_current
    icon: mdi:arrow-oscillating
    min_value: 3
    max_value: 32
    step: 1
    optimistic: false
    lambda: 'return std::lround(id(max_current).state);'
    update_interval: 1s
    set_action:
      lambda: |-
        ESP_LOGD("main", "Sending modbus value = %d", std::lround(x));
        id(modbus0)->send_current(std::lround(x));

switch:
  - platform: template
    name: "Enable"
    id: enable_switch
    icon: "mdi:power"
    lambda: 'return (id(outlet_state).state != 0xE0);'
    turn_off_action: 
      - lambda: |-
          if ((id(abl_uptime).state > 10.0) && (id(outlet_state).state != NAN)) 
            id(modbus0)->send_enable(0);
    turn_on_action: 
      - lambda: |-
          if ((id(abl_uptime).state > 10.0) && (id(outlet_state).state != NAN))
            id(modbus0)->send_enable(1);