Hi,
I am trying to make a digital Rain drop sensor on D8 of a Wemos D1. This should be a digital in/out.
I attached a Rain drop sensor , which includes a LM393. I created the following code in esphome:
binary_sensor:
- platform: gpio
pin:
number: D8
name: ${display_name} Rain
device_class: moisture
But it is not working. I can turn the sensor on with the potentionmeter, led is on, but no log on the esphome output log and no change in HA.
Who has an idea?
tom_l
July 30, 2020, 4:40pm
2
Sounds like a wiring fault. How did you power and connect the sensor to the ESP?
Just simple. Vcc to 3,3v, ground to ground, and d0 of the lm393 to d8 of the wemos.
1 Like
Troon
(Troon)
July 30, 2020, 5:11pm
4
See here : perhaps rewire and recode for one of the pins labelled OK for input.
d8 is “ pulled to GND” according to link. Should I make a change in esphome? To e.g. INPUT_PULLDOWN?
tom_l
July 30, 2020, 5:32pm
6
No you should wire the sensor to
1 Like
Strange; testing on D5 is working now, i tested D7 and that is working not either. D5 is working so fine to me.
1 Like
Llammy
March 27, 2022, 1:11pm
8
Would you mind helping me?
my code is as follows
esphome:
name: rain-sensor
esp8266:
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret otapassword
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Rain-Sensor Fallback Hotspot"
password: !secret rain_sensor_password
captive_portal:
switch:
- platform: gpio
pin: D0
name: "Rain sensor power"
sensor:
- platform: adc
id: source_sensor
pin: A0
- platform: resistance
sensor: source_sensor
id: real_resistance_sensor
name: "${friendly_name} rain"
configuration: DOWNSTREAM
resistor: 5.1kOhm
reference_voltage: 3.3V
internal: true
icon: "mdi:omega"
on_value:
then:
- if:
condition:
lambda: |-
return (
id(real_resistance_sensor).state > 100
);
then:
- sensor.template.publish:
id: real_resistance_sensor
state: !lambda 'return ON;'
But i get a compile error 'Unable to find action with the name ‘sensor.template.publish’ ’