Good day,
I am new to ESPHome, but not new to programming in C.
I am using ESP8266
3D printed my own rain gauge.
My goal is to see the amount of bucket tips.
I want “hourly Rain Fall”, “Daily Rain Fall” and to add later “yearly rain fall”.
I want to se total rain.
I have this code, but it is getting values I have no idea where it comes from.
Please help. Daily and hourly increases 0.25 per pulse.
I get 0.25, 0.75, 1.25, etc.
time:
- platform: sntp
id: my_time
timezone: SAST-2
on_time:
- seconds: 0
minutes: 0
hours: /1
then:
- sensor.integration.reset: hourly_rain_fall
- seconds: 0
minutes: 0
hours: 0
then:
- sensor.integration.reset: daily_rain_fall
binary_sensor:
- platform: gpio
name: "Binary Pulse"
pin:
number: GPIO4
allow_other_uses: true
sensor:
# Raw Pulse Counter (pulses to mm conversion)
- platform: pulse_counter
pin:
number: GPIO4
mode:
input: True
pullup: True
allow_other_uses: true
unit_of_measurement: 'mm'
name: "Rainfall per Minute"
icon: 'mdi:weather-rainy'
id: rainfall_per_minute
count_mode:
falling_edge: INCREMENT
rising_edge: DISABLE
internal_filter:
microseconds: 50
update_interval: 60s
filters:
- multiply: 0.25
- debounce:
milliseconds: 400
accuracy_decimals: 2
# Hourly Pulse Count (in millimeters)
- platform: integration
name: "Hourly Rain Fall"
id: hourly_rain_fall
time_unit: h # Use hours for integration
unit_of_measurement: 'mm'
sensor: rainfall_per_minute
accuracy_decimals: 2
# filters:
# - multiply: 30.0030 # Multiply the pulse count by the conversion factor (adjust if needed)
# Daily Pulse Count (in millimeters)
- platform: integration
name: "Daily Rain Fall"
id: daily_rain_fall
time_unit: h
unit_of_measurement: 'mm'
sensor: rainfall_per_minute
accuracy_decimals: 2
# filters:
# - multiply: 30.0030 # Multiply the pulse count by the conversion factor (adjust if needed)```
![Msg|690x75](upload://dMc2sHZQO4OOm7CsPCZrdOHqXZq.png)
In the image "Rain per minute" is correct (0.25mm) for one pulse.
But how is Hourly and Daily calculated? It needs to follow the patten 0.25, 0.5, 0.75, etc.