I have set up my Wemos D1 Mini for reading only current, as per https://learn.openenergymonitor.org/electricity-monitoring/ct-sensors/how-to-build-an-arduino-energy-monitor-measuring-current-only.
Without reading the documentation, I cut and paste the following sensor code from an online discussion.
sensor:
- platform: ct_clamp
sensor: adc_sensor
name: "Washing Machine Current Sensor"
update_interval: 10s
filters:
- calibrate_linear:
- 0 -> 0
- 0.12 -> 17.4
- lambda: return x * 230.0 / 1000;
unit_of_measurement: "kw"
- platform: adc
pin: A0
id: adc_sensor
The output stayed more or less the same wether power was on or off
[22:00:41][C][mdns:085]: Hostname: washing-machine
[22:00:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 104 different samples (520 SPS)
[22:00:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.08101 kw with 2 decimals of accuracy
[22:00:53][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 96 different samples (480 SPS)
[22:00:53][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06590 kw with 2 decimals of accuracy
[22:01:03][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 101 different samples (505 SPS)
[22:01:03][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.08162 kw with 2 decimals of accuracy
[22:01:13][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 93 different samples (465 SPS)
[22:01:13][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07237 kw with 2 decimals of accuracy
[22:01:22][D][sensor:125]: 'adc_sensor': Sending state 0.50879 V with 2 decimals of accuracy
[22:01:23][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 83 different samples (415 SPS)
[22:01:23][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07440 kw with 2 decimals of accuracy
[22:01:33][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 94 different samples (470 SPS)
[22:01:33][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06411 kw with 2 decimals of accuracy
[22:01:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 90 different samples (450 SPS)
[22:01:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07852 kw with 2 decimals of accuracy
[22:01:53][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.005A after 114 different samples (570 SPS)
[22:01:53][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.17349 kw with 2 decimals of accuracy
[22:02:03][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 96 different samples (480 SPS)
[22:02:03][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07915 kw with 2 decimals of accuracy
[22:02:13][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 103 different samples (515 SPS)
[22:02:13][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07098 kw with 2 decimals of accuracy
[22:02:22][D][sensor:125]: 'adc_sensor': Sending state 0.50879 V with 2 decimals of accuracy
[22:02:23][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 78 different samples (390 SPS)
[22:02:23][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07936 kw with 2 decimals of accuracy
[22:02:33][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 82 different samples (410 SPS)
[22:02:33][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.07529 kw with 2 decimals of accuracy
[22:02:43][D][ct_clamp:038]: 'Washing Machine Current Sensor' - Raw AC Value: 0.002A after 95 different samples (475 SPS)
[22:02:43][D][sensor:125]: 'Washing Machine Current Sensor': Sending state 0.06120 kw with 2 decimals of accuracy
I therefore decided to read the docs found here: https://github.com/esphome/esphome-docs/blob/e869ce49cdf6a4b8793e20bc65ce4dd65b08d39a/components/sensor/ct_clamp.rst.
I got lost at this point as I am not sure what they are telling me to do. “First, you need to set up a voltage sensor source (:doc:ADC sensor <adc>
, but for example also :doc:ADS1115 <ads1115>
) and pass it to the CT clamp sensor with the sensor option.” (clicking on the links did not seem to take me anywhere. As I am using the “only current” schematic I am not sure how or where to add the voltage sensor or what I even use for that.