esphome device updates
This commit is contained in:
+217
-304
@@ -1,18 +1,19 @@
|
||||
#############################################
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
#######################################################################################################
|
||||
# Opengreen energy weather station board, with ESP8266 D1 Mini
|
||||
# https://www.opengreenenergy.com/solar-powered-wifi-weather-station-v2-0/
|
||||
# zorruno 2024-05-04 V0.0 Untested
|
||||
# zorruno 2024-05-23 V1.0 Tidied up sensor info and added BMP280
|
||||
# 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
|
||||
# zorruno 2025-09-12 V6 fixes: AP SSID sub; ADC calibrate indent; NaN-safe temp avg; empty-string publishes; improved 10min gust (3s avg -> 10m max); comment tidy-ups
|
||||
# zorruno 2024-06-14 V5 added wind heading, and sorted breaking a change for OTA
|
||||
#############################################
|
||||
#############################################
|
||||
# zorruno 2024-06-03 V4 tweaks to battery and wind
|
||||
# zorruno 2024-05-25 V3 Shuffled some sensors, rain count added
|
||||
# zorruno 2024-05-25 V2 A bunch more sensors added (wind direction not yet sorted)
|
||||
# zorruno 2024-05-24 V1.1 Tested ok and added some V calibration for mine
|
||||
# zorruno 2024-05-23 V1.0 Tidied up sensor info and added BMP280
|
||||
# zorruno 2024-05-04 V0.0 Untested
|
||||
#######################################################################################################
|
||||
#######################################################################################################
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# SENSORS INCLUDED
|
||||
#
|
||||
# TESTED WORKING
|
||||
@@ -55,43 +56,43 @@
|
||||
# soil temp
|
||||
# soil moisture
|
||||
#
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# WEMOS D1 Mini GPIO, and Weather station Use
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# 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
|
||||
# D4, GPIO2 connected to on-board LED, boot fails if pulled LOW
|
||||
# D5, GPIO14 Used as Wind Speed Count
|
||||
# D6, GPIO12 Used as Rainfall count
|
||||
# D7, GPIO13 Used for DHT
|
||||
# D8, GPIO15 (Boot fails if pulled HIGH)
|
||||
# D1, GPIO5 Used as SCL (I2C)
|
||||
# D2, GPIO4 Used as SDA (I2C)
|
||||
# D3, GPIO0 connected to FLASH button, boot fails if pulled LOW
|
||||
# D4, GPIO2 connected to on-board LED, boot fails if pulled LOW
|
||||
# D5, GPIO14 Used as Wind Speed Count
|
||||
# D6, GPIO12 Used as Rainfall count
|
||||
# D7, GPIO13 Used for DHT
|
||||
# D8, GPIO15 (Boot fails if pulled HIGH)
|
||||
#
|
||||
# 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)
|
||||
# A0, ADC0 Used here to measure battery V
|
||||
# D0, GPIO16 (used to wake up from deep sleep)
|
||||
# RX, GPIO3 (HIGH at boot)
|
||||
# TX, GPIO1 (HIGH at boot, boot fails if pulled LOW)
|
||||
# A0, ADC0 Used here to measure battery V
|
||||
#
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# Pulse Meter Issues 202405
|
||||
# https://github.com/esphome/issues/issues/4807
|
||||
# https://github.com/esphome/issues/issues/3143
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
external_components:
|
||||
- source: github://TrentHouliston/esphome@loop_pulse_isr
|
||||
components: [ pulse_meter ]
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# Variable Substitutions
|
||||
# Give this a useful name & description here
|
||||
# and change values accordingly
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
substitutions:
|
||||
devicename: "esp-weatherstation"
|
||||
friendly_name: "Weather Station"
|
||||
@@ -109,22 +110,22 @@ substitutions:
|
||||
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
|
||||
update_time: 30s #update time for for various temp sensors etc
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# ESPHome
|
||||
# https://esphome.io/components/esphome.html
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
esphome:
|
||||
name: ${devicename}
|
||||
comment: ${description_comment} #appears on the esphome page in HA
|
||||
#on_boot: #Initial Setting stuff
|
||||
#priority: -200
|
||||
#then:
|
||||
# priority: -200
|
||||
# then:
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# ESP Platform and Framework
|
||||
# https://esphome.io/components/esp32.html OR
|
||||
# https://esphome.io/components/esp8266.html
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
#esp32:
|
||||
# board:
|
||||
# framework:
|
||||
@@ -135,12 +136,12 @@ esphome:
|
||||
esp8266:
|
||||
board: d1_mini
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# i2c bus
|
||||
# https://esphome.io/components/i2c.html
|
||||
# Put the relevant pins here, 4/5 are default for ESP8266
|
||||
# and 21/22 for esp32 (although esp32 can have two buses)
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
i2c:
|
||||
sda: GPIO4
|
||||
scl: GPIO5
|
||||
@@ -194,11 +195,11 @@ wifi:
|
||||
password: ${wifi_pass}
|
||||
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
|
||||
#manual_ip: #optional static IP address
|
||||
#static_ip: 192.168.x.x
|
||||
#gateway: 192.168.X.x
|
||||
#subnet: 255.255.255.0
|
||||
# static_ip: 192.168.x.x
|
||||
# gateway: 192.168.X.x
|
||||
# subnet: 255.255.255.0
|
||||
ap: #Details for fallback hotspot in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode
|
||||
ssid: $devicename fallback AP
|
||||
ssid: "${devicename} fallback AP"
|
||||
password: !secret fallback_ap_password
|
||||
ap_timeout: 30min #default is 1min
|
||||
|
||||
@@ -214,14 +215,14 @@ wifi:
|
||||
#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
|
||||
# username: !secret web_server_username #probably a good idea to secure it
|
||||
# password: !secret web_server_password
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# MQTT Monitoring
|
||||
# https://esphome.io/components/mqtt.html?highlight=mqtt
|
||||
# MUST also have api enabled if you enable MQTT
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
mqtt:
|
||||
broker: ${mqtt_server}
|
||||
topic_prefix: ${mqtt_topic}/${devicename}
|
||||
@@ -230,14 +231,14 @@ mqtt:
|
||||
|
||||
#Method to prevent deep sleep using MQTT command
|
||||
#on_message:
|
||||
# - topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
# payload: 'ON'
|
||||
# then:
|
||||
# - deep_sleep.prevent: deep_sleep_1
|
||||
# - topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
# payload: 'ON'
|
||||
# then:
|
||||
# - deep_sleep.enter: deep_sleep_1
|
||||
# - topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
# payload: 'ON'
|
||||
# then:
|
||||
# - deep_sleep.prevent: deep_sleep_1
|
||||
# - topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
# payload: 'ON'
|
||||
# then:
|
||||
# - deep_sleep.enter: deep_sleep_1
|
||||
|
||||
########################################
|
||||
# Deep Sleep
|
||||
@@ -248,29 +249,30 @@ mqtt:
|
||||
# sleep_duration: 10min
|
||||
# id: deep_sleep_1
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# General espHome status LED
|
||||
# Not needed, but can be useful to see issues
|
||||
# https://esphome.io/components/status_led.html
|
||||
#############################################
|
||||
# If the LED appears inverted (on when it should be off), set 'inverted: true'.
|
||||
#######################################################################################################
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO2 #Wemos ESP32 and ESP8266 Onboard LEDs use GPIO2
|
||||
inverted: false
|
||||
#ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
|
||||
|
||||
################################
|
||||
##########################################################################################
|
||||
# 4 Input A->D sensor
|
||||
# Analog sensor for voltage reading
|
||||
# https://esphome.io/components/sensor/ads1115.html
|
||||
################################
|
||||
##########################################################################################
|
||||
ads1115:
|
||||
- address: 0x48 #On the ADS1115 pull address pin to VCC for 0x49. Default is 0x48
|
||||
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
# Text Sensors
|
||||
# https://esphome.io/components/text_sensor/index.html
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
text_sensor:
|
||||
- platform: template
|
||||
name: ${friendly_name} Beaufort Wind Scale
|
||||
@@ -283,17 +285,17 @@ text_sensor:
|
||||
id: wind_dir_heading
|
||||
update_interval: never
|
||||
|
||||
#############################################
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
#######################################################################################################
|
||||
# General Sensors
|
||||
# https://esphome.io/components/sensor/index.html
|
||||
#############################################
|
||||
#############################################
|
||||
#######################################################################################################
|
||||
#######################################################################################################
|
||||
sensor:
|
||||
|
||||
################################
|
||||
# UPTIME
|
||||
# Device uptime info
|
||||
# Device uptime info
|
||||
# https://esphome.io/components/sensor/uptime.html
|
||||
################################
|
||||
- platform: uptime
|
||||
@@ -316,7 +318,7 @@ sensor:
|
||||
################################
|
||||
- platform: bmp280
|
||||
address: 0x76
|
||||
iir_filter: 16X
|
||||
iir_filter: 16x
|
||||
update_interval: ${update_time}
|
||||
temperature:
|
||||
name: ${friendly_name} BMP280 Temperature
|
||||
@@ -327,7 +329,7 @@ sensor:
|
||||
pressure:
|
||||
name: ${friendly_name} BMP280 Pressure
|
||||
unit_of_measurement: "hPa"
|
||||
oversampling: 16X
|
||||
oversampling: 16x
|
||||
#retain: true #MQTT retain useful if sleeping
|
||||
|
||||
################################
|
||||
@@ -356,11 +358,14 @@ sensor:
|
||||
icon: "mdi:thermometer"
|
||||
unit_of_measurement: "°C"
|
||||
lambda: |-
|
||||
return (
|
||||
id(bmp280_temp).state
|
||||
+
|
||||
id(dht_temp).state
|
||||
) / 2;
|
||||
const float a = id(bmp280_temp).state;
|
||||
const float b = id(dht_temp).state;
|
||||
const bool va = !isnan(a);
|
||||
const bool vb = !isnan(b);
|
||||
if (va && vb) return (a + b) / 2.0f;
|
||||
if (va) return a;
|
||||
if (vb) return b;
|
||||
return NAN;
|
||||
|
||||
################################
|
||||
# BATTERY VOLTAGE
|
||||
@@ -384,9 +389,9 @@ sensor:
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
- calibrate_linear:
|
||||
- 3.321 -> 3.125
|
||||
- 3.89 -> 3.90
|
||||
- 4.09 -> 4.14
|
||||
- 3.321 -> 3.125
|
||||
- 3.89 -> 3.90
|
||||
- 4.09 -> 4.14
|
||||
|
||||
################################
|
||||
# A Calculation of recent Av V
|
||||
@@ -398,30 +403,30 @@ sensor:
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 6
|
||||
update_interval: 30s #updates every 30s
|
||||
lambda: >
|
||||
lambda: |-
|
||||
return id(battery_voltage).state; //grabs values from the battery_voltage
|
||||
filters:
|
||||
- sliding_window_moving_average:
|
||||
window_size: 60 #40x 30s = 20 min average period
|
||||
window_size: 60 #60x 30s = 30 min average period
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
|
||||
################################
|
||||
# A Calculation of recent Max V
|
||||
##########################################################################################
|
||||
# A Calculation of 10 min Max V
|
||||
# So we can see if battery is charging/discharging
|
||||
################################
|
||||
##########################################################################################
|
||||
- platform: template
|
||||
name: ${friendly_name} Max Battery Voltage over recent period
|
||||
id: battery_voltage_recentmax
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 6
|
||||
update_interval: 30s #updates every 10s
|
||||
lambda: >
|
||||
update_interval: 30s #updates every 30s
|
||||
lambda: |-
|
||||
return id(battery_voltage).state; //grabs values from the battery_voltage
|
||||
filters:
|
||||
- heartbeat: 30s
|
||||
- max:
|
||||
window_size: 60 #60x 30s = 30 min max value
|
||||
window_size: 20 # 20 x 30s = 10 min max value (was 60 = 30 min)
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
|
||||
@@ -431,8 +436,8 @@ sensor:
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 5
|
||||
update_interval: 30s #updates every 30s
|
||||
lambda: >
|
||||
return {id(battery_voltage_recentmax).state - id(battery_voltage).state}; //recent av voltage - now
|
||||
lambda: |-
|
||||
return id(battery_voltage_recentmax).state - id(battery_voltage).state; //recent max voltage - now
|
||||
|
||||
- platform: duty_time
|
||||
id: battery_discharge_time
|
||||
@@ -444,17 +449,17 @@ sensor:
|
||||
filters:
|
||||
- multiply: 0.01666666
|
||||
- round: 0
|
||||
lambda: >
|
||||
return { id(battery_voltage).state <= id(battery_voltage_recentav).state };
|
||||
lambda: |-
|
||||
return id(battery_voltage).state <= id(battery_voltage_recentav).state;
|
||||
|
||||
################################
|
||||
##########################################################################################
|
||||
# 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:
|
||||
@@ -483,20 +488,20 @@ sensor:
|
||||
# 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
|
||||
# This Anemometer 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,
|
||||
# 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
|
||||
@@ -530,44 +535,55 @@ sensor:
|
||||
max_value: 250 #if anything over that, we have debounce issues or are going to die
|
||||
ignore_out_of_range: 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
|
||||
################################
|
||||
##########################################################################################
|
||||
# WIND GUSTS – WMO-style 10-minute gust
|
||||
# Per WMO guidance, "gust" ≈ maximum of 3-second mean wind over the last 10 minutes.
|
||||
# Implementation:
|
||||
# 1) Compute a 3 s sliding average (updated every 1 s) from wind_meter.
|
||||
# 2) Take the rolling maximum of that 3 s average over the last 10 minutes.
|
||||
##########################################################################################
|
||||
- platform: template
|
||||
id: wind_speed_3s_avg
|
||||
name: ${friendly_name} Wind speed (3s avg)
|
||||
unit_of_measurement: "km/h"
|
||||
icon: "mdi:weather-windy"
|
||||
update_interval: 1s
|
||||
lambda: |-
|
||||
return id(wind_meter).state; // sample latest wind speed
|
||||
filters:
|
||||
- filter_out: nan
|
||||
- sliding_window_moving_average:
|
||||
window_size: 3 # 3 samples x 1s = 3 s average
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
|
||||
- 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
|
||||
icon: "mdi:weather-windy"
|
||||
update_interval: 1s
|
||||
lambda: |-
|
||||
return id(wind_speed_3s_avg).state; # use the 3 s average stream
|
||||
filters:
|
||||
- filter_out: nan #in case there is no value
|
||||
- filter_out: nan
|
||||
- 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
|
||||
window_size: 600 # 600 x 1s = 10 minutes rolling window
|
||||
send_every: 1
|
||||
send_first_at: 3 # after first 3 s average becomes meaningful
|
||||
|
||||
################################
|
||||
##########################################################################################
|
||||
# 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;
|
||||
lambda: |-
|
||||
return id(wind_meter).state;
|
||||
#unit_of_measurement: "m/s"
|
||||
update_interval: 5s
|
||||
filters:
|
||||
@@ -602,7 +618,7 @@ sensor:
|
||||
} else if (id(wind_meter_scale).state >= 33) {
|
||||
id(wind_scale).publish_state("Hurricane Force");
|
||||
} else {
|
||||
id(wind_scale).publish_state({""});
|
||||
id(wind_scale).publish_state("");
|
||||
}
|
||||
|
||||
#############################################
|
||||
@@ -614,69 +630,114 @@ sensor:
|
||||
# Wind Direction, Analogue on ADS115
|
||||
# Analog sensor for voltage reading
|
||||
# https://esphome.io/components/sensor/ads1115.html
|
||||
################################
|
||||
##########################################################################################
|
||||
# Using a analog wind direction sensor that has an output
|
||||
# of 0 - 5 V for 360° representing the position of the arrow
|
||||
# from the north pole. This is 5V divided by 8 resistor
|
||||
# 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: 4.096
|
||||
name: ${friendly_name} Wind Direction Voltage
|
||||
id: wind_direction_voltage
|
||||
update_interval: 2s
|
||||
|
||||
################################################################
|
||||
# CONVERT VOLTAGE TO HEADING
|
||||
# Version used here only has 8 heading points, some have 16.
|
||||
#
|
||||
# Bear R Head Meas'd Max Min
|
||||
# (deg) (Ohms) Volts V+1% V-1%
|
||||
# ---------------------------------------------
|
||||
# 0 33000 N 2.900 2.9290 2.8710
|
||||
# 22.5 6570 NNE
|
||||
# 45 8200 NE 2.108 2.1290 2.0869
|
||||
# 67.5 891 ENE
|
||||
# 90 1000 E 0.584 0.5898 0.5782
|
||||
# 112.5 688 ESE
|
||||
# 135 2200 SE 1.061 1.0716 1.0504
|
||||
# 157.5 1410 SSE
|
||||
# 180 3900 S 1.506 1.5211 1.4910
|
||||
# 202.5 3140 SSW
|
||||
# 225 16000 SW 2.560 2.5856 2.5344
|
||||
# 247.5 14120 WSW
|
||||
# 270 120000 W 3.186 3.2178 3.1541
|
||||
# 292.5 42120 WNW
|
||||
# 315 64900 NW 3.088 3.1188 3.0571
|
||||
# 337.5 21880 NNW
|
||||
################################################################
|
||||
on_value:
|
||||
lambda: |-
|
||||
if (id(wind_direction_voltage).state >= 0.57816 && id(wind_direction_voltage).state <= 0.58984) {
|
||||
const float v = x; // use current reading from on_value
|
||||
if (v >= 0.57816 && v <= 0.58984) {
|
||||
id(wind_dir_heading).publish_state("E");
|
||||
} else if (id(wind_direction_voltage).state >= 1.05039 && id(wind_direction_voltage).state <= 1.07161) {
|
||||
} else if (v >= 1.05039 && v <= 1.07161) {
|
||||
id(wind_dir_heading).publish_state("SE");
|
||||
} else if (id(wind_direction_voltage).state >= 1.49094 && id(wind_direction_voltage).state <= 1.52106) {
|
||||
} else if (v >= 1.49094 && v <= 1.52106) {
|
||||
id(wind_dir_heading).publish_state("S");
|
||||
} else if (id(wind_direction_voltage).state >= 2.08692 && id(wind_direction_voltage).state <= 2.12908) {
|
||||
} else if (v >= 2.08692 && v <= 2.12908) {
|
||||
id(wind_dir_heading).publish_state("NE");
|
||||
} else if (id(wind_direction_voltage).state >= 2.5344 && id(wind_direction_voltage).state <= 2.5856) {
|
||||
} else if (v >= 2.53440 && v <= 2.58560) {
|
||||
id(wind_dir_heading).publish_state("SW");
|
||||
} else if (id(wind_direction_voltage).state >= 2.871 && id(wind_direction_voltage).state <= 2.929) {
|
||||
} else if (v >= 2.87100 && v <= 2.92900) {
|
||||
id(wind_dir_heading).publish_state("N");
|
||||
} else if (id(wind_direction_voltage).state >= 3.05712 && id(wind_direction_voltage).state <= 3.11888) {
|
||||
} else if (v >= 3.05712 && v <= 3.11888) {
|
||||
id(wind_dir_heading).publish_state("NW");
|
||||
} else if (id(wind_direction_voltage).state >= 3.15414 && id(wind_direction_voltage).state <= 3.21786) {
|
||||
} else if (v >= 3.15414 && v <= 3.21786) {
|
||||
id(wind_dir_heading).publish_state("W");
|
||||
} else {
|
||||
id(wind_dir_heading).publish_state({});
|
||||
id(wind_dir_heading).publish_state("");
|
||||
}
|
||||
|
||||
##########################################################################################
|
||||
# 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
|
||||
|
||||
|
||||
##########################################################################################
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# filters:
|
||||
# lambda: |-
|
||||
@@ -797,88 +858,6 @@ sensor:
|
||||
# return {};
|
||||
|
||||
|
||||
# - platform: template
|
||||
# name: "Roof Wind Run daily"
|
||||
# icon: "mdi:weather-windy"
|
||||
# unit_of_measurement: "km"
|
||||
# accuracy_decimals: 3
|
||||
# update_interval: 30s
|
||||
# internal: true
|
||||
# lambda: |-
|
||||
# return id(g_wind_run_count)*0.000666982;
|
||||
# id: id_wind_run_daily_g
|
||||
|
||||
# - platform: template
|
||||
# name: "Roof Wind gust 10s"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# update_interval: 10s
|
||||
# id: id_wind_gust_10s
|
||||
# lambda: return id(g_WindGust_10s);
|
||||
#
|
||||
# - platform: template
|
||||
# name: "Roof Wind gust 60s"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# state_class: "measurement"
|
||||
# update_interval: 60s
|
||||
# id: id_wind_gust_60s
|
||||
# lambda: return id(g_WindGust_60s);
|
||||
|
||||
# - platform: template
|
||||
# name: "Roof Wind gust 10min"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# state_class: "measurement"
|
||||
# update_interval: 10min
|
||||
# id: id_wind_gust_10min
|
||||
# lambda: return id(g_WindGust_10min);
|
||||
|
||||
# - platform: template
|
||||
# name: "Roof Wind speed avg 1s"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# update_interval: 333ms
|
||||
# lambda: |-
|
||||
# return id(id_wind_speed).state;
|
||||
# filters:
|
||||
# throttle_average: 1s
|
||||
# id: id_wind_speed_avg_1s
|
||||
#
|
||||
# - platform: template
|
||||
# name: "Roof Wind speed avg 10s"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# update_interval: 333ms
|
||||
# lambda: |-
|
||||
# return id(id_wind_speed).state;
|
||||
# filters:
|
||||
# throttle_average: 10s
|
||||
# id: id_wind_speed_avg_10s
|
||||
#
|
||||
# - platform: template
|
||||
# name: "Roof Wind Speed Min 10s"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# id: id_wind_speed_min_10s
|
||||
#
|
||||
# - platform: template
|
||||
# name: "Roof Wind speed avg 1min"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# state_class: "measurement"
|
||||
# update_interval: '1s'
|
||||
# lambda: |-
|
||||
# return id(id_wind_speed).state;
|
||||
# filters:
|
||||
# - throttle_average: 1min
|
||||
# id: id_wind_speed_avg_1min
|
||||
#
|
||||
# - platform: template
|
||||
# name: "Roof Wind speed avg 10min"
|
||||
# unit_of_measurement: 'km/h'
|
||||
# state_class: "measurement"
|
||||
# update_interval: 1s
|
||||
# lambda: |-
|
||||
# return id(id_wind_speed).state;
|
||||
# filters:
|
||||
# - throttle_average: 10min
|
||||
# id: id_wind_speed_avg_10min
|
||||
|
||||
|
||||
# - platform: pulse_meter
|
||||
# pin:
|
||||
# number: GPIO13 #This is Pin D7 on the D1 Mini ESP8266
|
||||
@@ -979,69 +958,3 @@ sensor:
|
||||
# type: float
|
||||
# restore_value: no
|
||||
# initial_value: '0.0'
|
||||
|
||||
|
||||
################################
|
||||
# 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
|
||||
|
||||
|
||||
################################
|
||||
# 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
|
||||
Reference in New Issue
Block a user