mrbrett
(Eric Garijo)
March 2, 2022, 2:08pm
1
Hi, I have created my first DIY weather station with a Wemos D1 mini and ESPhome sucessfully. It has temperature and pressure (bmp820), anemometer (pulse_counter) and rain gauge (also with pulse_counter).
But I want to change a little bit the config because one of the use cases I want for the anemometer and rain gauge is to pick up the awning in case it starts raining or the wind speed is above 30km/h.
Right now I’m publishing values every 15/30s but i don’t want to flood home assistant to record all the values.
What i would like to achieve is to send the values for statistics let’s say every 10/15 minutes with the moving average filter, but also have instant values if the rain is greater than 0 or the wind speed is greater than 30km/h. Activate a binary sensor for this can also be a good option.
How can I achieve this?
Thanks in advance!
mrbrett
(Eric Garijo)
March 2, 2022, 9:23pm
3
I have already read all the documentation in the sensor page, but i still can’t figure it out.
guyy
(guy)
October 22, 2022, 8:52pm
4
Hi can you share your product i also can not understand how to
JulianDH
(Julian Hall)
October 22, 2022, 11:07pm
5
Threshold helper in HA. You may create a template in ESPHome based on the raw sensor values; so your sensor has two values being produced
guyy
(guy)
October 23, 2022, 3:22am
6
Hi
Thanks i know how to add the esp but can you share the component +the code + the connection schema ?
mrbrett
(Eric Garijo)
October 23, 2022, 10:16am
7
I used more or less this approach:
I willl paste my code later.
mrbrett
(Eric Garijo)
October 24, 2022, 8:02am
8
Here my code:
esphome:
name: estacion-meteo-bat
platform: ESP8266
board: d1_mini
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: !secret wifi_password
wifi:
networks:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Est-Meteo-Bat Fallback Hotspot"
password: !secret wifi_password
captive_portal:
# Example configuration entry
i2c:
sda: D2
scl: D1
scan: True
deep_sleep:
id: deep_sleep_1
run_duration: 12hours
sleep_duration: 12hours
time:
- platform: sntp
timezone: Europe/Madrid
on_time:
# Every evening
- seconds: 0
minutes: 0
hours: 21
then:
- deep_sleep.enter:
id: deep_sleep_1
sleep_duration: 12hours
# Example configuration entry
sensor:
- platform: bmp280
temperature:
name: "Temperatura Exterior"
oversampling: 16x
pressure:
name: "Presión Exterior"
address: 0x76
update_interval: 600s
- platform: wifi_signal
name: "Estación Meteo WiFi"
update_interval: 600s
- platform: adc
pin: A0
unit_of_measurement: "%"
name: "% Bateria"
device_class: battery
update_interval: 600s
filters:
- multiply: 4.2
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 3.3 -> 0
- 3.45 -> 5
- 3.68 -> 10
- 3.74 -> 20
- 3.77 -> 30
- 3.79 -> 40
- 3.82 -> 50
- 3.87 -> 60
- 3.92 -> 70
- 3.98 -> 80
- 4.06 -> 90
- 4.176 -> 100
- platform: pulse_counter
pin: D7
unit_of_measurement: "km/h"
name: "Velocidad del viento"
count_mode:
rising_edge: DISABLE
falling_edge: INCREMENT
icon: "mdi:weather-windy"
internal_filter: 500us
update_interval: 30s
filters:
- multiply: 0.04
# - sliding_window_moving_average:
# window_size: 5
# send_every: 1
# As per the datasheet, a wind speed of 2.4km/h (1.4912 mph)
# causes the switch to close once per second. --> 0,04 * pulse/min
# Radio 7cm / Diametro 14cm
# 1 vuelta = 0,439822971502571 m/s o 1,58336269740926 km/h
# o en factor 0,0263893782901543
- platform: pulse_counter
pin: D5
unit_of_measurement: "mm/h"
name: "Lluvia"
count_mode:
rising_edge: DISABLE
falling_edge: INCREMENT
icon: "mdi:weather-rainy"
internal_filter: 500us
update_interval: 30s
filters:
- multiply: 16.764
- sliding_window_moving_average:
window_size: 10
send_every: 1
# The rain gauge is a self-emptying tipping bucket type. Each
# 0.2794mm of rain cause one momentary contact closure that can be
# recorded with a digital counter or microcontroller interrupt input.
#
1 Like
I reckon an “or” filter is the key to this…
You can have your base time based updates, but supplement that with pushing immediate values based on what you want.