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

@@ -120,14 +120,6 @@ mqtt:
# payload: offline # payload: offline
# A way to prevent deep sleep using MQTT command # A way to prevent deep sleep using MQTT command
on_message: on_message:
- topic: viewroad-commands/attobat/deepsleepoff
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_1
- topic: viewroad-commands/attobat/deepsleepon
payload: 'ON'
then:
- deep_sleep.enter: deep_sleep_1
- topic: viewroad-commands/attobat/deepsleep - topic: viewroad-commands/attobat/deepsleep
payload: 'OFF' payload: 'OFF'
then: then:

View File

@@ -1,16 +1,60 @@
############################################# #############################################
# Common #############################################
# Nissan Leaf 12V Battery Monitor
# Monitoring the status of a vehicle 12V battery with
# an esp8266 (D1 Mini). It will obviously only
# transmit when the vehicle is within wifi range.
# Voltage is measured with a resistor voltage divider
# into the analogue GPIO on the esp8266.
# https://zorruno.com/2022/vehicle-12v-battery-monitoring/
##############################################
# zorruno 2022-09-31 V1 Untested
# zorruno 2024-06-02 V2 YAML Tidyups
#############################################
#############################################
#############################################
# Variable Substitutions
# Give this a useful name & description here
# and change values accordingly
############################################# #############################################
substitutions: substitutions:
devicename: esp-leafbat2 devicename: "esp-leafbat2"
nice_devicename: "Leaf Battery Monitor 2" friendly_name: "Nissan Leaf 12V Battery Monitor"
description_comment: "Nissan Leaf 12V Battery Monitor (when home)"
#if NOT using a secrets file, just replace these with the passwords etc in speech marks
api_key: !secret esp-leafbat_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-leafbat_ota_pass #unfortunately you can't use substitutions in secrets names
#update_time: 30s #update time for for temp sensors etc
wifi_ssid: !secret wifi_ssid
wifi_pass: !secret wifi_password
#Add these if we are giving it a static ip, or remove them in the Wifi section
static_ip_address: !secret esp-leafbat_static_ip
static_ip_gateway: !secret esp-leafbat_gateway
static_ip_subnet: !secret esp-leafbat_subnet
mqtt_server: !secret mqtt_server
mqtt_username: !secret mqtt_username
mqtt_password: !secret mqtt_password
mqtt_topic: "esphome/esp-leafbat2" #main topic for the mqtt server, call it what you like
web_server_username: !secret web_server_username
web_server_password: !secret web_server_password
fallback_ap_ssid: "Esp-Leafbat2 Fallback Hotspot"
fallback_ap_password: !secret fallback_ap_password
############################################# #############################################
# ESPHome # ESPHome
############################################# #############################################
esphome: esphome:
name: $devicename name: ${devicename}
comment: ${description_comment} #appears on the esphome page in HA
######################################## ########################################
# Specific board for ESPHome device # Specific board for ESPHome device
@@ -28,7 +72,7 @@ logger:
######################################## ########################################
api: api:
encryption: encryption:
key: !secret esp-leafbat2_api_key key: ${api_key}
######################################## ########################################
# Enable Over the Air Update Capability # Enable Over the Air Update Capability
@@ -36,24 +80,24 @@ api:
######################################## ########################################
ota: ota:
safe_mode: true safe_mode: true
password: !secret esp-leafbat2_ota_pass password: ${ota_pass}
######################################## ########################################
# Use Wifi # Use Wifi
# (credentials are in secrets file) # (credentials are in secrets file)
######################################## ########################################
wifi: wifi:
ssid: !secret wifi_ssid ssid: ${wifi_ssid}
password: !secret wifi_password password: ${wifi_password}
# Details for fallback hotspot (captive portal) in case wifi connection fails # Details for fallback hotspot (captive portal) in case wifi connection fails
ap: ap:
ssid: "Esp-Leafbat2 Fallback Hotspot" ssid: ${fallback_ap_ssid}
password: !secret fallback_ap_password password: ${fallback_ap_password}
# Static IP (for lower power/quicker on time) # Static IP (for lower power/quicker on time)
manual_ip: manual_ip:
static_ip: !secret esp-leafbat2_static_ip static_ip: ${static_ip_address}
gateway: !secret esp-leafbat2_gateway gateway: ${static_ip_gateway}
subnet: !secret esp-leafbat2_subnet subnet: ${static_ip_subnet}
############################################# #############################################
# Fallback captive portal # Fallback captive portal
@@ -66,17 +110,17 @@ captive_portal:
web_server: web_server:
port: 80 port: 80
auth: auth:
username: !secret web_server_username username: ${web_server_username}
password: !secret web_server_password password: ${web_server_password}
######################################## ########################################
# MQTT Monitoring # MQTT Monitoring
######################################## ########################################
mqtt: mqtt:
broker: !secret mqtt_server broker: ${mqtt_server}
topic_prefix: esphome/esp-leafbat2 topic_prefix: ${mqtt_topic}
username: !secret mqtt_username username: ${mqtt_username}
password: !secret mqtt_password password: ${mqtt_password}
# #
# Availability Topic # Availability Topic
#birth_message: #birth_message:
@@ -87,11 +131,11 @@ mqtt:
# payload: offline # payload: offline
# A way to prevent deep sleep using MQTT command # A way to prevent deep sleep using MQTT command
on_message: on_message:
- topic: viewroad-commands/leafbat2/deepsleepoff - topic: viewroad-commands/leafbat2/deepsleep
payload: 'ON' payload: 'ON'
then: then:
- deep_sleep.prevent: deep_sleep_1 - deep_sleep.prevent: deep_sleep_1
- topic: viewroad-commands/leafbat2/deepsleepon - topic: viewroad-commands/leafbat2/deepsleep
payload: 'ON' payload: 'ON'
then: then:
- deep_sleep.enter: deep_sleep_1 - deep_sleep.enter: deep_sleep_1

View File

@@ -2,6 +2,8 @@
############################################# #############################################
############################################# #############################################
# HiLink LD1125H mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32 # HiLink LD1125H mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32
# https://zorruno.com/2024/mmwave-occupancy-with-esp32-ld1125h/
#
# https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/tree/main # https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/tree/main
# https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/blob/main/LD1125H/ESP32-LD1125H-Complete.yaml # https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/blob/main/LD1125H/ESP32-LD1125H-Complete.yaml
# #
@@ -16,16 +18,35 @@
############################################# #############################################
############################################# #############################################
# Variable Substitutions # VARIABLE SUBSTITUTIONS
# Give the device a useful name & description here
# and change values accordingly.
############################################# #############################################
substitutions: substitutions:
devicename: "esp-occupancyoffice" devicename: "esp-occupancyoffice"
friendly_name: "Office State" friendly_name: "Office State"
description_comment: "D1 Mini ESP32 with LD1125H mmWave and environment sensors for downstairs office" description_comment: "D1 Mini ESP32 with LD1125H mmWave and environment sensors for downstairs office"
api_key: !secret esp-occupancyoffice_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-occupancyoffice_ota_pass #unfortunately you can't use substitutions in secrets names #if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-occupancyoffice_api_key #unfortunately you can't use substitutions inside secrets names
ota_pass: !secret esp-occupancyoffice_ota_pass #unfortunately you can't use substitutions inside secrets names
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
fallback_ap_password: !secret fallback_ap_password
#Add these if we are giving it a static ip, or remove them in the Wifi section
#static_ip_address: !secret esp-occupancyoffice_static_ip
#static_ip_gateway: !secret esp-occupancyoffice_gateway
#static_ip_subnet: !secret esp-occupancyoffice_subnet
mqtt_server: !secret mqtt_server
mqtt_username: !secret mqtt_username
mqtt_password: !secret mqtt_password
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
update_time: 30s #update time for for temp sensors etc
#web_server_username: !secret web_server_username
#web_server_password: !secret web_server_password
update_time: 30s #update time for for general temp sensors etc
############################################# #############################################
# ESPHome # ESPHome
@@ -67,7 +88,7 @@ esp32:
board: esp32dev board: esp32dev
framework: framework:
#type: arduino #type: arduino
type: esp-idf #Suggested Use ESP-IDF Framework, or Plug Out the UART Cable Might Cause ESP32 Hang. type: esp-idf #Suggest using the ESP-IDF Framework. Changing from arduino to esp-idf needs a cabled download to change partitions
version: recommended #recommended, latest or dev version: recommended #recommended, latest or dev
############################################# #############################################
@@ -83,12 +104,13 @@ i2c:
############################################# #############################################
# ESPHome external or custom components to use # ESPHome external or custom components to use
# https://esphome.io/components/external_components.html # https://esphome.io/components/external_components.html
# https://github.com/ssieb/esphome_components/tree/master/components/serial
############################################# #############################################
external_components: external_components:
- source: - source:
type: git type: git
url: https://github.com/ssieb/custom_components #Thanks for @ssieb components. url: https://github.com/ssieb/custom_components #Thanks for @ssieb components.
components: [ serial ] #text_sensor that reads lines for a uart. Also, a sensor that reads single values from the uart. components: [ serial ] #text_sensor that reads lines for a uart. Also, a sensor that reads single binary values from the uart.
############################################# #############################################
# ESPHome Logging Enable # ESPHome Logging Enable
@@ -121,16 +143,16 @@ ota:
# https://esphome.io/components/wifi.html # https://esphome.io/components/wifi.html
############################################# #############################################
wifi: wifi:
ssid: !secret wifi_ssid ssid: ${wifi_ssid}
password: !secret wifi_password password: ${wifi_password}
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode #power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
#manual_ip: #optional static IP address #manual_ip: #optional static IP address
#static_ip: 192.168.x.x #static_ip: ${static_ip_address}
#gateway: 192.168.X.x #gateway: ${static_ip_gateway}
#subnet: 255.255.255.0 #subnet: ${static_ip_subnet}
ap: #Details for fallback hotspot (captive portal) in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode ap: #Details for fallback hotspot (captive portal) 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 password: ${fallback_ap_password}
ap_timeout: 5min #default is 1min ap_timeout: 5min #default is 1min
############################################# #############################################
@@ -140,8 +162,9 @@ wifi:
############################################# #############################################
#web_server: #web_server:
# port: 80 # port: 80
# username: !secret web_server_username #probably a good idea to secure it # auth:
# password: !secret web_server_password # username: ${web_server_username} #probably a good idea to secure it
# password: ${web_server_password}
############################################# #############################################
# MQTT Monitoring # MQTT Monitoring
@@ -149,10 +172,10 @@ wifi:
# MUST also have api enabled if you enable MQTT # MUST also have api enabled if you enable MQTT
############################################# #############################################
mqtt: mqtt:
broker: !secret mqtt_server broker: ${mqtt_server}
topic_prefix: ${mqtt_topic}/${devicename} topic_prefix: ${mqtt_topic}/${devicename}
username: !secret mqtt_username username: ${mqtt_username}
password: !secret mqtt_password password: ${mqtt_password}
############################################# #############################################
# Bluetooth # Bluetooth
@@ -172,25 +195,16 @@ mqtt:
############################################# #############################################
# UART Serial # UART Serial
# hardware on EPS32, but software, and can be glitchy on ESP8266 # hardware on EPS32, but software, and can be glitchy on ESP8266
# https://esphome.io/components/uart.html?highlight=uart # https://esphome.io/components/uart.html
############################################# #############################################
uart: uart:
id: LD1125H_UART_BUS id: LD1125H_UART_BUS
rx_pin: GPIO16 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang rx_pin: GPIO16 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
tx_pin: GPIO17 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang tx_pin: GPIO17 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
# rx_pin: GPIO1 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
# tx_pin: GPIO0 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
baud_rate: 115200 baud_rate: 115200
data_bits: 8 data_bits: 8
stop_bits: 1 stop_bits: 1
parity: NONE parity: NONE
# debug:
# direction: BOTH
# dummy_receiver: false
# after:
# delimiter: "\n"
# sequence:
# - lambda: UARTDebug::log_string(direction, bytes);
############################################# #############################################
# Global Variables for use in automations etc # Global Variables for use in automations etc
@@ -370,8 +384,8 @@ sensor:
- heartbeat: 0.2s - heartbeat: 0.2s
############################################# #############################################
# Text Sensors (custom component) # Text Sensors
# refer https://github.com/ssieb/esphome_components/tree/master/components/serial # refer https://esphome.io/components/text_sensor/index.html
############################################# #############################################
text_sensor: text_sensor:
- platform: serial - platform: serial

View File

@@ -1,17 +1,20 @@
############################################# #############################################
############################################# #############################################
# HiLink LD2410 mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32 # HiLink LD2410 mmWave sensor, with BME280 Temp/Hum/Pres Sensor and PIR on an ESP32
# https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/tree/main # https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/tree/main
# https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/blob/main/LD1125H/ESP32-LD1125H-Complete.yaml # https://github.com/patrick3399/Hi-Link_mmWave_Radar_ESPHome/blob/main/LD1125H/ESP32-LD1125H-Complete.yaml
# #
# https://esphome.io/components/sensor/ld2410.html # https://esphome.io/components/sensor/ld2410.html
# https://www.simplysmart.house/blog/presence-detection-ld2410-home-assistant # https://www.simplysmart.house/blog/presence-detection-ld2410-home-assistant
# #
# The B and c versions of this device can use Bluetooth, but we are not using it here.
############################################# #############################################
############################################# #############################################
############################################# #############################################
# Variable Substitutions # VARIABLE SUBSTITUTIONS
# Give the device a useful name & description here
# and change values accordingly.
############################################# #############################################
substitutions: substitutions:
devicename: "esp-occupancystair" devicename: "esp-occupancystair"
@@ -19,8 +22,23 @@ substitutions:
description_comment: "D1 Mini ESP32 with LD2410 mmWave for internal stairwell and environment sensors for under house" description_comment: "D1 Mini ESP32 with LD2410 mmWave for internal stairwell and environment sensors for under house"
api_key: !secret esp-occupancystair_api_key #unfortunately you can't use substitutions in secrets names api_key: !secret esp-occupancystair_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-occupancystair_ota_pass #unfortunately you can't use substitutions in secrets names ota_pass: !secret esp-occupancystair_ota_pass #unfortunately you can't use substitutions in secrets names
wifi_ssid: !secret wifi_ssid
wifi_password: !secret wifi_password
fallback_ap_password: !secret fallback_ap_password
#Add these if we are giving it a static ip, or remove them in the Wifi section
#static_ip_address: !secret esp-occupancystair_static_ip
#static_ip_gateway: !secret esp-occupancystair_gateway
#static_ip_subnet: !secret esp-occupancystair_subnet
mqtt_server: !secret mqtt_server
mqtt_username: !secret mqtt_username
mqtt_password: !secret mqtt_password
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
update_time: 30s #update time for for temp sensors etc
#web_server_username: !secret web_server_username
#web_server_password: !secret web_server_password
update_time: 30s #update time for for general temp sensors etc
############################################# #############################################
# ESPHome # ESPHome
@@ -33,7 +51,6 @@ esphome:
#priority: -200 #priority: -200
#then: #then:
############################################# #############################################
# ESP Platform and Framework # ESP Platform and Framework
# https://esphome.io/components/esp32.html # https://esphome.io/components/esp32.html
@@ -86,16 +103,16 @@ ota:
# https://esphome.io/components/wifi.html # https://esphome.io/components/wifi.html
############################################# #############################################
wifi: wifi:
ssid: !secret wifi_ssid ssid: ${wifi_ssid}
password: !secret wifi_password password: ${wifi_password}
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode #power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
#manual_ip: #optional static IP address #manual_ip: #optional static IP address
#static_ip: 192.168.x.x #static_ip: ${static_ip_address}
#gateway: 192.168.X.x #gateway: ${static_ip_gateway}
#subnet: 255.255.255.0 #subnet: ${static_ip_subnet}
ap: #Details for fallback hotspot (captive portal) in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode ap: #Details for fallback hotspot (captive portal) 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 password: ${fallback_ap_password}
ap_timeout: 5min #default is 1min ap_timeout: 5min #default is 1min
############################################# #############################################
@@ -105,8 +122,9 @@ wifi:
############################################# #############################################
web_server: web_server:
port: 80 port: 80
# username: !secret web_server_username #probably a good idea to secure it # auth:
# password: !secret web_server_password # username: ${web_server_username} #probably a good idea to secure it
# password: ${web_server_password}
############################################# #############################################
# MQTT Monitoring # MQTT Monitoring
@@ -114,10 +132,10 @@ web_server:
# MUST also have api enabled if you enable MQTT # MUST also have api enabled if you enable MQTT
############################################# #############################################
mqtt: mqtt:
broker: !secret mqtt_server broker: ${mqtt_server}
topic_prefix: ${mqtt_topic}/${devicename} topic_prefix: ${mqtt_topic}/${devicename}
username: !secret mqtt_username username: ${mqtt_username}
password: !secret mqtt_password password: ${mqtt_password}
############################################# #############################################
# Bluetooth # Bluetooth
@@ -142,19 +160,10 @@ uart:
id: ld2410_uart id: ld2410_uart
rx_pin: GPIO16 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang rx_pin: GPIO16 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
tx_pin: GPIO17 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang tx_pin: GPIO17 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
# rx_pin: GPIO1 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
# tx_pin: GPIO0 #For ESP32, you can use any pin, Recommend Use UART_2, Don't use UART_0, It might Cause Boot Fail or System Hang
baud_rate: 256000 # default for LD2410 is 25600, 8, 0, NONE baud_rate: 256000 # default for LD2410 is 25600, 8, 0, NONE
data_bits: 8 data_bits: 8
stop_bits: 1 stop_bits: 1
parity: NONE parity: NONE
# debug:
# direction: BOTH
# dummy_receiver: false
# after:
# delimiter: "\n"
# sequence:
# - lambda: UARTDebug::log_string(direction, bytes);
############################################# #############################################
# General esp status LED # General esp status LED
@@ -166,7 +175,6 @@ status_led:
ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
inverted: false inverted: false
############################################# #############################################
# LD2410 Sensors # LD2410 Sensors
# https://esphome.io/components/sensor/ld2410.html # https://esphome.io/components/sensor/ld2410.html
@@ -366,12 +374,13 @@ sensor:
name: g8 still energy name: g8 still energy
# The ld2410 switch allows you to control your LD2410 Sensor. # The ld2410 switch allows you to control your LD2410 Sensor.
#Bluetooth switch is only useful of you have a B or C model
switch: switch:
- platform: ld2410 - platform: ld2410
engineering_mode: engineering_mode:
name: ${friendly_name} LD2140 Engineering Mode name: ${friendly_name} LD2140 Engineering Mode
bluetooth: #bluetooth:
name: ${friendly_name} LD2140 Control Bluetooth #name: ${friendly_name} LD2140 Control Bluetooth
#The ld2410 binary sensors to get presence notification #The ld2410 binary sensors to get presence notification
binary_sensor: binary_sensor:
@@ -407,11 +416,12 @@ button:
name: Query Parameters name: Query Parameters
#The ld2410 text sensor allows you to get information about your LD2410 Sensor. #The ld2410 text sensor allows you to get information about your LD2410 Sensor.
#Bluetooth sensor is only useful of you have a B or C model
text_sensor: text_sensor:
- platform: ld2410 - platform: ld2410
version: version:
name: ${friendly_name} LD2140 Firmware Version name: ${friendly_name} LD2140 Firmware Version
mac_address: #mac_address:
name: ${friendly_name} LD2140 BT MAC Address #name: ${friendly_name} LD2140 BT MAC Address

