KWH meter S0 config not working

Hi guys,

Let me start with that I’m not a coder. So I use tutorials and hope it works the first time :slight_smile:

I have the following set up:
-esphome with the S0tool code from huizebruin.
-Esp32 connected to a KWH meter LEM022SJ. 400 pulses per kWh (2.5Wh/imp)
-KWH meter to read usage of Tesla wallcharger.

The S0tool is reading KW and KWH. But there is actually nu power been drawn. So it reads false pulses I guess. Imgur: The magic of the Internet

What am I doing wrong?

The code is as following:

select:

:arrow_down: imp/kWh rate :arrow_down:

  • platform: template
    name: “Pulse_rate kWh meter”
    id: Select_pulse_rate
    optimistic: true
    options:
    • “2000”
    • “1500”
    • “1000”
    • “500”
    • “400”
    • “100”
      initial_option: “400”
      on_value:
      then:
      • logger.log:
        format: "Chosen option: %s "
        args: [“x.c_str()”]

#------------------------# Kwh meter S0 poort 1 #------------------------#
sensor:

:arrow_down: kwh meter s0 :arrow_down:

  • platform: pulse_meter
    pin: GPIO14
    name: “Actuele energie”
    id: W_opbrengst
    icon: “mdi:flash”
    internal_filter: ${impulslengte}
    accuracy_decimals: 3
    unit_of_measurement: ‘kW’
    state_class: measurement
    device_class: power
    filters:
    • lambda: return x * ((60.0 / atoi(id(Select_pulse_rate).state.c_str())));

:arrow_down: Totaal opgebracht :arrow_down:

total:
  unit_of_measurement: 'kWh'
  name: "Totaal opgebracht"
  id: W_opbrengst_totaal
  state_class: total_increasing
  device_class: energy
  icon: "mdi:flash"
  accuracy_decimals: 2
  filters:
    - lambda: return x * ((1.0 / atoi(id(Select_pulse_rate).state.c_str()))); 

:arrow_down: Kwh meterstand :arrow_down: stand bij benadering

  • platform: template
    id: kwh_total
    name: “Actuele meterstand”
    state_class: “total_increasing”
    icon: “mdi:flash”
    update_interval: 1s
    unit_of_measurement: ‘kWh’
    accuracy_decimals: 2
    lambda:
    return id(W_opbrengst_totaal).state + id(totalkwhUsage);

Hello Delusional112.

i wrote the code for the esp8266 and specially for the wemos d1 mini.

therefore u cannot put it on a esp32 without modify the code.