I have a strange problem with the power input on the new Energy system, I am using ESP32 with the code from GLOW, all works perfect exept that some strange spikes occur 1 og 2 times pr. 24 hours
Hi, I am having the same problem. Huge spikes at random every so often. Did you find a fix for this? I have a pulse rate of 3200. I am using a Wemos D1 Mini.
Just an idea from someone that stumbled on to this thread and never used this kind of sensor:
Does it correlate to times you go into the room with the meter or sunset/sunrise? If your photodiode is not sufficiently isolated every flash of light (like turning on light in the basement) can be counted as a pulse. Some meters with transparent covers over the body can make this particularly difficult. Try covering sensor area with black tape and lowering it’s sensitivity. Also make sure that you wiring is solid and does not create pulses when moved. (EMI could also be a thing if your wires are long)
Thanks, I will give that a go. The wires are only 4cm long in the box. I have a RED LED to repeat the blink to another sensor also, I’ll try disconnecting that and see if it helps. I put some filler in the box after I took this picture to prevent the RED LED from trigering the photodiode also but did not help. The unit is in an enclosed meter box with no light getting in.
I checked the ESPHome page regarding the pulse_sensor that I am using for this project and found I needed to configure an internal_filter of 100ms to prevent these spikes.
This is the page I followed to create the project.
I tried all of the suggestions on this thread and others to try and combat the spikes I was getting. For some reason none of them helped. I went so far as to have multiple ESPs connected to the photodiode board, an arduino to buffer and clean the pulse signal, different power sources, and even tested the ESPs with a signal generator.
I found that the spikes would only occur when the ESP was connected and powered near the smart meter itself. I was able to remove the spikes completely (at least after a day of testing…) by moving the ESP further away from the smart meter…
I assume the GSM signal from the smart meter is interfering with the ESP and causing this glitch, as at least for me the spikes were periodic and at the start of every hour.
I gave up with glow, having run it for several years had to add filters etc in yaml and it worked perfectly but would eventually fail again - the potentiometer would move slightly by itself (maybe moisture or heat related?) and I would get spikes again. Got sick of having to adjust it, so ended up going with a Shelly EM dual clamp meter put it in my mains box, one clamp on main power feed and one on HWC and works with zero issues. Cost a bit more but it’s very accurate and just works.
If you want to stick with glow, this worked for me (you may want to adjust the max value)
sensor:
# WiFi signal
- platform: wifi_signal
name: "${friendly_name} - WiFi Signal"
update_interval: 120s
# Pulse meter
- platform: pulse_meter
name: '${friendly_name} - Power Consumption'
id: sensor_energy_pulse_meter
unit_of_measurement: W
state_class: measurement
device_class: power
icon: mdi:flash-outline
accuracy_decimals: 0
pin: ${pulse_pin}
internal_filter_mode: 'PULSE'
internal_filter: 5ms
on_raw_value:
then:
- light.turn_on:
id: led_red
- delay: 0.1s
- light.turn_off:
id: led_red
filters:
# multiply value = (60 / imp value) * 1000
# - multiply: 60
- lambda: return x * ((60.0 / id(select_pulse_rate).state) * 1000.0);
- lambda: |-
float MIN_VALUE = 0.0;
float MAX_VALUE = 18000.0;
if (MIN_VALUE <= x && x <= MAX_VALUE) return x;
else return {};
# Update the sensor with an average every 10th second. See
# https://github.com/klaasnicolaas/home-assistant-glow/#reduce-the-amount-of-data-the-sensors-produce
# for more information.
- throttle_average: 100ms
- filter_out: NaN
total:
name: '${friendly_name} - Total Energy'
id: sensor_total_energy
unit_of_measurement: kWh
icon: mdi:circle-slice-3
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# multiply value = 1 / imp value
# - multiply: 0.001
- lambda: return x * (1.0 / id(select_pulse_rate).state);
# Update the sensor once per 0.1 kWh consumed, or every 5th minute, whichever happens sooner.
# See https://github.com/klaasnicolaas/home-assistant-glow/#reduce-the-amount-of-data-the-sensors-produce
# for more information.
#- delta: 0.01
#- heartbeat: 300s
# Total day usage
- platform: total_daily_energy
name: '${friendly_name} - Daily Energy'
id: sensor_total_daily_energy
power_id: sensor_energy_pulse_meter
unit_of_measurement: kWh
icon: mdi:circle-slice-3
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# Multiplication factor from W to kW is 0.001
- multiply: 0.001