I would like to hook a reed sensor (this one: https://photos.app.goo.gl/VW4YKFUqLu7AmyCL7, which I assume is the same as this one MS-214-3) up to my ESP32 board (this one: ESP-32 Dev Kit C op az-delivery.de).
But I’m not sure whether I can connect both wires to pins just like that. I’d like to avoid a short, obviously. Now, looking at the data sheet from PIC GmbH, it looks like the reed sensor also consists of a resistor, so I assume it’s safe?
Also, this is the code:
esphome:
name: watermeter
esp32:
board: az-delivery-devkit-v4
framework:
type: arduino
logger:
api:
password: ""
encryption:
key: "xxxxxxx"
# Set pulse counter total from home assistant using this action:
actions:
- action: set_pulse_total
variables:
new_pulse_total: int
then:
- pulse_counter.set_total_pulses:
id: watermeter_pulse_counter
value: !lambda 'return new_pulse_total;'
ota:
- platform: esphome
password: ""
wifi:
ssid: "xxxxxxx"
password: "xxxxxxx"
manual_ip:
static_ip: 192.168.1.169
gateway: 192.168.1.1
subnet: 255.255.255.0
ap:
ssid: "xxxxxxx"
password: "xxxxxxx"
captive_portal:
switch:
- platform: restart
name: opnieuw_opstarten
id: opnieuw_opstarten
time:
- platform: homeassistant
id: tijd
sensor:
- platform: uptime
type: timestamp
name: laatste_herstart
id: laatste_herstart
- platform: pulse_counter
pin:
number: 14
inverted: true
mode:
input: true
pullup: true
unit_of_measurement: l/s
name: watermeter_pulse_counter
id: watermeter_pulse_counter
filters:
- multiply: 15 # (60 s / 4 pulseringen per liter)
total:
unit_of_measurement: l
name: watermeter_pulse_counter_total
id: watermeter_pulse_counter_total
filters:
- multiply: 0.25 # (4 pulseringen = 1 liter)
Does that look good?
Thanks for anyone’s answer (who knows more of it than I ;))!