weather station esphome updates
This commit is contained in:
@@ -128,6 +128,14 @@ mqtt:
|
||||
payload: 'ON'
|
||||
then:
|
||||
- deep_sleep.enter: deep_sleep_1
|
||||
- topic: viewroad-commands/attobat/deepsleep
|
||||
payload: 'OFF'
|
||||
then:
|
||||
- deep_sleep.prevent: deep_sleep_1
|
||||
- topic: viewroad-commands/attobat/deepsleep
|
||||
payload: 'ON'
|
||||
then:
|
||||
- deep_sleep.enter: deep_sleep_1
|
||||
|
||||
########################################
|
||||
# Deep Sleep
|
||||
|
131
esphome/esp-btproxy1.yaml
Normal file
131
esphome/esp-btproxy1.yaml
Normal file
@@ -0,0 +1,131 @@
|
||||
#############################################
|
||||
#############################################
|
||||
#
|
||||
#############################################
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
# Variable Substitutions
|
||||
#############################################
|
||||
substitutions:
|
||||
devicename: "esp-btproxy1"
|
||||
friendly_name: "BT Proxy 1"
|
||||
description_comment: "D1 Mini ESP32 with BT Proxy Test"
|
||||
api_key: !secret esp-btproxy1_api_key #unfortunately you can't use substitutions in secrets names
|
||||
ota_pass: !secret esp-btproxy1_ota_pass #unfortunately you can't use substitutions in secrets names
|
||||
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
|
||||
update_time: 30s #update time for for 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, will remember previous values (if set)
|
||||
#priority: -200
|
||||
#then:
|
||||
|
||||
|
||||
#############################################
|
||||
# ESP Platform and Framework
|
||||
# https://esphome.io/components/esp32.html
|
||||
#############################################
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
#type: arduino
|
||||
type: esp-idf #Suggested Use ESP-IDF Framework, or Plug Out the UART Cable Might Cause ESP32 Hang.
|
||||
version: recommended #recommended, latest or dev
|
||||
|
||||
#############################################
|
||||
# ESPHome Logging Enable
|
||||
# https://esphome.io/components/logger.html
|
||||
#############################################
|
||||
logger:
|
||||
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
|
||||
|
||||
#############################################
|
||||
# Enable the Home Assistant API
|
||||
# https://esphome.io/components/api.html
|
||||
#############################################
|
||||
api:
|
||||
encryption:
|
||||
key: ${api_key}
|
||||
|
||||
#############################################
|
||||
# Enable Over the Air Update Capability
|
||||
# https://esphome.io/components/ota.html?highlight=ota
|
||||
#############################################
|
||||
ota:
|
||||
safe_mode: true #Safe mode will detect boot loops
|
||||
password: ${ota_pass}
|
||||
|
||||
#############################################
|
||||
# Wifi Settings
|
||||
# https://esphome.io/components/wifi.html
|
||||
#############################################
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
#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
|
||||
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
|
||||
password: !secret fallback_ap_password
|
||||
ap_timeout: 5min #default is 1min
|
||||
|
||||
#############################################
|
||||
# Web Portal for display and monitoring
|
||||
# Turning this off is probably a good idea to save resources.
|
||||
# https://esphome.io/components/web_server.html
|
||||
#############################################
|
||||
web_server:
|
||||
port: 80
|
||||
# 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: !secret mqtt_server
|
||||
topic_prefix: ${mqtt_topic}/${devicename}
|
||||
username: !secret mqtt_username
|
||||
password: !secret mqtt_password
|
||||
|
||||
#############################################
|
||||
# Bluetooth
|
||||
# https://esphome.io/components/bluetooth_proxy.html
|
||||
# https://esphome.io/components/esp32_ble_tracker.html
|
||||
# Remember that this takes a LOT of processing. On the
|
||||
# ESP32, enable the IDF framework, and disable the
|
||||
# Web server component. Changing to the IDF framework
|
||||
# needs to be via cable not OTA to change the
|
||||
# partition setup.
|
||||
#############################################
|
||||
bluetooth_proxy:
|
||||
active: true
|
||||
|
||||
esp32_ble_tracker:
|
||||
|
||||
#############################################
|
||||
# General esp status LED
|
||||
# https://esphome.io/components/status_led.html
|
||||
#############################################
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO2 #ESP32 Onboard LED
|
||||
ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
|
||||
inverted: false
|
||||
|
||||
|
439
esphome/esp-occupancylaundry.yaml
Normal file
439
esphome/esp-occupancylaundry.yaml
Normal file
@@ -0,0 +1,439 @@
|
||||
|
||||
#############################################
|
||||
#############################################
|
||||
# HiLink LD1125H mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32
|
||||
# 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
|
||||
#
|
||||
# mth1: 0 to 2.8m sensitive
|
||||
# mth2: 2.8 to 8m sensitive
|
||||
# mth3: above 8m sensitive
|
||||
# rmax: max distance
|
||||
# Clearance Time: Mov/Occ to Clearance waiting time
|
||||
# Movement Time: Mov to Occ waiting time
|
||||
#
|
||||
#############################################
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
# Variable Substitutions
|
||||
#############################################
|
||||
substitutions:
|
||||
devicename: "esp-occupancylaundry"
|
||||
friendly_name: "Laundry Occupancy"
|
||||
description_comment: "D1 Mini ESP32 with LD1125H mmWave and environment sensors for laundry"
|
||||
api_key: !secret esp-occupancylaundry_api_key #unfortunately you can't use substitutions in secrets names
|
||||
ota_pass: !secret esp-occupancylaundry_ota_pass #unfortunately you can't use substitutions in secrets names
|
||||
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
|
||||
update_time: 30s #update time for for 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: #LD1125H Initial Setting, will remember previous values (if set)
|
||||
priority: -200
|
||||
then:
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th1st = "mth1=" + str_sprintf("%.0f",id(LD1125H_mth1).state) +"\r\n";
|
||||
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th2st = "mth2=" + str_sprintf("%.0f",id(LD1125H_mth2).state) +"\r\n";
|
||||
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th3st = "mth3=" + str_sprintf("%.0f",id(LD1125H_mth3).state) +"\r\n";
|
||||
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string rmaxst = "rmax=" + str_sprintf("%.1f",id(LD1125H_rmax).state) +"\r\n";
|
||||
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||
|
||||
#############################################
|
||||
# ESP Platform and Framework
|
||||
# https://esphome.io/components/esp32.html
|
||||
#############################################
|
||||
esp32:
|
||||
#board: nodemcu-32s
|
||||
board: esp32dev
|
||||
framework:
|
||||
#type: arduino
|
||||
type: esp-idf #Suggested Use ESP-IDF Framework, or Plug Out the UART Cable Might Cause ESP32 Hang.
|
||||
version: recommended #recommended, latest or dev
|
||||
|
||||
#############################################
|
||||
# i2s bus
|
||||
# https://esphome.io/components/i2c.html
|
||||
#############################################
|
||||
i2c:
|
||||
sda: GPIO19
|
||||
scl: GPIO21
|
||||
scan: True
|
||||
frequency: 100kHz #10, 50, 100, 200, 800 are possible settings, 100kHz was reliable for me
|
||||
|
||||
#############################################
|
||||
# ESPHome external or custom components to use
|
||||
# https://esphome.io/components/external_components.html
|
||||
#############################################
|
||||
external_components:
|
||||
- source:
|
||||
type: git
|
||||
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.
|
||||
|
||||
#############################################
|
||||
# ESPHome Logging Enable
|
||||
# https://esphome.io/components/logger.html
|
||||
#############################################
|
||||
logger:
|
||||
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
|
||||
|
||||
#############################################
|
||||
# Enable the Home Assistant API
|
||||
# https://esphome.io/components/api.html
|
||||
#############################################
|
||||
api:
|
||||
encryption:
|
||||
key: ${api_key}
|
||||
|
||||
#############################################
|
||||
# Enable Over the Air Update Capability
|
||||
# https://esphome.io/components/ota.html?highlight=ota
|
||||
#############################################
|
||||
ota:
|
||||
safe_mode: true #Safe mode will detect boot loops
|
||||
password: ${ota_pass}
|
||||
|
||||
#############################################
|
||||
# Wifi Settings
|
||||
# https://esphome.io/components/wifi.html
|
||||
#############################################
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
#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
|
||||
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
|
||||
password: !secret fallback_ap_password
|
||||
ap_timeout: 5min #default is 1min
|
||||
|
||||
#############################################
|
||||
# Web Portal for display and monitoring
|
||||
# Turning this off is probably a good idea to save resources.
|
||||
# https://esphome.io/components/web_server.html
|
||||
#############################################
|
||||
#web_server:
|
||||
# port: 80
|
||||
# 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: !secret mqtt_server
|
||||
topic_prefix: ${mqtt_topic}/${devicename}
|
||||
username: !secret mqtt_username
|
||||
password: !secret mqtt_password
|
||||
|
||||
#############################################
|
||||
# Bluetooth
|
||||
# https://esphome.io/components/bluetooth_proxy.html
|
||||
# https://esphome.io/components/esp32_ble_tracker.html
|
||||
# Remember that this takes a LOT of processing. On the
|
||||
# ESP32, enable the IDF framework, and disable the
|
||||
# Web server component. Changing to the IDF framework
|
||||
# needs to be via cable not OTA to change the
|
||||
# partition setup.
|
||||
#############################################
|
||||
#esp32_ble_tracker:
|
||||
|
||||
#bluetooth_proxy:
|
||||
#active: true
|
||||
|
||||
|
||||
#############################################
|
||||
# UART Serial
|
||||
# hardware on EPS32, but software, and can be glitchy on ESP8266
|
||||
# https://esphome.io/components/uart.html?highlight=uart
|
||||
#############################################
|
||||
uart:
|
||||
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
|
||||
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
|
||||
data_bits: 8
|
||||
stop_bits: 1
|
||||
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
|
||||
# https://esphome.io/guides/automations.html?highlight=globals#global-variables
|
||||
#############################################
|
||||
globals:
|
||||
- id: LD1125H_Last_Time
|
||||
type: time_t
|
||||
restore_value: no
|
||||
initial_value: time(NULL)
|
||||
- id: LD1125H_Last_Mov_Time
|
||||
type: time_t
|
||||
restore_value: no
|
||||
initial_value: time(NULL)
|
||||
- id: LD1125H_Clearence_Status
|
||||
type: bool
|
||||
restore_value: no
|
||||
initial_value: "false"
|
||||
|
||||
#############################################
|
||||
# General esp status LED
|
||||
# https://esphome.io/components/status_led.html
|
||||
#############################################
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO2 #ESP32 Onboard LED
|
||||
ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
|
||||
inverted: false
|
||||
|
||||
#############################################
|
||||
# Interval Automations
|
||||
# https://esphome.io/guides/automations.html
|
||||
#############################################
|
||||
interval:
|
||||
- interval: 1s #Clearance Scan Time
|
||||
setup_priority: -200
|
||||
then:
|
||||
lambda: |-
|
||||
if ((time(NULL)-id(LD1125H_Last_Time))>id(LD1125H_Clear_Time).state) {
|
||||
if ((id(LD1125H_Clearence_Status) == false) || (id(LD1125H_Occupancy).state != "Clearance")) {
|
||||
id(LD1125H_Occupancy).publish_state("Clearance");
|
||||
id(LD1125H_Clearence_Status) = true;
|
||||
}
|
||||
if (id(LD1125H_MovOcc_Binary).state == true) {
|
||||
id(LD1125H_MovOcc_Binary).publish_state(false);
|
||||
}
|
||||
if (id(LD1125H_Mov_Binary).state == true) {
|
||||
id(LD1125H_Mov_Binary).publish_state(false);
|
||||
}
|
||||
}
|
||||
|
||||
#############################################
|
||||
# Number Sensors (custom component)
|
||||
# refer https://github.com/ssieb/esphome_components/tree/master/components/serial
|
||||
#############################################
|
||||
number:
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H mth1 #mth1 is 0~2.8m Sensitivity.
|
||||
id: LD1125H_mth1
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "60.0" #Default mth1 Setting
|
||||
min_value: 10.0
|
||||
max_value: 600.0
|
||||
step: 5.0
|
||||
set_action:
|
||||
then:
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th1st = "mth1=" + str_sprintf("%.0f",x) +"\r\n";
|
||||
return std::vector<uint8_t>(th1st.begin(), th1st.end());
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H mth2 #mth2 is 2.8~8m Sensitivity.
|
||||
id: LD1125H_mth2
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "30" #Default mth2 Setting
|
||||
min_value: 5
|
||||
max_value: 300
|
||||
step: 5
|
||||
set_action:
|
||||
then:
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th2st = "mth2=" + str_sprintf("%.0f",x) +"\r\n";
|
||||
return std::vector<uint8_t>(th2st.begin(), th2st.end());
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H mth3 #mth3 is above 8m Sensitivity.
|
||||
id: LD1125H_mth3
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "20" #Default mth3 Setting
|
||||
min_value: 5
|
||||
max_value: 200
|
||||
step: 5
|
||||
set_action:
|
||||
then:
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string th3st = "mth3=" + str_sprintf("%.0f",x) +"\r\n";
|
||||
return std::vector<uint8_t>(th3st.begin(), th3st.end());
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H rmax #rmax is max detection distance.
|
||||
id: LD1125H_rmax
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "8" #Default rmax Setting
|
||||
min_value: 0.4
|
||||
max_value: 12
|
||||
step: 0.1
|
||||
set_action:
|
||||
then:
|
||||
- uart.write:
|
||||
id: LD1125H_UART_BUS
|
||||
data: !lambda |-
|
||||
std::string rmaxst = "rmax=" + str_sprintf("%.1f",x) +"\r\n";
|
||||
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Clearence Time
|
||||
id: LD1125H_Clear_Time
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "5" #LD1125H Mov/Occ > Clearence Time Here
|
||||
min_value: 0.5
|
||||
max_value: 20
|
||||
step: 0.5
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Movement Time
|
||||
id: LD1125H_Mov_Time
|
||||
icon: "mdi:cogs"
|
||||
optimistic: true
|
||||
restore_value: true #If you don't want to store the setting at ESP, set it to false.
|
||||
initial_value: "1" #LD1125H Mov > Occ Time Here
|
||||
min_value: 0.5
|
||||
max_value: 10
|
||||
step: 0.5
|
||||
|
||||
#############################################
|
||||
# General Sensors
|
||||
# https://esphome.io/components/sensor/index.html
|
||||
#############################################
|
||||
sensor:
|
||||
- platform: bme280_i2c
|
||||
temperature:
|
||||
name: ${friendly_name} BME280 Temp
|
||||
accuracy_decimals: 1
|
||||
oversampling: 2x
|
||||
pressure:
|
||||
name: ${friendly_name} BME280 Pressure
|
||||
oversampling: 2x
|
||||
humidity:
|
||||
name: ${friendly_name} BME280 Humidity
|
||||
accuracy_decimals: 1
|
||||
oversampling: 2x
|
||||
address: 0x76
|
||||
update_interval: ${update_time}
|
||||
- platform: uptime
|
||||
name: ${friendly_name} Uptime
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Distance
|
||||
id: LD1125H_Distance
|
||||
icon: "mdi:signal-distance-variant"
|
||||
unit_of_measurement: "m"
|
||||
accuracy_decimals: 2
|
||||
filters: # Use Fliter To Debounce
|
||||
- sliding_window_moving_average:
|
||||
window_size: 8
|
||||
send_every: 2
|
||||
- heartbeat: 0.2s
|
||||
|
||||
#############################################
|
||||
# Text Sensors (custom component)
|
||||
# refer https://github.com/ssieb/esphome_components/tree/master/components/serial
|
||||
#############################################
|
||||
text_sensor:
|
||||
- platform: serial
|
||||
uart_id: LD1125H_UART_BUS
|
||||
name: ${friendly_name} LD1125H UART Text
|
||||
id: LD1125H_UART_Text
|
||||
icon: "mdi:format-text"
|
||||
internal: True #If Don't Want to See UART Receive Data, Set To True
|
||||
on_value:
|
||||
lambda: |-
|
||||
if (id(LD1125H_UART_Text).state.substr(0,3) == "occ") {
|
||||
id(LD1125H_Distance).publish_state(atof(id(LD1125H_UART_Text).state.substr(9).c_str()));
|
||||
if ((time(NULL)-id(LD1125H_Last_Mov_Time))>id(LD1125H_Mov_Time).state) {
|
||||
id(LD1125H_Occupancy).publish_state("Occupancy");
|
||||
if (id(LD1125H_MovOcc_Binary).state == false) {
|
||||
id(LD1125H_MovOcc_Binary).publish_state(true);
|
||||
}
|
||||
if (id(LD1125H_Mov_Binary).state == true) {
|
||||
id(LD1125H_Mov_Binary).publish_state(false);
|
||||
}
|
||||
}
|
||||
if (id(LD1125H_MovOcc_Binary).state == false) {
|
||||
id(LD1125H_MovOcc_Binary).publish_state(true);
|
||||
}
|
||||
id(LD1125H_Last_Time) = time(NULL);
|
||||
if (id(LD1125H_Clearence_Status) == true) {
|
||||
id(LD1125H_Clearence_Status) = false;
|
||||
}
|
||||
}
|
||||
else if (id(LD1125H_UART_Text).state.substr(0,3) == "mov") {
|
||||
id(LD1125H_Distance).publish_state(atof(id(LD1125H_UART_Text).state.substr(9).c_str()));
|
||||
id(LD1125H_Occupancy).publish_state("Movement");
|
||||
if (id(LD1125H_MovOcc_Binary).state == false) {
|
||||
id(LD1125H_MovOcc_Binary).publish_state(true);
|
||||
}
|
||||
if (id(LD1125H_Mov_Binary).state == false) {
|
||||
id(LD1125H_Mov_Binary).publish_state(true);
|
||||
}
|
||||
id(LD1125H_Last_Mov_Time) = time(NULL);
|
||||
id(LD1125H_Last_Time) = time(NULL);
|
||||
if (id(LD1125H_Clearence_Status) == true) {
|
||||
id(LD1125H_Clearence_Status) = false;
|
||||
}
|
||||
}
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Occupancy Status
|
||||
id: LD1125H_Occupancy
|
||||
icon: "mdi:motion-sensor"
|
||||
|
||||
#############################################
|
||||
# Binary Sensors
|
||||
# https://esphome.io/components/binary_sensor/index.html
|
||||
#############################################
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: ${friendly_name} Status
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Occupancy or Movement
|
||||
id: LD1125H_MovOcc_Binary
|
||||
device_class: occupancy
|
||||
- platform: template
|
||||
name: ${friendly_name} LD1125H Movement
|
||||
id: LD1125H_Mov_Binary
|
||||
device_class: motion
|
@@ -138,8 +138,8 @@ wifi:
|
||||
# Turning this off is probably a good idea to save resources.
|
||||
# https://esphome.io/components/web_server.html
|
||||
#############################################
|
||||
web_server:
|
||||
port: 80
|
||||
#web_server:
|
||||
# port: 80
|
||||
# username: !secret web_server_username #probably a good idea to secure it
|
||||
# password: !secret web_server_password
|
||||
|
||||
@@ -165,6 +165,7 @@ mqtt:
|
||||
# partition setup.
|
||||
#############################################
|
||||
#bluetooth_proxy:
|
||||
# active: true
|
||||
|
||||
#esp32_ble_tracker:
|
||||
|
||||
|
@@ -276,13 +276,13 @@ number:
|
||||
select:
|
||||
- platform: ld2410
|
||||
distance_resolution:
|
||||
name: "distance resolution"
|
||||
name: ${friendly_name} LD2140 Distance Resolution
|
||||
baud_rate:
|
||||
name: "baud rate"
|
||||
name: ${friendly_name} LD2140 Baud Rate
|
||||
light_function:
|
||||
name: light function
|
||||
name: ${friendly_name} LD2140 Light Function
|
||||
out_pin_level:
|
||||
name: out pin level
|
||||
name: ${friendly_name} LD2140 Out Pin Level
|
||||
|
||||
#############################################
|
||||
# General Sensors
|
||||
@@ -369,29 +369,40 @@ sensor:
|
||||
switch:
|
||||
- platform: ld2410
|
||||
engineering_mode:
|
||||
name: "Engineering Mode"
|
||||
name: ${friendly_name} LD2140 Engineering Mode
|
||||
bluetooth:
|
||||
name: "Control Bluetooth"
|
||||
name: ${friendly_name} LD2140 Control Bluetooth
|
||||
|
||||
#The ld2410 binary sensors to get presence notification
|
||||
binary_sensor:
|
||||
- platform: ld2410
|
||||
has_target:
|
||||
name: Presence
|
||||
name: ${friendly_name} Presence
|
||||
has_moving_target:
|
||||
name: Moving Target
|
||||
name: ${friendly_name} Moving Target
|
||||
has_still_target:
|
||||
name: Still Target
|
||||
name: ${friendly_name} Still Target
|
||||
out_pin_presence_status:
|
||||
name: Out Pin Presence Status
|
||||
name: ${friendly_name} LD2140 Out Pin Presence Status
|
||||
|
||||
#Standard PIR Sensor
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: GPIO13
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
inverted: true
|
||||
name: ${friendly_name} PIR Sensor
|
||||
device_class: motion
|
||||
|
||||
#The ld2410 button allows resetting
|
||||
button:
|
||||
- platform: ld2410
|
||||
factory_reset:
|
||||
name: "Factory reset"
|
||||
name: ${friendly_name} LD2140 Factory reset"
|
||||
restart:
|
||||
name: "Restart"
|
||||
name: ${friendly_name} LD2140 Restart
|
||||
query_params:
|
||||
name: Query Parameters
|
||||
|
||||
@@ -399,6 +410,8 @@ button:
|
||||
text_sensor:
|
||||
- platform: ld2410
|
||||
version:
|
||||
name: "Firmware Version"
|
||||
name: ${friendly_name} LD2140 Firmware Version
|
||||
mac_address:
|
||||
name: "MAC Address"
|
||||
name: ${friendly_name} LD2140 BT MAC Address
|
||||
|
||||
|
||||
|
@@ -6,6 +6,7 @@
|
||||
# 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
|
||||
#############################################
|
||||
#############################################
|
||||
|
||||
@@ -19,46 +20,58 @@
|
||||
# battery voltage (adc A0)
|
||||
#
|
||||
# ads1115: 4 Channel A->D (0x48 i2c)
|
||||
# dht: DHT22 Temp/Humidity, Remote (GPIO15)
|
||||
# dht: DHT22 Temp/Humidity, Remote (GPIO13)
|
||||
# bmp280: Temp/pressure on the board (0x76 i2c)
|
||||
# pulse_meter: Wind Speed (GPIO13)
|
||||
#
|
||||
# pulse_meter: Wind Speed (GPIO14)
|
||||
# pulse_meter: Rainfall (GPIO12)
|
||||
|
||||
# text_sensor: Beaufort Wind Scale Labelling
|
||||
# text:sensor: Temp (av) Average of all temps
|
||||
# text_sensor: Temp (av) Average of all temps
|
||||
#
|
||||
# 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
|
||||
# pulse_meter: Rainfall (GPIO??)
|
||||
# battery life: Time from battery starting to drop (retain)
|
||||
#
|
||||
# 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)
|
||||
#
|
||||
# NOT USED (code commented)
|
||||
# bme280_i2c: Temp/humid/press (not used)
|
||||
#
|
||||
# POSSIBLY ADD
|
||||
# Analogue for Solar V?
|
||||
# Lightning?
|
||||
# ground movement/earthquake?
|
||||
# water sensor (rain now)
|
||||
#
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
# WIND SENSOR
|
||||
# looks like this one
|
||||
# https://www.sparkfun.com/datasheets/Sensors/Weather/Weather%20Sensor%20Assembly..pdf
|
||||
# WEMOS D1 Mini GPIO, and Weather station Use
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
# 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
|
||||
# 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)
|
||||
#
|
||||
# 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
|
||||
#
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
@@ -79,13 +92,18 @@ substitutions:
|
||||
devicename: "esp-weatherstation"
|
||||
friendly_name: "Weather Station"
|
||||
description_comment: "Opengreen energy board, with BME280 Temp/Hum/Pres Sensor on an ESP8266 D1 Mini"
|
||||
|
||||
#if NOT using a secrets file, just replace these with the passwords etc in speech marks
|
||||
api_key: !secret esp-weatherstation_api_key #unfortunately you can't use substitutions in secrets names
|
||||
ota_pass: !secret esp-weatherstation_ota_pass #unfortunately you can't use substitutions in secrets names
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_pass: !secret wifi_password
|
||||
mqtt_server: 192.168.3.200
|
||||
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
|
||||
update_time: 30s #update time for for temp sensors etc
|
||||
update_time: 30s #update time for for various temp sensors etc
|
||||
|
||||
#############################################
|
||||
# ESPHome
|
||||
@@ -177,8 +195,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
|
||||
@@ -191,16 +209,16 @@ wifi:
|
||||
mqtt:
|
||||
broker: ${mqtt_server}
|
||||
topic_prefix: ${mqtt_topic}/${devicename}
|
||||
#username: !secret mqtt_username
|
||||
#password: !secret mqtt_password
|
||||
username: ${mqtt_username}
|
||||
password: ${mqtt_password}
|
||||
|
||||
#A way to prevent deep sleep using MQTT command
|
||||
#Method to prevent deep sleep using MQTT command
|
||||
#on_message:
|
||||
#- topic: ${mqtt_topic}/${devicename}/deepsleepoff
|
||||
#- topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
#payload: 'ON'
|
||||
#then:
|
||||
#- deep_sleep.prevent: deep_sleep_1
|
||||
#- topic: ${mqtt_topic}/${devicename}/deepsleepon
|
||||
#- topic: ${mqtt_topic}/${devicename}/deepsleep
|
||||
#payload: 'ON'
|
||||
#then:
|
||||
#- deep_sleep.enter: deep_sleep_1
|
||||
@@ -277,7 +295,7 @@ sensor:
|
||||
|
||||
|
||||
################################
|
||||
# BME280 temp/humidity/pressure
|
||||
# BME280 temp/humidity/pressure (Note, BME and BMP Are different...)
|
||||
# https://esphome.io/cookbook/bme280_environment.html
|
||||
################################
|
||||
#- platform: bme280_i2c
|
||||
@@ -306,10 +324,10 @@ sensor:
|
||||
################################
|
||||
# DHT temp/humidity
|
||||
# https://esphome.io/components/sensor/dht.html
|
||||
# These DHTs are not very accurate...
|
||||
################################
|
||||
- platform: dht
|
||||
pin: GPIO15 #D8 on the D1 Mini ESP8266
|
||||
update_interval: ${update_time}
|
||||
pin: GPIO13 #D7 on the D1 Mini ESP8266
|
||||
temperature:
|
||||
name: ${friendly_name} DHT22 Temperature
|
||||
id: dht_temp
|
||||
@@ -385,30 +403,62 @@ sensor:
|
||||
id: battery_voltage
|
||||
pin: A0
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 5
|
||||
update_interval: ${update_time}
|
||||
accuracy_decimals: 6
|
||||
update_interval: 10s
|
||||
#retain: true #retain useful if sleeping
|
||||
filters:
|
||||
- multiply: 5.223 # tested with multimeter
|
||||
- calibrate_linear:
|
||||
- 3.321 -> 3.125
|
||||
- 3.89 -> 3.90
|
||||
- 3.85 -> 3.92
|
||||
- 4.09 -> 4.14
|
||||
|
||||
################################
|
||||
# A Calculation of recent Av V
|
||||
# So we can see if battery is charging/discharging
|
||||
################################
|
||||
- platform: template
|
||||
name: ${friendly_name} Av Battery Voltage over 5 mins
|
||||
id: battery_voltage_5minav
|
||||
name: ${friendly_name} Av Battery Voltage over recent period
|
||||
id: battery_voltage_recentav
|
||||
unit_of_measurement: "V"
|
||||
accuracy_decimals: 5
|
||||
accuracy_decimals: 6
|
||||
update_interval: 30s #updates every 30s
|
||||
lambda: >
|
||||
return id(battery_voltage).state; //grabs values from the battery_voltage
|
||||
filters:
|
||||
- sliding_window_moving_average:
|
||||
window_size: 20 #20x 30s = 10 mins
|
||||
window_size: 40 #40x 30s = 20 min average period
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
|
||||
################################
|
||||
# A Calculation of recent 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 30s
|
||||
lambda: >
|
||||
return id(battery_voltage).state; //grabs values from the battery_voltage
|
||||
filters:
|
||||
- max:
|
||||
window_size: 40 #40x 30s = 20 min average period
|
||||
send_every: 1
|
||||
send_first_at: 1
|
||||
|
||||
- platform: template
|
||||
name: ${friendly_name} Battery Voltage loss over 10 mins
|
||||
id: battery_voltage_recentloss
|
||||
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
|
||||
|
||||
|
||||
- platform: duty_time
|
||||
id: battery_discharge_time
|
||||
name: ${friendly_name} Time battery is discharging
|
||||
@@ -420,9 +470,21 @@ sensor:
|
||||
- multiply: 0.01666666
|
||||
- round: 0
|
||||
lambda: >
|
||||
return { id(battery_voltage).state <= id(battery_voltage_5minav).state };
|
||||
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
|
||||
#############################################
|
||||
|
||||
################################
|
||||
# Wind Direction, Analogue on ADS115
|
||||
@@ -543,7 +605,7 @@ sensor:
|
||||
- platform: pulse_meter # https://community.home-assistant.io/t/measuring-wind-speed/395693
|
||||
id: wind_meter
|
||||
pin:
|
||||
number: GPIO13
|
||||
number: GPIO14 #D5 on D1 Mini
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
@@ -556,13 +618,14 @@ sensor:
|
||||
accuracy_decimals: 1
|
||||
timeout: 5s
|
||||
filters:
|
||||
- timeout:
|
||||
timeout: "5s" #after 5 seconds, if no pulses received....
|
||||
value: 0 #make the value = 0
|
||||
- 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: 10
|
||||
send_every: 10
|
||||
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
|
||||
@@ -747,46 +810,47 @@ sensor:
|
||||
# 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
|
||||
# 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("");
|
||||
# }
|
||||
- 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
|
||||
@@ -853,3 +917,40 @@ sensor:
|
||||
# type: float
|
||||
# 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
|
||||
################################
|
||||
- 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
|
404
esphome/trash/esp-occupancystair copy.yaml
Normal file
404
esphome/trash/esp-occupancystair copy.yaml
Normal file
@@ -0,0 +1,404 @@
|
||||
#############################################
|
||||
#############################################
|
||||
# HiLink LD2410 mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32
|
||||
# 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://esphome.io/components/sensor/ld2410.html
|
||||
# https://www.simplysmart.house/blog/presence-detection-ld2410-home-assistant
|
||||
#
|
||||
#############################################
|
||||
#############################################
|
||||
|
||||
#############################################
|
||||
# Variable Substitutions
|
||||
#############################################
|
||||
substitutions:
|
||||
devicename: "esp-occupancystair"
|
||||
friendly_name: "Stair Occupancy"
|
||||
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
|
||||
ota_pass: !secret esp-occupancystair_ota_pass #unfortunately you can't use substitutions in secrets names
|
||||
mqtt_topic: "esphome" #main topic for the mqtt server, call it what you like
|
||||
update_time: 30s #update time for for 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, will remember previous values (if set)
|
||||
#priority: -200
|
||||
#then:
|
||||
|
||||
|
||||
#############################################
|
||||
# ESP Platform and Framework
|
||||
# https://esphome.io/components/esp32.html
|
||||
#############################################
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
#type: arduino
|
||||
type: esp-idf #Suggested Use ESP-IDF Framework, or Plug Out the UART Cable Might Cause ESP32 Hang.
|
||||
version: recommended #recommended, latest or dev
|
||||
|
||||
#############################################
|
||||
# i2s bus
|
||||
# https://esphome.io/components/i2c.html
|
||||
#############################################
|
||||
i2c:
|
||||
sda: GPIO19
|
||||
scl: GPIO21
|
||||
scan: True
|
||||
frequency: 100kHz #10, 50, 100, 200, 800 are possible settings, 100kHz was reliable for me
|
||||
|
||||
#############################################
|
||||
# ESPHome Logging Enable
|
||||
# https://esphome.io/components/logger.html
|
||||
#############################################
|
||||
logger:
|
||||
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
|
||||
|
||||
#############################################
|
||||
# Enable the Home Assistant API
|
||||
# https://esphome.io/components/api.html
|
||||
#############################################
|
||||
api:
|
||||
encryption:
|
||||
key: ${api_key}
|
||||
|
||||
#############################################
|
||||
# Enable Over the Air Update Capability
|
||||
# https://esphome.io/components/ota.html?highlight=ota
|
||||
#############################################
|
||||
ota:
|
||||
safe_mode: true #Safe mode will detect boot loops
|
||||
password: ${ota_pass}
|
||||
|
||||
#############################################
|
||||
# Wifi Settings
|
||||
# https://esphome.io/components/wifi.html
|
||||
#############################################
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
#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
|
||||
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
|
||||
password: !secret fallback_ap_password
|
||||
ap_timeout: 5min #default is 1min
|
||||
|
||||
#############################################
|
||||
# Web Portal for display and monitoring
|
||||
# Turning this off is probably a good idea to save resources.
|
||||
# https://esphome.io/components/web_server.html
|
||||
#############################################
|
||||
web_server:
|
||||
port: 80
|
||||
# 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: !secret mqtt_server
|
||||
topic_prefix: ${mqtt_topic}/${devicename}
|
||||
username: !secret mqtt_username
|
||||
password: !secret mqtt_password
|
||||
|
||||
#############################################
|
||||
# Bluetooth
|
||||
# https://esphome.io/components/bluetooth_proxy.html
|
||||
# https://esphome.io/components/esp32_ble_tracker.html
|
||||
# Remember that this takes a LOT of processing. On the
|
||||
# ESP32, enable the IDF framework, and disable the
|
||||
# Web server component. Changing to the IDF framework
|
||||
# needs to be via cable not OTA to change the
|
||||
# partition setup.
|
||||
#############################################
|
||||
#bluetooth_proxy:
|
||||
|
||||
#esp32_ble_tracker:
|
||||
|
||||
#############################################
|
||||
# UART Serial
|
||||
# hardware on EPS32, but software, and can be glitchy on ESP8266
|
||||
# https://esphome.io/components/uart.html?highlight=uart
|
||||
#############################################
|
||||
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
|
||||
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
|
||||
data_bits: 8
|
||||
stop_bits: 1
|
||||
parity: NONE
|
||||
# debug:
|
||||
# direction: BOTH
|
||||
# dummy_receiver: false
|
||||
# after:
|
||||
# delimiter: "\n"
|
||||
# sequence:
|
||||
# - lambda: UARTDebug::log_string(direction, bytes);
|
||||
|
||||
#############################################
|
||||
# General esp status LED
|
||||
# https://esphome.io/components/status_led.html
|
||||
#############################################
|
||||
status_led:
|
||||
pin:
|
||||
number: GPIO2 #ESP32 Onboard LED
|
||||
ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
|
||||
inverted: false
|
||||
|
||||
|
||||
#############################################
|
||||
# LD2410 Sensors
|
||||
# https://esphome.io/components/sensor/ld2410.html
|
||||
# https://www.hlktech.net/index.php?id=988
|
||||
#############################################
|
||||
ld2410:
|
||||
uart_id: ld2410_uart
|
||||
#uart_id (Optional, ID): Manually specify the ID of the UART Component if you want to use multiple UART buses.
|
||||
#throttle (Optional, int): Time in milliseconds to control the rate of data updates. Defaults to 1000ms.
|
||||
#id (Optional, ID): Manually specify the ID for this LD2410 Sensor component if you need multiple components.
|
||||
|
||||
# light (Optional, int): When in engineering mode, indicates the light sensitivity, otherwise unknown. Value between 0 and 255 inclusive. Though it seems that the value 85 is the lowest value at complete darkness. All options from Sensor.
|
||||
# moving_distance (Optional, int): Distance in cm of detected moving target. All options from Sensor.
|
||||
# still_distance (Optional, int): Distance in cm of detected still target. All options from Sensor.
|
||||
# moving_energy (Optional, int): Energy for moving target. Value between 0 and 100 inclusive. All options from Sensor.
|
||||
# still_energy (Optional, int): Energy for still target. Value between 0 and 100 inclusive. All options from Sensor.
|
||||
# detection_distance (Optional, int): Distance in cm of target. All options from Sensor.
|
||||
# gX (Optional): Energies for the Xth gate (X => 0 to 8).
|
||||
# move_energy (Optional, int): When in engineering mode, the move energy of the gate, otherwise unknown. Value between 0 and 100 inclusive. All options from Sensor.
|
||||
#still_energy (Optional, int): When in engineering mode, the still energy of the gate, otherwise unknown. Value between 0 and 100 inclusive. All options from Sensor.
|
||||
#ld2410_id (Optional, ID): Manually specify the ID for the LD2410 Sensor component if you are using multiple components.
|
||||
|
||||
#The ld2410 number values for setting thresholds
|
||||
# timeout: 5s
|
||||
# max_move_distance: 2.25m
|
||||
# max_still_distance: 2.25m
|
||||
# g0_move_threshold: 40 # 0m / 0'
|
||||
# g0_still_threshold: 10 # 0m / 0'
|
||||
# g1_move_threshold: 40 # 0 - 0.75m / 0 - 2.46'
|
||||
# g1_still_threshold: 10 # 0 - 0.75m / 0 - 2.46'
|
||||
# g2_move_threshold: 40 # 0.75 - 1.5m / 2.46' - 4.92'
|
||||
# g2_still_threshold: 10 # 0.75 - 1.5m / 2.46' - 4.92'
|
||||
# g3_move_threshold: 40 # 1.5 - 2.25m / 4.92' - 7.38'
|
||||
# g3_still_threshold: 10 # 1.5 - 2.25m / 4.92' - 7.38'
|
||||
# g4_move_threshold: 40 # 2.25 - 3m' / 7.38' - 9.84'
|
||||
# g4_still_threshold: 40 # 2.25 - 3m' / 7.38' - 9.84'
|
||||
# g5_move_threshold: 40 # 3 - 3.75 / 9.84' - 12.30'
|
||||
# g5_still_threshold: 40 # 3 - 3.75 / 9.84' - 12.30'
|
||||
# g6_move_threshold: 30 # 3.75 - 4.5m / 12.30' - 14.76'
|
||||
# g6_still_threshold: 15 # 3.75 - 4.5m / 12.30' - 14.76'
|
||||
# g7_move_threshold: 30 # 4.5 - 5.25m / 14.76' - 17.22'
|
||||
# g7_still_threshold: 15 # 4.5 - 5.25m / 14.76' - 17.22'
|
||||
# g8_move_threshold: 30 # 5.25 - 6m / 17.22' - 19.68'
|
||||
# g8_still_threshold: 15 # 5.25 - 6m / 17.22' - 19.68'
|
||||
number:
|
||||
- platform: ld2410
|
||||
timeout:
|
||||
name: Timeout
|
||||
light_threshold:
|
||||
name: Light Threshold
|
||||
max_move_distance_gate:
|
||||
name: Max Move Distance Gate
|
||||
max_still_distance_gate:
|
||||
name: Max Still Distance Gate
|
||||
g0:
|
||||
move_threshold:
|
||||
name: g0 move threshold
|
||||
still_threshold:
|
||||
name: g0 still threshold
|
||||
g1:
|
||||
move_threshold:
|
||||
name: g1 move threshold
|
||||
still_threshold:
|
||||
name: g1 still threshold
|
||||
g2:
|
||||
move_threshold:
|
||||
name: g2 move threshold
|
||||
still_threshold:
|
||||
name: g2 still threshold
|
||||
g3:
|
||||
move_threshold:
|
||||
name: g3 move threshold
|
||||
still_threshold:
|
||||
name: g3 still threshold
|
||||
g4:
|
||||
move_threshold:
|
||||
name: g4 move threshold
|
||||
still_threshold:
|
||||
name: g4 still threshold
|
||||
g5:
|
||||
move_threshold:
|
||||
name: g5 move threshold
|
||||
still_threshold:
|
||||
name: g5 still threshold
|
||||
g6:
|
||||
move_threshold:
|
||||
name: g6 move threshold
|
||||
still_threshold:
|
||||
name: g6 still threshold
|
||||
g7:
|
||||
move_threshold:
|
||||
name: g7 move threshold
|
||||
still_threshold:
|
||||
name: g7 still threshold
|
||||
g8:
|
||||
move_threshold:
|
||||
name: g8 move threshold
|
||||
still_threshold:
|
||||
name: g8 still threshold
|
||||
|
||||
#The ld2410 select allows you to control your LD2410 Sensor.
|
||||
#distance_resolution (Optional): Control the gates distance resolution. Can be 0.75m or 0.2m. Defaults to 0.75m. All options from Select.
|
||||
#baud_rate (Optional): Control the serial port baud rate. Defaults to 256000. Once changed, all sensors will stop working until a fresh install with an updated UART Component configuration. All options from Select.
|
||||
#light_function (Optional): If set, will affect the OUT pin value, based on light threshold. Can be off, low or above. Defaults to off. All options from Select.
|
||||
#out_pin_level (Optional): Control OUT pin away value. Can be low or high. Defaults to low. All options from Select.
|
||||
#ld2410_id (Optional, ID): Manually specify the ID for the LD2410 Sensor component if you are using multiple components.
|
||||
select:
|
||||
- platform: ld2410
|
||||
distance_resolution:
|
||||
name: "distance resolution"
|
||||
baud_rate:
|
||||
name: "baud rate"
|
||||
light_function:
|
||||
name: light function
|
||||
out_pin_level:
|
||||
name: out pin level
|
||||
|
||||
#############################################
|
||||
# General Sensors
|
||||
# https://esphome.io/components/sensor/index.html
|
||||
#############################################
|
||||
sensor:
|
||||
- platform: bme280_i2c
|
||||
temperature:
|
||||
name: ${friendly_name} BME280 Temp
|
||||
accuracy_decimals: 1
|
||||
oversampling: 2x
|
||||
pressure:
|
||||
name: ${friendly_name} BME280 Pressure
|
||||
oversampling: 2x
|
||||
humidity:
|
||||
name: ${friendly_name} BME280 Humidity
|
||||
accuracy_decimals: 1
|
||||
oversampling: 2x
|
||||
address: 0x76
|
||||
update_interval: ${update_time}
|
||||
- platform: uptime
|
||||
name: ${friendly_name} Uptime
|
||||
#The ld2410 sensor values
|
||||
- platform: ld2410
|
||||
light:
|
||||
name: Light
|
||||
moving_distance:
|
||||
name : Moving Distance
|
||||
still_distance:
|
||||
name: Still Distance
|
||||
moving_energy:
|
||||
name: Move Energy
|
||||
still_energy:
|
||||
name: Still Energy
|
||||
detection_distance:
|
||||
name: Detection Distance
|
||||
g0:
|
||||
move_energy:
|
||||
name: g0 move energy
|
||||
still_energy:
|
||||
name: g0 still energy
|
||||
g1:
|
||||
move_energy:
|
||||
name: g1 move energy
|
||||
still_energy:
|
||||
name: g1 still energy
|
||||
g2:
|
||||
move_energy:
|
||||
name: g2 move energy
|
||||
still_energy:
|
||||
name: g2 still energy
|
||||
g3:
|
||||
move_energy:
|
||||
name: g3 move energy
|
||||
still_energy:
|
||||
name: g3 still energy
|
||||
g4:
|
||||
move_energy:
|
||||
name: g4 move energy
|
||||
still_energy:
|
||||
name: g4 still energy
|
||||
g5:
|
||||
move_energy:
|
||||
name: g5 move energy
|
||||
still_energy:
|
||||
name: g5 still energy
|
||||
g6:
|
||||
move_energy:
|
||||
name: g6 move energy
|
||||
still_energy:
|
||||
name: g6 still energy
|
||||
g7:
|
||||
move_energy:
|
||||
name: g7 move energy
|
||||
still_energy:
|
||||
name: g7 still energy
|
||||
g8:
|
||||
move_energy:
|
||||
name: g8 move energy
|
||||
still_energy:
|
||||
name: g8 still energy
|
||||
|
||||
# The ld2410 switch allows you to control your LD2410 Sensor.
|
||||
switch:
|
||||
- platform: ld2410
|
||||
engineering_mode:
|
||||
name: "Engineering Mode"
|
||||
bluetooth:
|
||||
name: "Control Bluetooth"
|
||||
|
||||
#The ld2410 binary sensors to get presence notification
|
||||
binary_sensor:
|
||||
- platform: ld2410
|
||||
has_target:
|
||||
name: Presence
|
||||
has_moving_target:
|
||||
name: Moving Target
|
||||
has_still_target:
|
||||
name: Still Target
|
||||
out_pin_presence_status:
|
||||
name: Out Pin Presence Status
|
||||
|
||||
#The ld2410 button allows resetting
|
||||
button:
|
||||
- platform: ld2410
|
||||
factory_reset:
|
||||
name: "Factory reset"
|
||||
restart:
|
||||
name: "Restart"
|
||||
query_params:
|
||||
name: Query Parameters
|
||||
|
||||
#The ld2410 text sensor allows you to get information about your LD2410 Sensor.
|
||||
text_sensor:
|
||||
- platform: ld2410
|
||||
version:
|
||||
name: "Firmware Version"
|
||||
mac_address:
|
||||
name: "MAC Address"
|
31
esphome/trash/esp-occupancystairs.yaml
Normal file
31
esphome/trash/esp-occupancystairs.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
esphome:
|
||||
name: esp-occupancystairs
|
||||
friendly_name: esp-occupancystairs
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: arduino
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
encryption:
|
||||
key: "SjiVZdG8rekBlk9bEZIE8+cIhvs6Dodj9GuFLFpJypk="
|
||||
|
||||
ota:
|
||||
password: "2b76bfe3274afc8b17020059fec18c96"
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Esp-Occupancystairs"
|
||||
password: "zfhq7q6HYG2J"
|
||||
|
||||
captive_portal:
|
||||
|
Reference in New Issue
Block a user