01-21-2024, 11:36 PM
(01-07-2024, 11:10 AM)admin Wrote: thanks for sharing your result. maybe you can also post this problem to ESPHome forum.
Some feedback.
I was able to solve my "low SPS" problem as described above, by doing the following:
- set update interval to never for all sensors
- use interval and loop through sensors and add delay manually
This fixes the issue that it switches inputs on the multiplexer in an uncontrolled matter.
Code:
interval:
- interval: 10s
then:
- lambda: |-
id(Measured_Current_01).update();
# # ESP_LOGD("custom", "Measured Current-1: %f", id(ai1).state);
- delay: 625ms
- lambda: |-
id(Measured_Current_02).update();
# # ESP_LOGD("custom", "Measured Current-2: %f", id(Measured_Current_2).state);
- delay: 625ms
- lambda: |-
id(Measured_Current_03).update();
# # ESP_LOGD("custom", "Measured Current-3: %f", id(Measured_Current_3).state);
- delay: 625ms
- lambda: |-
id(Measured_Current_04).update();
# # ESP_LOGD("custom", "Measured Current-4: %f", id(Measured_Current_4).state);
- delay: 625ms
=> I update my values every 10 seconds, in sequence.
I also have better results when using calibrate_linear with method "exact" instead of the default least_squares.
Used a bunch of devices and combinations with power factor 1 (resistive loads) for callibration.
sample duration of 500ms works well for me.
Code:
- platform: ct_clamp
sensor: ai16
id: Measured_Current_16
name: "Measured Current-16"
sample_duration: 500ms
update_interval: never
accuracy_decimals: 5
filters:
- calibrate_linear:
method: exact
datapoints:
- 0 -> 0
- 0.00231 -> 0
- 0.00348 -> 0.063
- 0.00603 -> 0.170
- 0.00642 -> 0.180
- 0.00858 -> 0.252
- 0.01343 -> 0.407
- 0.02111 -> 0.653
- 0.02277 -> 0.713
- 0.05721 -> 1.775
- 0.07191 -> 2.243
- 0.07719 -> 2.398
- 0.14918 -> 4.650
- 0.19534 -> 6.100
- 0.28517 -> 8.960
- 0.47080 -> 14.550
Did this for all 16 clamps by putting them all on the same wire when doing the measurements.
It's much less jumpy then before. Still struggle to really measure low power, but that must be because of the overall accuracy.