I have been working on this for several days. There must be a drop dead simple way to do this.
I found links to a UK board with an 8266 but nothing in the US of A for an ESP32.

I have been using code I found , but I get the same readings with lamp on or off. I also get readings close to the same with nothing connected to my ESP32

If you donāt link data sheet of you clamp, for sure no one can help you.
Every clamp is having different output, it can be current or voltage output, and values can be about whatever. You should also show your wiring.

@PapaLanc Iāve recently started to experiment and there are several things I thought werenāt immediately obvious.

The version of ESP32 matters, for example Iām using a Lolin ESP32 S2 mini and I CANNOT use the ADC_2 whilst using WiFi, so itās ADC_1 for me.

The ADC will (almost) always report the voltage divider voltage, the ct_clamp takes care of the sampling around this voltage to work out the AC component.

Your zero point in the voltage divider might need to be calibrated to actually give a zero current.

Your sample_rate needs to have a number of cycles to sample! The update_interval needs to have a number of samples.

What I have working on the bench, waiting to be deployed is;

@ChrisThomas et al, thanks
Embarrassed to say, but I believe I am the root of the problem of course.
My goal was basically to see if my water heater was on or not and a plus would be to measure KW. So on my workbench I have the 30 amp ct on a light bulb that consumes 0.1 amps and 9 watts. So perhaps it is not fesable to read .1 amps on a 30 amp ct clamp. That said on the same wire I am running a Tuya 80amp that seems to work fine.

My clamp says it has a resistor and I do measure resistance with my ohm meter. I do not see a data sheet.
FWIW I am in the US and 60hz

I am going to start over with a 20amp clamp I am using female jumpers on the pins of the esp32. I am not sure that is a perfect world. I am confused as these numbers ājumpā a lot. The only one that stays the same ic ACD Current 3.14

I currently have it on a load that is 2.3 amps and 206 watts
What number to I use for the calibrate? For example in your code 3.6, is that the actual watts or amps?

