Actaris gasmeter magnetic reedswitch counter

Text

Hi all,

I am trying to get a magnetic reedswitch into Hassio, but I am failing.
What I try to accomplisch is to integrate my gasmeter readings into Hassio.
After that I also would like to see the daily en montly usage *(utility meter)
I need to count the times the switch goes from LOW to HIGH.
My problem is I have a switch and I don’t know how to make it a sensor…

My instance Hassio 0.103.5 on a RPi 3b+.
I have tried it with arduino’s (via usb serial) and nodemcu’s/wemos D1 via Esphome but I can’t
get it to work.
I prefer the arduino solution but maybe it is possible to connect the reed switch directly to the Pi?

The switch I use (impuls) is a Actaris 951-858-04.
http://www.meterbuy.com/fileadmin/user_upload/Data_sheets/140610-N_018-PULSE_EMITTERS-GAS.pdf

My config (for arduino)

arduino:
port: “/dev/ttyUSB1”

sensor:

  • platform: arduino
    pins:
    2:
    name: “Gasverbruik”

utility_meter:
daily_energy:
source: switch.gasverbruik
cycle: daily
monthly_energy:
source: switch.gasverbruik
cycle: monthly

Is there someone who can help me to get this working in a stable way?

Thanks in advance!

What pins did you have the reed switch connected to on the nodeMCU and what colour wires did you connect on the reed switch ?

I connected yellow and green on the nodemcu on ground and D2.

Add…

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO4
    name: "gas_meter_pulse"

… to your nodeMCU’s ESPhome configuration file.

You should then have a new binary_sensor appear in Home Assistant.

Also, you might have to move the wire from gound to one of the 3V3 pins

Thank you, I will try that.

I still prefer to connect the pulse directly to the pi or via arduinio/usb serial.
The pi is in the same place as the gasmeter so doesn’t have to be wireless.

Thank you, it is working!
(I forgot to integrate esphome in hassio in the integrations section)
Happy with the result.

Then it should be a simple matter of switching out the code and moving the wires across.
Instructions for RPI gpio here:

Thank you for your help, that will be the next project :slight_smile:

Esphome solution is not as stable as I hoped.
The sensor is very often not avialeble.

I also tried the pi project but I am not able to get any readings from the pi.
My reed switch is a potential free reed switch. I don’t know how to wire the switch/sensor to the pi.
Does it or does it not need 3.3V, wich gpio should I use, do I need to add resistors to it and do I need to configure the gpio as a pull-up or pull down?
I am compleetly lost :weary: