I’m using a ESP32 DevKit V4 and I tried this code:
esphome:
name: weather-station
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Weather-Station Fallback Hotspot"
password: "Zaamb9bZPZm2"
i2c:
- id: bus_a
sda: GPIO21
scl: GPIO22
frequency: 100kHz
scan: true
- id: bus_b
sda: 14
scl: 15
scan: true
# sensore temperatura e pressione
sensor:
- platform: bmp085
i2c_id: bus_a
address: 0x77
temperature:
name: "Temperatura esterna"
pressure:
name: "Pressione atmosferica"
update_interval: 1800s
# sensore luminosità
- platform: adc
pin: GPIO32
name: "Sensore luminosità"
update_interval: 1800s
unit_of_measurement: lx
attenuation: 11db
filters:
- lambda: |-
return (x / 10000.0) * 2000000.0;
# sensore movimento
#binary_sensor:
# - platform: gpio
# pin: GPIO33
# name: "PIR Sensor2"
# device_class: motion
# sensore pioggia
- platform: adc
pin: GPIO34
name: "Valore Pioggia"
attenuation: 11db
internal: true
# It is important to have a low update interval so that
# the measurement has time to be done correctly during
# the activation of the voltage AND taking into account the median filter
update_interval: 300s
filters:
- multiply: 0.846153 # 3.9 (11db attenuation full-scale voltage) -> 3.3V
- median:
window_size: 7
send_every: 4
send_first_at: 3
binary_sensor:
- platform: gpio
pin: GPIO36
name: "sensore pioggia"
# device_class: moisture
In Ha i see binary sensor state but its “inverted”. When dry it returns “wet” and when wet it returns “dry”
And I cant see the sensor “valore pioggia” in HA even if it works in ESP logs.
This is a nice solution that I would like to try.
I looked for info on the size of the resistor but couldn’t find it.
You have no idea about the value of the resistor?
It’s a 10k resistor (brown, black, orange), and the “resistor value” is the real resistor value measured with a multimeter. In mine the measured value is 9.94kOhm
I would suggest wiring it this way (and make use of the yaml snippet) so that the permanent dc voltage doesn’t degrade your raindrops module within weeks/months