I have an energy meter, the data from which is read via a pulse output.
The problem is as follows. After connecting to the GPIO contact, after a while the pulses stop being counted. I changed 3 contacts and now another one has failed. I thought it was because of the pull-up resistors, so I enabled them programmatically. But it didn’t help.
Can anyone tell me what the problem is?
Below is the configuration that I use in ESPHOME.
substitutions:
device_name: energy-meter
friendly_name: energy-meter
esphome:
name: ${device_name}
esp32:
board: esp32dev
framework:
type: arduino
# Отключаем лог
logger:
level: WARN
baud_rate: 0
api: {}
ota:
- platform: esphome
password: !secret ota_pwd
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.99.238
gateway: 192.168.99.1
subnet: 255.255.255.0
fast_connect: true
reboot_timeout: 5min
ap:
ssid: ${device_name}
password: !secret ota_pwd_ap
web_server:
port: 80
version: 3
captive_portal:
time:
- platform: homeassistant
id: homeassistant_time
globals:
- id: saved_total_power_consumption
type: float
restore_value: true
initial_value: '0.0'
sensor:
- platform: pulse_counter
pin:
number: 17
inverted: true
mode:
input: true
pullup: true
id: energy_meter_counter
name: "Electro energy Meter Pulse Count"
unit_of_measurement: "pulses"
accuracy_decimals: 1
filters:
- multiply: 0.0025
- lambda: |-
id(saved_total_power_consumption) += x;
return id(saved_total_power_consumption);
- platform: template
name: "Saved Total Energy Consumption"
device_class: energy
lambda: |-
return id(saved_total_power_consumption);
unit_of_measurement: kWh
accuracy_decimals: 2
- platform: uptime
name: "uptime_${device_name}"
switch:
- platform: restart
name: "restart_${device_name}"
binary_sensor:
- platform: status
name: "Status_${device_name}"
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: False
bluetooth_proxy:
active: False
Scheme: