Hello,
my home has 8 power meters and 7 water meters they are at the same place and could be controlled by one ESP32. However, with the current implementation at esphome-core/pulse_counter.cpp at 254d059945932adb64f5cbe8f4928ea19b4f6f00 · esphome/esphome-core · GitHub it would “cost” 17 pins. That’s a lot.
I was thinking of extending the code to support two pins per pulse counter. In this case ESPHome can use the sensors like a switch matrix.
Example:
Use RJ45 cables with 8 cores for the pulse meters. One core is for horizontal matrix. 7 cores are for vertical matrix.If you have 3 cables it requires 10 pins instead of 21 to read them out.
Configuration
The configuration would look like it is now and is backward compatible. The sensor will get one optional tag named “control_pin”.
# Example configuration entry
sensor:
- platform: pulse_counter
pin: 12
control_pin: 7
name: "First Pulse Counter on Pin 12"
- platform: pulse_counter
pin: 12
control_pin: 8
name: "Second Pulse Counter on Pin 12"
control_pin will be set to LOW to read the meters of this line (RJ45 cable). Everything else remains as it is.
It is possible to mix pulse meters with and w/o control_pin in the same configuration.
I’d like to implement it.
What do you think about it?
Best regards,
Volkmar