View File

@@ -7,6 +7,7 @@
# zorruno 2024-05-24 V1.1 Tested ok and added some V calibration for mine # 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 V2 A bunch more sensors added (wind direction not yet sorted)
# zorruno 2024-05-25 V3 Shuffled some sensors, rain count added # 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) # bmp280: Temp/pressure on the board (0x76 i2c)
# pulse_meter: Wind Speed (GPIO14) # pulse_meter: Wind Speed (GPIO14)
# pulse_meter: Rainfall (GPIO12) # pulse_meter: Rainfall (GPIO12)
#
# text_sensor: Beaufort Wind Scale Labelling # text_sensor: Beaufort Wind Scale Labelling
# text_sensor: Temp (av) Average of all temps # 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) # TO TEST (HAVE SENSOR or doesn't need one)
# tsl2561: Ambient Light sensor (0x39 i2c) # tsl2561: Ambient Light sensor (0x39 i2c)
# ads1115 A1_GND: UV Index # ads1115 A1_GND: UV Index
# ads1115 A0_GND: Wind Direction # 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 # ORDERED BUT DON'T HAVE YET
# ltr390: Ambient Light and UV sensor (0x53 i2c) # ltr390: Ambient Light and UV sensor (0x53 i2c)
# pmsx003: PM Particulate Filter (UART) # pmsx003: PM Particulate Filter (UART)
# AS3935: lightning sensor (i2c, but needs design) # 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) # bme280_i2c: Temp/humid/press (not used)
# #
# POSSIBLY ADD # POSSIBLY ADD
# Analogue for Solar V? # Analogue for Solar V?
# ground movement/earthquake? # ground movement/earthquake?
# water sensor (rain now) # water sensor (rain now)
# soil temp
# soil moisture
# #
############################################# #############################################
############################################# #############################################
# WEMOS D1 Mini GPIO, and Weather station Use # WEMOS D1 Mini GPIO, and Weather station Use
############################################# #############################################
# PIN HEADERS ON Weatherstation board: # PIN HEADERS on Weatherstation board:
# D1, GPIO5 Used as SCL (I2C) # D1, GPIO5 Used as SCL (I2C)
# D2, GPIO4 Used as SDA (I2C) # D2, GPIO4 Used as SDA (I2C)
# D3, GPIO0 connected to FLASH button, boot fails if pulled LOW # D3, GPIO0 connected to FLASH button, boot fails if pulled LOW
@@ -66,7 +70,7 @@
# D7, GPIO13 Used for DHT # D7, GPIO13 Used for DHT
# D8, GPIO15 (Boot fails if pulled HIGH) # 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) # D0, GPIO16, (used to wake up from deep sleep)
# RX, GPIO3 (HIGH at boot) # RX, GPIO3 (HIGH at boot)
# TX, GPIO1 (HIGH at boot, boot fails if pulled LOW) # TX, GPIO1 (HIGH at boot, boot fails if pulled LOW)
@@ -140,7 +144,7 @@ esp8266:
i2c: i2c:
sda: GPIO4 sda: GPIO4
scl: GPIO5 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 #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 # https://esphome.io/components/logger.html
############################################# #############################################
logger: 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) #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 #esp8266_store_log_strings_in_flash: false
#tx_buffer_size: 64 #tx_buffer_size: 64
@@ -195,8 +199,8 @@ wifi:
# and not compile, or it will crash occasionally) # and not compile, or it will crash occasionally)
# https://esphome.io/components/web_server.html # https://esphome.io/components/web_server.html
############################################# #############################################
web_server: #web_server:
port: 80 # port: 80
# version: 1 #V1 occasionally works better, V2 The nicer page # version: 1 #V1 occasionally works better, V2 The nicer page
# username: !secret web_server_username #probably a good idea to secure it # username: !secret web_server_username #probably a good idea to secure it
# password: !secret web_server_password # password: !secret web_server_password
@@ -267,14 +271,35 @@ text_sensor:
id: wind_dir id: wind_dir
update_interval: never update_interval: never
#############################################
############################################# #############################################
# General Sensors # General Sensors
# https://esphome.io/components/sensor/index.html # https://esphome.io/components/sensor/index.html
############################################# #############################################
#############################################
sensor: 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 # https://esphome.io/components/sensor/bmp280.html
################################ ################################
- platform: bmp280 - platform: bmp280
@@ -293,36 +318,8 @@ sensor:
oversampling: 16X oversampling: 16X
#retain: true #MQTT retain useful if sleeping #retain: true #MQTT retain useful if sleeping
################################ ################################
# BME280 temp/humidity/pressure (Note, BME and BMP Are different...) # DHT TEMPERATURE, PRESSURE & HUMIDITY
# 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
# https://esphome.io/components/sensor/dht.html # https://esphome.io/components/sensor/dht.html
# These DHTs are not very accurate... # These DHTs are not very accurate...
################################ ################################
@@ -339,61 +336,22 @@ sensor:
#retain: true #retain useful if sleeping #retain: true #retain useful if sleeping
################################ ################################
# TSL2561 ambient light sensor # TEMP SENSORS AVERAGE
# https://esphome.io/components/sensor/tsl2561.html # Averaging for the various temp sensors on board
################################ ################################
#- platform: tsl2561 - platform: template
# name: ${friendly_name} Ambient Light name: ${friendly_name} Temp (av)
# address: 0x39 icon: "mdi:thermometer"
# update_interval: 60s unit_of_measurement: "°C"
lambda: |-
################################ return (
# LTR390 Ambient Light and UV Sensor id(bmp280_temp).state
# https://esphome.io/components/sensor/ltr390.html +
################################ id(dht_temp).state
#- platform: ltr390 ) / 2;
# 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
################################ ################################
# BATTERY VOLTAGE
# Analog sensor for voltage reading # Analog sensor for voltage reading
# (A0 on esp8266) # (A0 on esp8266)
# https://esphome.io/components/sensor/adc.html # https://esphome.io/components/sensor/adc.html
@@ -404,10 +362,15 @@ sensor:
pin: A0 pin: A0
unit_of_measurement: "V" unit_of_measurement: "V"
accuracy_decimals: 6 accuracy_decimals: 6
update_interval: 10s update_interval: 30s
#retain: true #retain useful if sleeping #retain: true #retain useful if sleeping
filters: filters:
- heartbeat: 30s
- multiply: 5.223 # tested with multimeter - 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: - calibrate_linear:
- 3.321 -> 3.125 - 3.321 -> 3.125
- 3.89 -> 3.90 - 3.89 -> 3.90
@@ -427,7 +390,7 @@ sensor:
return id(battery_voltage).state; //grabs values from the battery_voltage return id(battery_voltage).state; //grabs values from the battery_voltage
filters: filters:
- sliding_window_moving_average: - 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_every: 1
send_first_at: 1 send_first_at: 1
@@ -440,12 +403,13 @@ sensor:
id: battery_voltage_recentmax id: battery_voltage_recentmax
unit_of_measurement: "V" unit_of_measurement: "V"
accuracy_decimals: 6 accuracy_decimals: 6
update_interval: 30s #updates every 30s update_interval: 30s #updates every 10s
lambda: > lambda: >
return id(battery_voltage).state; //grabs values from the battery_voltage return id(battery_voltage).state; //grabs values from the battery_voltage
filters: filters:
- heartbeat: 30s
- max: - max:
window_size: 40 #40x 30s = 20 min average period window_size: 60 #60x 30s = 30 min max value
send_every: 1 send_every: 1
send_first_at: 1 send_first_at: 1
@@ -458,7 +422,6 @@ sensor:
lambda: > lambda: >
return {id(battery_voltage_recentmax).state - id(battery_voltage).state}; //recent av voltage - now return {id(battery_voltage_recentmax).state - id(battery_voltage).state}; //recent av voltage - now
- platform: duty_time - platform: duty_time
id: battery_discharge_time id: battery_discharge_time
name: ${friendly_name} Time battery is discharging name: ${friendly_name} Time battery is discharging
@@ -472,21 +435,179 @@ sensor:
lambda: > lambda: >
return { id(battery_voltage).state <= id(battery_voltage_recentav).state }; return { id(battery_voltage).state <= id(battery_voltage_recentav).state };
################################
############################################# # RAIN SENSOR
# WIND SENSOR # Pulse Meter for measuring rainfall
# looks like this one # https://esphome.io/components/sensor/pulse_meter.html
# https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf ################################
############################################# # CALIBRATION HINTS
# https://forum.mysensors.org/topic/9594/misol-rain-gauge-tipping-bucket-rain-amount/2
############################################# ################################
# USEFUL LINKS - platform: pulse_meter
# Wind Sensing id: rainfall_meter
# https://community.home-assistant.io/t/measuring-wind-speed/395693/20 pin:
# https://community.home-assistant.io/t/measuring-wind-speed/395693/21 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 # Wind Direction, Analogue on ADS115
# Analog sensor for voltage reading # Analog sensor for voltage reading
# https://esphome.io/components/sensor/ads1115.html # https://esphome.io/components/sensor/ads1115.html
@@ -497,12 +618,21 @@ sensor:
# values giving the output voltage value for each azimuth. # values giving the output voltage value for each azimuth.
# We could also report a compass direction. # 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 - platform: ads1115
multiplexer: 'A0_GND' multiplexer: 'A0_GND'
gain: 6.144 gain: 4.096
name: ${friendly_name} Wind Direction name: ${friendly_name} Wind Direction
id: 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: # filters:
# lambda: |- # lambda: |-
# if( (x * (360.0/5.0)) >= 10.0 && (x * (360.0/5.0)) <= 70.0 ) { return x = 45 }; # 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: # on_value:
# lambda: |- # lambda: |-
@@ -665,18 +719,7 @@ sensor:
# - throttle: 30s # - 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/ # https://www.reddit.com/r/Esphome/comments/kndues/take_max_value_over_time/
@@ -791,66 +834,40 @@ sensor:
# id: id_wind_speed_avg_10min # 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: #switch:
# - platform: template # - platform: template
@@ -918,39 +935,68 @@ sensor:
# restore_value: no # restore_value: no
# initial_value: '0.0' # initial_value: '0.0'
################################
# Pulse Meter for measuring rainfall
# https://esphome.io/components/sensor/pulse_meter.html
#
################################ ################################
# CALIBRATION HINTS # BME280 temp/humidity/pressure (Note, BME and BMP Are different...)
# https://forum.mysensors.org/topic/9594/misol-rain-gauge-tipping-bucket-rain-amount/2 # https://esphome.io/cookbook/bme280_environment.html
################################ ################################
- platform: pulse_meter #- platform: bme280_i2c
id: rainfall_meter # address: 0x76
pin: # update_interval: ${update_time}
number: GPIO12 #D6 on D1 Mini # temperature:
mode: # name: ${friendly_name} BME280 Temp
input: true # accuracy_decimals: 1
pullup: true # oversampling: 2x
#internal: true # If true, don't send to HA/MQTT etc # unit_of_measurement: "°C"
internal_filter_mode: EDGE # #retain: true #MQTT retain useful if sleeping
internal_filter: 10ms # pressure:
name: ${friendly_name} Rainfall # name: ${friendly_name} BME280 Pressure
#icon: mdi: # oversampling: 2x
unit_of_measurement: "mm" # unit_of_measurement: "hPa"
accuracy_decimals: 1 # #retain: true #MQTT retain useful if sleeping
timeout: 5s # humidity:
filters: # name: ${friendly_name} BME280 Humidity
- heartbeat: 2s # accuracy_decimals: 1
#- timeout: # oversampling: 2x
# timeout: "5s" #after 5 seconds, if no pulses received.... # unit_of_measurement: "%"
# value: 0 #make the value = 0 # #retain: true #MQTT retain useful if sleeping
- 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 # TSL2561 ambient light sensor
#- clamp: # https://esphome.io/components/sensor/tsl2561.html
# min_value: 0 ################################
# max_value: 250 #if anything over that, we have debounce issues or are going to die #- platform: tsl2561
# ignore_out_of_range: true # 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