[17:07:31][D][sensor:094]: āADC Channel 1ā: Sending state 3.14353 V with 5 decimals of accuracy
[17:07:31][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.280A after 52 different samples (104 SPS)
[17:07:31][D][sensor:094]: āMeasured Currentā: Sending state -4.58449 A with 5 decimals of accuracy
[17:07:32][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.285A after 29 different samples (58 SPS)
[17:07:32][D][sensor:094]: āMeasured Currentā: Sending state -5.06339 A with 5 decimals of accuracy
[17:07:33][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.202A after 39 different samples (78 SPS)
[17:07:33][D][sensor:094]: āMeasured Currentā: Sending state 3.15509 A with 5 decimals of accuracy
[17:07:34][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.209A after 47 different samples (94 SPS)
[17:07:34][D][sensor:094]: āMeasured Currentā: Sending state 2.48878 A with 5 decimals of accuracy
[17:07:35][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.256A after 36 different samples (72 SPS)
[17:07:35][D][sensor:094]: āMeasured Currentā: Sending state -2.19414 A with 5 decimals of accuracy
[17:07:36][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.235A after 61 different samples (122 SPS)
[17:07:36][D][sensor:094]: āMeasured Currentā: Sending state -0.06536 A with 5 decimals of accuracy
[17:07:37][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 1.253A after 57 different samples (114 SPS)

Right now I have this but I have tried different values. I also tried the ones you suggested.

@ChrisThomas
As I look back at my at my previous post with out the number jumping by lol
the Raw AC state is semi regular 1.2a
The sending state where I have no clue it is sending jumps a lot.

The only value with this code that shows in HA is the ADC voltage of 3.14?

Well I thought I was on to something, but the raw ac voltage is the same if the clamp is on or off the wire

Okay now, I changed from auto to 0db and now I have steady readings. Now what to doā¦

[18:11:11][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.253A after 65 different samples (130 SPS)
[18:11:11][D][sensor:094]: āMeasured Currentā: Sending state 179.87833 A with 5 decimals of accuracy
[18:11:12][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.236A after 66 different samples (132 SPS)
[18:11:12][D][sensor:094]: āMeasured Currentā: Sending state 183.02452 A with 5 decimals of accuracy
[18:11:13][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.288A after 71 different samples (142 SPS)
[18:11:13][D][sensor:094]: āMeasured Currentā: Sending state 173.36896 A with 5 decimals of accuracy
[18:11:14][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.258A after 59 different samples (118 SPS)
[18:11:14][D][sensor:094]: āMeasured Currentā: Sending state 178.93951 A with 5 decimals of accuracy
[18:11:15][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.240A after 59 different samples (118 SPS)
[18:11:15][D][sensor:094]: āMeasured Currentā: Sending state 182.30867 A with 5 decimals of accuracy
[18:11:16][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.222A after 55 different samples (110 SPS)
[18:11:16][D][sensor:094]: āMeasured Currentā: Sending state 185.45328 A with 5 decimals of accuracy
[18:11:17][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.278A after 48 different samples (96 SPS)
[18:11:17][D][sensor:094]: āMeasured Currentā: Sending state 175.22107 A with 5 decimals of accuracy
[18:11:18][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.264A after 64 different samples (128 SPS)
[18:11:18][D][sensor:094]: āMeasured Currentā: Sending state 177.88260 A with 5 decimals of accuracy
[18:11:19][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.234A after 52 different samples (104 SPS)
[18:11:19][D][sensor:094]: āMeasured Currentā: Sending state 183.42326 A with 5 decimals of accuracy
[18:11:20][D][ct_clamp:041]: āMeasured Currentā - Raw AC Value: 0.237A after 54 different samples (108 SPS)

The voltage your ADC reports should be half way between your ESP32 VCC and GND, in your case above 1.65V. I found for my build this was a bit off, but within tolerance of the components, you adjust this in the calibrate_linear.

To calibrate your readings, remove the filter and measure no load and a known load, then put the filter back in with those numbers. Out of interest do your reading jump around especially if you move near?

From you description your current clamp is a voltage type which means it has a burden resistor built in. Which clamp is it, just to make sure it is voltage and current type. If it says something like 100A/10mA you have a current type, if it says 100A/1V you have a voltage type. Your clamp will say what kind of ratio of input to output, e.g. 30A / 1V. You want to select this ratio based on expected load current. DO NOT pick the biggest current and then expect to detect a small current. I tried measuring something like 100W with a 10A/1V clamp and wasnāt very impressed with the reported numbers, but I could tell it was ON.

Which ESP32 are you using? As I mentioned above I found that my ESP32 S2 couldnāt use the ADC_2 inputs when using WiFi so I had to use ADC_1.

In my initial use case, I want to know if a device is on more than how much energy itās using and I found it worked well on the bench, I am yet to put it into real use.

Like I wrote before, show specs of your CT and illustrate your actual wiring.
Before you clearly understand your clamps output, itās waste of time to play with esphome.

Also be aware, if you have current type CT clamped to load without resistor on output, itās generating high voltage to open output.

@PapaLanc More time for a considered response today. Please realise that Iām just beginning my journey with CT Clamps and ESPHome so am no expert, just adding my limited experience.

Iām using a Lolin ESP32 S2 mini and Iām powering it with 5V but the inputs are 3.3V. My no load ADC reports the voltage divider sits just under the calculated 1.65V but well within component tolerances. With no CT Clamp present the values vary especially when I touch the connector where the CT Clamp should be.

The ADC input Iām using is GPIO01 and is labeled as 1 on the board. I canāt comment on the inputs you are using, you may have to do some digging to check for any exclusions/considerations.

To work out the values you need in YOUR filter for YOUR configuration, you need to remove the filter: section in your code and run with no load to get the 0 value from your ct_clamp and then again with a known current to get another value. Put these numbers into the filter, add the filter code back in, the filter then calculates the voltage to current relationship in YOUR configuration. You can add more data points if you wish.

In the diagram you posted above there are no values given for Resistor1 and Resistor2, what have you used? Did you use an electrolytic 10uF capacitor?

I have some 32 minis. when I asked about tx the board I was looking at did not have A0. see some do. Regardless I am using a dev board and trying gpio34 and 35 which are adc1 pins
I see now the filters section. I was removing the entire ct_clamp duh

100 ohm resistors and yes 10uF

I am know using a 20 amp ct clamp back on my desk light bulb. I just do not see the numbers change when the clamp is on or off. Do I just not have a big enough load?

I would change those 100R for 10kR resistors. That could be throwing off your readings. The voltage divider needs to be MUCH higher resistance than the burden resistor that is in your CT Clamp. Iām speculating that the burden resistor in your CT Clamp is in the region of 20-30R.

If you are after consumption then I would increase the sample duration and update interval, that should smooth out the inherent inaccuracy in this method. Tinker with the settings until youāre happy.

Iām after a device ON/OFF indication so I sample more frequently.