Missing energy management

Sorry not very techie when it comes to some parts of Home Assistant.

The esphome file, which is a CT Clamp on an esp32 is this:

  • platform: adc
    pin: A0
    id: adc_sensor

  • platform: total_daily_energy
    name: “Total Daily Usage”
    power_id: adc_sensor
    filters:
    # Multiplication factor from W to kW is 0.001
    - multiply: 0.001
    unit_of_measurement: kWh
    icon: mdi:clock-alert
    device_class: energy

time:

  • platform: sntp
    id: my_time

The entity is in Home Assistant, but the new energy still does not see it???

Thanks for any help…

What is the state of your HA entity in the Developer Tools.

E.g., working sensor

Sorry, get you know.

Hopefully it will be attached!!!

Energy

It’s missing last_reset and (I think) state_class to be usable in the energy panel.
I would guess that should come from ESPhome. Maybe a matter of version?

This is my working sensor from ESPHOME:

ESPhome is fully upto date. I know that the energy integration is in very early stages, but I would have thought the basic’s would be a little simpler to configure.

I will add the last_reset and state_class later on and see if that fixes it.

Thanks

Looking at esphome, it looks like the CT clamp creates a sensor in Amps, total_daily_energy needs an input in Watts (or kW)

The ESPhome file for the CT Clamp is:

sensor:

  • platform: ct_clamp
    sensor: adc_sensor
    name: “Measured KW”
    update_interval: 10s
    filters:
    • calibrate_polynomial:
      degree: 3
      datapoints:

      Map 0.0 (from sensor) to 0.0 (true value)

      • 0.0 → 0.0
      • 0.01 → 0.008
      • 0.020 → 0.018
      • 0.025 → 0.023
      • 0.04 → 0.037
      • 0.08 → 0.07
      • 0.11 → 0.10
      • 0.12 → 0.13
      • 0.14 → 0.15
      • 0.20 → 0.21
      • 0.34 → 0.39
      • 0.40 → 0.46
      • 0.60 → 0.68
      • 0.80 → 0.88
    • lambda: return x * 20;
      unit_of_measurement: “kw”

So I must be missing something???

Sorry, no idea what that is doing, if the CT clamp platform is output in Amps, multiply it by your voltage to get Watts

have a look here, someone else has done it, the 230 is the voltage

If I remember, I found this info online and followed it. The result is what you see.

So does any one have any idea as to what it should look like. I find following the info in ESPhome works on the assumption you have the knowledge, but need a little help. Plus Im not good at programming.

I can follow someone’s else’s file and learn from it…

Something like this, you’ll need to do the calibration and set the voltage to match yours
Change the update interval to 60s once working

sensor:
  - platform: adc
    pin: A0
    id: adc_sensor

  - platform: ct_clamp
    id: measured_power
    sensor: adc_sensor
    name: Measured Power
    update_interval: 5s
    filters:
      - calibrate_linear:
          - 0 -> 0
          - 0.12 -> 17.4    
      - lambda: return x * 230.0;
    unit_of_measurement: W

  - platform: total_daily_energy
    name: Total Daily Energy
    power_id: measured_power
    filters:
        - multiply: 0.001
    unit_of_measurement: kWh
    accuracy_decimals: 3
    icon: mdi:clock-alert
    device_class: energy

Thank you very very much for all your help.

I will change the yaml file over and see what happens.

Cheers

Still can’t get the energy option to pick up my CT Clamp. I have made the changes, but still does not appear.

  • platform: total_daily_energy
    name: “Total Daily Usage”
    power_id: measured_power
    filters:
    # Multiplication factor from W to kW is 0.001
    - multiply: 1
    unit_of_measurement: kWh
    icon: mdi:clock-alert
    accuracy_decimals: 2
    state_class: measurement
    device_class: energy

time:

  • platform: sntp
    id: my_time

The only thing I read is to do with last_reset but you get an error if you add it???

The only thing the new energy option pick is a power option on a blind motor.

state_class: measurement
unit_of_measurement: W
friendly_name: Dining Blind Motor Power Meter
device_class: power

Which has no data on it any way, so big time confused. I do wish the documentation for this could be clearer and full explained in ESPhome.

Thanks for any help…

How come you have - multiply: 1 instead of - multiply: 0.001 ?

Show us your full config

This is the full yaml:

sensor:

  • platform: adc
    pin: A0
    id: adc_sensor

  • platform: ct_clamp
    id: measured_power
    sensor: adc_sensor
    name: “Measured Kw”
    update_interval: 10s
    filters:

    • calibrate_polynomial:
      degree: 1
      datapoints:

      Map 0.0 (from sensor) to 0.0 (true value)

      • 0.0 → 0.0
      • 0.01 → 0.008
      • 0.020 → 0.018
      • 0.025 → 0.023
      • 0.04 → 0.037
      • 0.08 → 0.07
      • 0.11 → 0.10
      • 0.12 → 0.13
      • 0.14 → 0.15
      • 0.20 → 0.21
      • 0.34 → 0.39
      • 0.40 → 0.46
      • 0.60 → 0.68
      • 0.80 → 0.88
    • lambda: return x * 23.0;
      unit_of_measurement: “Kw”
  • platform: total_daily_energy
    name: “Total Daily Usage”
    power_id: measured_power
    filters:
    # Multiplication factor from W to kW is 0.001
    - multiply: 1
    unit_of_measurement: kWh
    icon: mdi:clock-alert
    accuracy_decimals: 2
    state_class: measurement
    device_class: energy

time:

  • platform: sntp
    id: my_time

I have changed the multiplier to get Kw not Watts and the only way to get the kWh to work is the multiple by 1. I cant see that this would be the reason why it does not appear in the device list in energy. But if Im wrong then please say.

Cheers

1 Like

Thanks to all for help and support. I have managed to get it to appear in energy management, by adding the missing info through Customizations option.

Just have to work on changing the charts…