various esphome yaml tidyups

This commit is contained in:
root
2024-06-06 11:08:40 +12:00
parent 29c092232b
commit 8851f8da5e
5 changed files with 493 additions and 387 deletions

View File

@@ -7,6 +7,7 @@
# zorruno 2024-05-24 V1.1 Tested ok and added some V calibration for mine
# zorruno 2024-05-25 V2 A bunch more sensors added (wind direction not yet sorted)
# zorruno 2024-05-25 V3 Shuffled some sensors, rain count added
# zorruno 2024-06-03 V4 tweaks to battery and wind
#############################################
#############################################
@@ -24,39 +25,42 @@
# bmp280: Temp/pressure on the board (0x76 i2c)
# pulse_meter: Wind Speed (GPIO14)
# pulse_meter: Rainfall (GPIO12)
#
# text_sensor: Beaufort Wind Scale Labelling
# text_sensor: Temp (av) Average of all temps
#
# Battery Calcs:
# template: Last 30mins battery MAX
# template: battery now - max (discharge/charge)
# template binary: discharging, charging, stable
#
# TO TEST (HAVE SENSOR or doesn't need one)
# tsl2561: Ambient Light sensor (0x39 i2c)
# ads1115 A1_GND: UV Index
# ads1115 A0_GND: Wind Direction
#
# Battery Calcs:
# template: Last 20mins battery MAX
# template: battery now - max (discharge/charge)
# template binary: discharging, charging, stable
#
# ORDERED BUT DON'T HAVE YET
# ltr390: Ambient Light and UV sensor (0x53 i2c)
# pmsx003: PM Particulate Filter (UART)
# AS3935: lightning sensor (i2c, but needs design)
# ds1307: RTC (i2c)
#
# NOT USED (code commented)
# NOT USED (but code commented)
# bme280_i2c: Temp/humid/press (not used)
#
# POSSIBLY ADD
# Analogue for Solar V?
# ground movement/earthquake?
# water sensor (rain now)
# soil temp
# soil moisture
#
#############################################
#############################################
# WEMOS D1 Mini GPIO, and Weather station Use
#############################################
# PIN HEADERS ON Weatherstation board:
# PIN HEADERS on Weatherstation board:
# D1, GPIO5 Used as SCL (I2C)
# D2, GPIO4 Used as SDA (I2C)
# D3, GPIO0 connected to FLASH button, boot fails if pulled LOW
@@ -66,7 +70,7 @@
# D7, GPIO13 Used for DHT
# D8, GPIO15 (Boot fails if pulled HIGH)
#
# NO HEADERS ON Weatherstation board:
# NO HEADERS on Weatherstation board:
# D0, GPIO16, (used to wake up from deep sleep)
# RX, GPIO3 (HIGH at boot)
# TX, GPIO1 (HIGH at boot, boot fails if pulled LOW)
@@ -140,7 +144,7 @@ esp8266:
i2c:
sda: GPIO4
scl: GPIO5
scan: True
scan: True #scan the bus on startup. Useful if looking for the address of something
#frequency: 100kHz #10, 50, 100, 200, 800 are possible settings, 100kHz was reliable for me for ESP32, default is 50kHz
#############################################
@@ -148,7 +152,7 @@ i2c:
# https://esphome.io/components/logger.html
#############################################
logger:
level: DEBUG #INFO Level suggested, or DEBUG for testing
level: INFO #INFO Level suggested, or DEBUG for testing
#baud_rate: 0 #set to 0 for no logging via UART, needed if you are using it for other serial things (eg PZEM)
#esp8266_store_log_strings_in_flash: false
#tx_buffer_size: 64
@@ -195,8 +199,8 @@ wifi:
# and not compile, or it will crash occasionally)
# https://esphome.io/components/web_server.html
#############################################
web_server:
port: 80
#web_server:
# port: 80
# version: 1 #V1 occasionally works better, V2 The nicer page
# username: !secret web_server_username #probably a good idea to secure it
# password: !secret web_server_password
@@ -267,14 +271,35 @@ text_sensor:
id: wind_dir
update_interval: never
#############################################
#############################################
# General Sensors
# https://esphome.io/components/sensor/index.html
#############################################
#############################################
sensor:
################################
# BMP280 temp/pressure
# UPTIME
# Device uptime info
# https://esphome.io/components/sensor/uptime.html
################################
- platform: uptime
name: ${friendly_name} Uptime
################################
# WIFI SIGNAL
# Quality of Wifi in dBm
# https://esphome.io/components/sensor/wifi_signal.html
################################
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: ${update_time}
#retain: true #retain useful if sleeping
################################
# BMP280 TEMPERATURE AND PRESSURE
# The BMP does not have humidity, use the BME for that
# https://esphome.io/components/sensor/bmp280.html
################################
- platform: bmp280
@@ -292,37 +317,9 @@ sensor:
unit_of_measurement: "hPa"
oversampling: 16X
#retain: true #MQTT retain useful if sleeping
################################
# BME280 temp/humidity/pressure (Note, BME and BMP Are different...)
# https://esphome.io/cookbook/bme280_environment.html
################################
#- platform: bme280_i2c
# address: 0x76
# update_interval: ${update_time}
# temperature:
# name: ${friendly_name} BME280 Temp
# accuracy_decimals: 1
# oversampling: 2x
# unit_of_measurement: "°C"
# #retain: true #MQTT retain useful if sleeping
# pressure:
# name: ${friendly_name} BME280 Pressure
# oversampling: 2x
# unit_of_measurement: "hPa"
# #retain: true #MQTT retain useful if sleeping
# humidity:
# name: ${friendly_name} BME280 Humidity
# accuracy_decimals: 1
# oversampling: 2x
# unit_of_measurement: "%"
# #retain: true #MQTT retain useful if sleeping
################################
# DHT temp/humidity
# DHT TEMPERATURE, PRESSURE & HUMIDITY
# https://esphome.io/components/sensor/dht.html
# These DHTs are not very accurate...
################################
@@ -337,63 +334,24 @@ sensor:
name: ${friendly_name} DHT22 Humidity
unit_of_measurement: "%"
#retain: true #retain useful if sleeping
################################
# TSL2561 ambient light sensor
# https://esphome.io/components/sensor/tsl2561.html
# TEMP SENSORS AVERAGE
# Averaging for the various temp sensors on board
################################
#- platform: tsl2561
# name: ${friendly_name} Ambient Light
# address: 0x39
# update_interval: 60s
################################
# LTR390 Ambient Light and UV Sensor
# https://esphome.io/components/sensor/ltr390.html
################################
#- platform: ltr390
# address: 0x35
# uv_index:
# name: ${friendly_name} 390 UV Index
# uv:
# name: ${friendly_name} 390 UV Sensor Counts
# light:
# name: ${friendly_name} 390 Light
# ambient_light:
# name: ${friendly_name} 390 UV Sensor Counts
# update_interval: 60s
################################
# PMSX003 Particulate sensor
# NEEDS UART SET FIRST
# https://esphome.io/components/sensor/pmsx003.html
################################
#- platform: pmsx003
# type: PMSX003
# pm_1_0:
# name: ${friendly_name} Particulate Matter <1.0µm
# pm_2_5:
# name: ${friendly_name} <2.5µm
# pm_10_0:
# name: ${friendly_name} <10.0µm Concentration
################################
# Device uptime info
# https://esphome.io/components/sensor/uptime.html
################################
- platform: uptime
name: ${friendly_name} Uptime
################################
# Quality of Wifi in dBm
# https://esphome.io/components/sensor/wifi_signal.html
################################
- platform: wifi_signal
name: ${friendly_name} WiFi Signal
update_interval: ${update_time}
#retain: true #retain useful if sleeping
- platform: template
name: ${friendly_name} Temp (av)
icon: "mdi:thermometer"
unit_of_measurement: "°C"
lambda: |-
return (
id(bmp280_temp).state
+
id(dht_temp).state
) / 2;
################################
# BATTERY VOLTAGE
# Analog sensor for voltage reading
# (A0 on esp8266)
# https://esphome.io/components/sensor/adc.html
@@ -404,10 +362,15 @@ sensor:
pin: A0
unit_of_measurement: "V"
accuracy_decimals: 6
update_interval: 10s
update_interval: 30s
#retain: true #retain useful if sleeping
filters:
- heartbeat: 30s
- multiply: 5.223 # tested with multimeter
- sliding_window_moving_average:
window_size: 2 #2x 30s = 60s average period
send_every: 1
send_first_at: 1
- calibrate_linear:
- 3.321 -> 3.125
- 3.89 -> 3.90
@@ -427,7 +390,7 @@ sensor:
return id(battery_voltage).state; //grabs values from the battery_voltage
filters:
- sliding_window_moving_average:
window_size: 40 #40x 30s = 20 min average period
window_size: 60 #40x 30s = 20 min average period
send_every: 1
send_first_at: 1
@@ -440,12 +403,13 @@ sensor:
id: battery_voltage_recentmax
unit_of_measurement: "V"
accuracy_decimals: 6
update_interval: 30s #updates every 30s
update_interval: 30s #updates every 10s
lambda: >
return id(battery_voltage).state; //grabs values from the battery_voltage
filters:
- heartbeat: 30s
- max:
window_size: 40 #40x 30s = 20 min average period
window_size: 60 #60x 30s = 30 min max value
send_every: 1
send_first_at: 1
@@ -458,7 +422,6 @@ sensor:
lambda: >
return {id(battery_voltage_recentmax).state - id(battery_voltage).state}; //recent av voltage - now
- platform: duty_time
id: battery_discharge_time
name: ${friendly_name} Time battery is discharging
@@ -472,21 +435,179 @@ sensor:
lambda: >
return { id(battery_voltage).state <= id(battery_voltage_recentav).state };
#############################################
# WIND SENSOR
# looks like this one
# https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf
#############################################
#############################################
# USEFUL LINKS
# Wind Sensing
# https://community.home-assistant.io/t/measuring-wind-speed/395693/20
# https://community.home-assistant.io/t/measuring-wind-speed/395693/21
#############################################
################################
# RAIN SENSOR
# Pulse Meter for measuring rainfall
# https://esphome.io/components/sensor/pulse_meter.html
################################
# CALIBRATION HINTS
# https://forum.mysensors.org/topic/9594/misol-rain-gauge-tipping-bucket-rain-amount/2
################################
- platform: pulse_meter
id: rainfall_meter
pin:
number: GPIO12 #D6 on D1 Mini
mode:
input: true
pullup: true
internal_filter_mode: EDGE
internal_filter: 10ms
name: ${friendly_name} Rainfall
#icon: mdi:
unit_of_measurement: "mm"
accuracy_decimals: 1
timeout: 5s
filters:
- heartbeat: 2s
#- timeout:
# timeout: "5s" #after 5 seconds, if no pulses received....
# value: 0 #make the value = 0
- multiply: 0.2794 #mm of rain from tip bucket, 0.28 mm per pulse, or 3.57 pulse per mm (NEEDS CALIBRATION)
- sliding_window_moving_average: # Moving average to prevent too many data points
window_size: 4
send_every: 1
#- clamp:
# min_value: 0
# max_value: 250 #if anything over that, we have debounce issues or are going to die
# ignore_out_of_range: true
################################
# Pulse Meter for measuring wind speed
# Analog sensor for voltage reading
# https://esphome.io/components/sensor/pulse_meter.html
#
# This Anenometer https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf
# The cup-type anemometer measures wind speed by closing a contact
# as a magnet moves past a reed switch. A wind speed of 1.492mph (2.4km/h) (0.667m/s)
# causes the switch to close once per second. The reed switch closes twice per revolution.
# 1rps = 60rpm = 2.4kmh
# 1pulse/min = 2.4kmh/60 = 0.04kmh
# Pulse meter component measures the time between rising edges on a pin,
# for each pulse it outputs the frequency in pulses/min.
################################
# USEFUL LINKS
# https://community.home-assistant.io/t/measuring-wind-speed/395693/20
# https://community.home-assistant.io/t/measuring-wind-speed/395693/21
#############################################
- platform: pulse_meter # https://community.home-assistant.io/t/measuring-wind-speed/395693
id: wind_meter
pin:
number: GPIO14 #D5 on D1 Mini
mode:
input: true
pullup: true
#internal: true # If true, don't send to HA/MQTT etc
internal_filter_mode: EDGE
internal_filter: 10ms
name: ${friendly_name} Wind speed
icon: "mdi:weather-windy"
unit_of_measurement: "km/h"
accuracy_decimals: 1
timeout: 5s
filters:
- heartbeat: 2s
#- timeout:
# timeout: "5s" #after 5 seconds, if no pulses received....
# value: 0 #make the value = 0
- multiply: 0.04 #kmh
- sliding_window_moving_average: # Moving average to prevent too many data points
window_size: 4
send_every: 1
- clamp:
min_value: 0
max_value: 250 #if anything over that, we have debounce issues or are going to die
ignore_out_of_range: true
# - platform: pulse_counter
# # https://community.home-assistant.io/t/measuring-wind-speed/395693
# id: wind_pulses
# pin:
# number: GPIO14 #D5 on D1 Mini
# mode:
# input: true
# pullup: true
################################
# WIND 10 MINUTE MAX
# Template for wind gust measurements
# To measure GUST properly, the World Meteorological Organization
# recommends gust measurement should be wind speed averages over
# 3 second periods and report the maximum of these averages
# within a sliding window of the last 10 minutes.
# This needs a wind speed history buffer of 200 samples
# (200 x 3 second average = 10 minutes)
################################
# Useful links
# https://community.home-assistant.io/t/adding-an-old-marine-anemometer-to-ha/337842
################################
- platform: template
name: ${friendly_name} Windspeed Gust (Max last 10m)
unit_of_measurement: "km/h"
update_interval: 3s #updates every 2s
lambda: >
return id(wind_meter).state; //grabs values from the wind_sensor
filters:
- filter_out: nan #in case there is no value
- max:
window_size: 200 #10 Min window as 3s update x 200 = 10min
send_every: 1 #updates on the 1st 2s check
send_first_at: 1 #on restart, send after first 10s
################################
# BEAUFORT SCALE
# Template for Beaufort for measuring wind speed
# The output updates the Text Sensor ID wind_scale
# https://windy.app/blog/wind-speed-beaufort-scale.html
################################
- platform: template
#name: ${friendly_name} Windspeed Scale
internal: true # no need to show this externally as it is just for calculating Beaufort
#icon: "mdi:weather-windy"
id: wind_meter_scale
lambda: return id(wind_meter).state;
#unit_of_measurement: "m/s"
update_interval: 5s
filters:
- throttle_average: 5s
- multiply: 0.278 #to get m/s from km/h
on_value:
lambda: |-
if (id(wind_meter_scale).state < 0.1) {
id(wind_scale).publish_state("Calm");
} else if (id(wind_meter_scale).state > 0 && id(wind_meter_scale).state < 2) {
id(wind_scale).publish_state("Light Air");
} else if (id(wind_meter_scale).state >= 2 && id(wind_meter_scale).state < 3) {
id(wind_scale).publish_state("Light Breeze");
} else if (id(wind_meter_scale).state >= 3 && id(wind_meter_scale).state < 5) {
id(wind_scale).publish_state("Gentle Breeze");
} else if (id(wind_meter_scale).state >= 5 && id(wind_meter_scale).state < 8) {
id(wind_scale).publish_state("Moderate Breeze");
} else if (id(wind_meter_scale).state >= 8 && id(wind_meter_scale).state < 11) {
id(wind_scale).publish_state("Fresh Breeze");
} else if (id(wind_meter_scale).state >= 11 && id(wind_meter_scale).state < 14) {
id(wind_scale).publish_state("Strong Breeze");
} else if (id(wind_meter_scale).state >= 14 && id(wind_meter_scale).state < 17) {
id(wind_scale).publish_state("Near Gale");
} else if (id(wind_meter_scale).state >= 17 && id(wind_meter_scale).state < 21) {
id(wind_scale).publish_state("Gale");
} else if (id(wind_meter_scale).state >= 21 && id(wind_meter_scale).state < 24) {
id(wind_scale).publish_state("Severe Gale");
} else if (id(wind_meter_scale).state >= 24 && id(wind_meter_scale).state < 28) {
id(wind_scale).publish_state("Storm");
} else if (id(wind_meter_scale).state >= 28 && id(wind_meter_scale).state < 33) {
id(wind_scale).publish_state("Violent Storm");
} else if (id(wind_meter_scale).state >= 33) {
id(wind_scale).publish_state("Hurricane Force");
} else {
id(wind_scale).publish_state("");
}
#############################################
# WIND DIRECTION SENSOR
# looks like this one
# https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf
# uses black and green cables for R value
#############################################
# Wind Direction, Analogue on ADS115
# Analog sensor for voltage reading
# https://esphome.io/components/sensor/ads1115.html
@@ -497,12 +618,21 @@ sensor:
# values giving the output voltage value for each azimuth.
# We could also report a compass direction.
################################
# Useful Links
# https://community.home-assistant.io/t/davis-wind-direction-equipment-and-esp-home/508764
################################
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
gain: 4.096
name: ${friendly_name} Wind Direction
id: wind_direction
update_interval: 5s
update_interval: 2s
# measured V Max: 3.31 Min: 0.585
#- calibrate_linear
# Map 0.0 (from sensor) to 0.0 (true value)
# - 0.585 -> 0
# - 3.31 -> 100
# filters:
# lambda: |-
# if( (x * (360.0/5.0)) >= 10.0 && (x * (360.0/5.0)) <= 70.0 ) { return x = 45 };
@@ -554,82 +684,6 @@ sensor:
# - platform: pulse_meter
# pin:
# number: GPIO13 #This is Pin D7 on the D1 Mini ESP8266
# mode:
# input: true
# pullup: true
# name: ${friendly_name} Wind speed
# id: wind_meter
# unit_of_measurement: m/s
# accuracy_decimals: 1
# timeout: 5s
# internal_filter_mode: EDGE
# internal_filter: 10ms
# A wind speed of 2.4km/h (1.492mph) causes the switch to close once per second.
# that is 0.667m/s.
# Switch closes twice per revolution
# rotations_per_sec = pulses / 2 / 60
# circ_m = 0.09 * 2 * 3.14 = 0.5652
# mps = 1.18 * circ_m * rotations_per_sec
# mps = 1.18 * (0.5652 / 2 / 60) = 0.0055578
#
# filters:
# # - multiply: 0.0055578 #use for m/s
# # - multiply: 2.237 #m/s to mph
# # - multiply: 0.0124327986 #m/s * mph conversion
# # - multiply: ? #m/s to kph
# - multiply: 0.0055578
# - sliding_window_moving_average: # Helps prevent too many datapoints
# window_size: 10
# send_every: 10
################################
# Pulse Meter for measuring wind speed
# Analog sensor for voltage reading
# https://esphome.io/components/sensor/pulse_meter.html
#
# This Anenometer https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf
#
# The cup-type anemometer measures wind speed by closing a contact
# as a magnet moves past a reed switch. A wind speed of 1.492mph (2.4km/h) (0.667m/s)
# causes the switch to close once per second. The reed switch closes twice per revolution.
# 1rps = 60rpm = 2.4kmh
# 1pulse/min = 2.4kmh/60 = 0.04kmh
# Pulse meter component measures the time between rising edges on a pin,
# for each pulse it outputs the frequency in pulses/min.
################################
- platform: pulse_meter # https://community.home-assistant.io/t/measuring-wind-speed/395693
id: wind_meter
pin:
number: GPIO14 #D5 on D1 Mini
mode:
input: true
pullup: true
#internal: true # If true, don't send to HA/MQTT etc
internal_filter_mode: EDGE
internal_filter: 10ms
name: ${friendly_name} Wind speed
icon: "mdi:weather-windy"
unit_of_measurement: "km/h"
accuracy_decimals: 1
timeout: 5s
filters:
- heartbeat: 2s
#- timeout:
# timeout: "5s" #after 5 seconds, if no pulses received....
# value: 0 #make the value = 0
- multiply: 0.04 #kmh
- sliding_window_moving_average: # Moving average to prevent too many data points
window_size: 4
send_every: 1
- clamp:
min_value: 0
max_value: 250 #if anything over that, we have debounce issues or are going to die
ignore_out_of_range: true
# on_value:
# lambda: |-
@@ -665,18 +719,7 @@ sensor:
# - throttle: 30s
- platform: template
name: ${friendly_name} Windspeed Gust (Max last 10m)
unit_of_measurement: "km/h"
update_interval: 2s #updates every 2s
lambda: >
return id(wind_meter).state; //grabs values from the wind_sensor
filters:
- filter_out: nan #in case there is no value
- max:
window_size: 300 #10 Min window as 2s update x 300 = 10min
send_every: 1 #updates on the 1st 2s check
send_first_at: 1 #on restart, send after first 10s
# https://www.reddit.com/r/Esphome/comments/kndues/take_max_value_over_time/
@@ -791,66 +834,40 @@ sensor:
# id: id_wind_speed_avg_10min
# - platform: pulse_meter
# pin:
# number: GPIO13 #This is Pin D7 on the D1 Mini ESP8266
# mode:
# input: true
# pullup: true
# name: ${friendly_name} Wind speed
# id: wind_meter
# unit_of_measurement: m/s
# accuracy_decimals: 1
# timeout: 5s
# internal_filter_mode: EDGE
# internal_filter: 10ms
# A wind speed of 2.4km/h (1.492mph) causes the switch to close once per second.
# that is 0.667m/s.
# Switch closes twice per revolution
# rotations_per_sec = pulses / 2 / 60
# circ_m = 0.09 * 2 * 3.14 = 0.5652
# mps = 1.18 * circ_m * rotations_per_sec
# mps = 1.18 * (0.5652 / 2 / 60) = 0.0055578
#
# filters:
# # - multiply: 0.0055578 #use for m/s
# # - multiply: 2.237 #m/s to mph
# # - multiply: 0.0124327986 #m/s * mph conversion
# # - multiply: ? #m/s to kph
# - multiply: 0.0055578
# - sliding_window_moving_average: # Helps prevent too many datapoints
# window_size: 10
# send_every: 10
################################
# Averaging for the various temp sensors on board
################################
- platform: template
name: ${friendly_name} Temp (av)
icon: "mdi:thermometer"
unit_of_measurement: "°C"
lambda: |-
return (
id(bmp280_temp).state
+
id(dht_temp).state
) / 2;
################################
# Template for Beaufort for measuring wind speed
# https://windy.app/blog/wind-speed-beaufort-scale.html
################################
- platform: template
name: ${friendly_name} Windspeed Scale
icon: "mdi:weather-windy"
id: wind_meter_scale
lambda: return id(wind_meter).state;
unit_of_measurement: "m/s"
update_interval: 5s
filters:
- throttle_average: 5s
- multiply: 0.278 #to get m/s from km/h
on_value:
lambda: |-
if (id(wind_meter_scale).state < 0.1) {
id(wind_scale).publish_state("Calm");
} else if (id(wind_meter_scale).state > 0 && id(wind_meter_scale).state < 2) {
id(wind_scale).publish_state("Light Air");
} else if (id(wind_meter_scale).state >= 2 && id(wind_meter_scale).state < 3) {
id(wind_scale).publish_state("Light Breeze");
} else if (id(wind_meter_scale).state >= 3 && id(wind_meter_scale).state < 5) {
id(wind_scale).publish_state("Gentle Breeze");
} else if (id(wind_meter_scale).state >= 5 && id(wind_meter_scale).state < 8) {
id(wind_scale).publish_state("Moderate Breeze");
} else if (id(wind_meter_scale).state >= 8 && id(wind_meter_scale).state < 11) {
id(wind_scale).publish_state("Fresh Breeze");
} else if (id(wind_meter_scale).state >= 11 && id(wind_meter_scale).state < 14) {
id(wind_scale).publish_state("Strong Breeze");
} else if (id(wind_meter_scale).state >= 14 && id(wind_meter_scale).state < 17) {
id(wind_scale).publish_state("Near Gale");
} else if (id(wind_meter_scale).state >= 17 && id(wind_meter_scale).state < 21) {
id(wind_scale).publish_state("Gale");
} else if (id(wind_meter_scale).state >= 21 && id(wind_meter_scale).state < 24) {
id(wind_scale).publish_state("Severe Gale");
} else if (id(wind_meter_scale).state >= 24 && id(wind_meter_scale).state < 28) {
id(wind_scale).publish_state("Storm");
} else if (id(wind_meter_scale).state >= 28 && id(wind_meter_scale).state < 33) {
id(wind_scale).publish_state("Violent Storm");
} else if (id(wind_meter_scale).state >= 33) {
id(wind_scale).publish_state("Hurricane Force");
} else {
id(wind_scale).publish_state("");
}
#switch:
# - platform: template
@@ -918,39 +935,68 @@ sensor:
# restore_value: no
# initial_value: '0.0'
################################
# Pulse Meter for measuring rainfall
# https://esphome.io/components/sensor/pulse_meter.html
#
################################
# CALIBRATION HINTS
# https://forum.mysensors.org/topic/9594/misol-rain-gauge-tipping-bucket-rain-amount/2
# BME280 temp/humidity/pressure (Note, BME and BMP Are different...)
# https://esphome.io/cookbook/bme280_environment.html
################################
- platform: pulse_meter
id: rainfall_meter
pin:
number: GPIO12 #D6 on D1 Mini
mode:
input: true
pullup: true
#internal: true # If true, don't send to HA/MQTT etc
internal_filter_mode: EDGE
internal_filter: 10ms
name: ${friendly_name} Rainfall
#icon: mdi:
unit_of_measurement: "mm"
accuracy_decimals: 1
timeout: 5s
filters:
- heartbeat: 2s
#- timeout:
# timeout: "5s" #after 5 seconds, if no pulses received....
# value: 0 #make the value = 0
- multiply: 0.2794 #mm of rain from tip bucket, 0.28 mm per pulse, or 3.57 pulse per mm (NEEDS CALIBRATION)
- sliding_window_moving_average: # Moving average to prevent too many data points
window_size: 4
send_every: 1
#- clamp:
# min_value: 0
# max_value: 250 #if anything over that, we have debounce issues or are going to die
# ignore_out_of_range: true
#- platform: bme280_i2c
# address: 0x76
# update_interval: ${update_time}
# temperature:
# name: ${friendly_name} BME280 Temp
# accuracy_decimals: 1
# oversampling: 2x
# unit_of_measurement: "°C"
# #retain: true #MQTT retain useful if sleeping
# pressure:
# name: ${friendly_name} BME280 Pressure
# oversampling: 2x
# unit_of_measurement: "hPa"
# #retain: true #MQTT retain useful if sleeping
# humidity:
# name: ${friendly_name} BME280 Humidity
# accuracy_decimals: 1
# oversampling: 2x
# unit_of_measurement: "%"
# #retain: true #MQTT retain useful if sleeping
################################
# TSL2561 ambient light sensor
# https://esphome.io/components/sensor/tsl2561.html
################################
#- platform: tsl2561
# name: ${friendly_name} Ambient Light
# address: 0x39
# update_interval: 60s
################################
# LTR390 Ambient Light and UV Sensor
# https://esphome.io/components/sensor/ltr390.html
################################
#- platform: ltr390
# address: 0x35
# uv_index:
# name: ${friendly_name} 390 UV Index
# uv:
# name: ${friendly_name} 390 UV Sensor Counts
# light:
# name: ${friendly_name} 390 Light
# ambient_light:
# name: ${friendly_name} 390 UV Sensor Counts
# update_interval: 60s
################################
# PMSX003 Particulate sensor
# NEEDS UART SET FIRST
# https://esphome.io/components/sensor/pmsx003.html
################################
#- platform: pmsx003
# type: PMSX003
# pm_1_0:
# name: ${friendly_name} Particulate Matter <1.0µm
# pm_2_5:
# name: ${friendly_name} <2.5µm
# pm_10_0:
# name: ${friendly_name} <10.0µm Concentration