Files
zorruno-homeassistant/esphome/esp-entmulti.yaml
2025-05-18 16:35:38 +12:00

490 lines
15 KiB
YAML

#############################################
#############################################
#
#
#############################################
#############################################
#############################################
# Variable Substitutions
# Give the device a useful name & description here
# and change values accordingly.
#############################################
substitutions:
devicename: "esp-entmulti"
friendly_name: "Outside Entrance Multisensor"
description_comment: "D1 Mini ESP32 outside entranceway with, mmWave presence, PIR and more"
#if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-entmulti_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-entmulti_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-entmulti_static_ip
#static_ip_gateway: !secret esp-entmulti_gateway
#static_ip_subnet: !secret esp-entmulti_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
#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
# https://esphome.io/components/esphome.html
#############################################
esphome:
name: ${devicename}
friendly_name: ${friendly_name}
comment: ${description_comment} #appears on the esphome page in HA
min_version: 2024.6.0
#############################################
# 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 external or custom components to use
# https://esphome.io/components/external_components.html
# https://github.com/ssieb/esphome_components/tree/master/components/serial
#############################################
#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 binary 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}
# on_client_connected:
# - esp32_ble_tracker.start_scan:
# continuous: true
# on_client_disconnected:
# - esp32_ble_tracker.stop_scan:
#############################################
# Enable Over the Air Update Capability
# https://esphome.io/components/ota.html?highlight=ota
#############################################
ota:
- platform: esphome
password: ${ota_pass}
#############################################
# Safe Mode
# Safe mode will detect boot loops
# https://esphome.io/components/safe_mode
#############################################
safe_mode:
#############################################
# Wifi Settings
# https://esphome.io/components/wifi.html
#
# Power Save mode (can reduce wifi reliability)
# NONE (least power saving, Default for ESP8266)
# LIGHT (Default for ESP32)
# HIGH (most power saving)
#############################################
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
#manual_ip: #optional static IP address
#static_ip: ${static_ip_address}
#gateway: ${static_ip_gateway}
#subnet: ${static_ip_subnet}
ap: #Details for fallback hotspot 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 #Time until it brings up fallback AP. 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
# auth:
# username: ${web_server_username} #probably a good idea to secure it
# password: ${web_server_password}
#############################################
# MQTT Monitoring
# https://esphome.io/components/mqtt.html?highlight=mqtt
# MUST also have api enabled if you enable MQTT
#############################################
mqtt:
broker: ${mqtt_server}
topic_prefix: ${mqtt_topic}/${devicename}
username: ${mqtt_username}
password: ${mqtt_password}
discovery: False # enable entity discovery (true is default)
#discover_ip: True # enable device discovery (true is default)
#############################################
# i2c bus
# https://esphome.io/components/i2c.html
# 10, 50, 100, 200, 800 are possible settings
# for frequency, 50kHz is default
#############################################
#i2c:
# sda: GPIO19
# scl: GPIO21
# scan: True #look for devices on boot up and report
#frequency: 100kHz
#############################################
# UART Serial
# hardware on EPS32, but software, and can be glitchy on ESP8266
# https://esphome.io/components/uart.html
#############################################
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
baud_rate: 256000 # default for LD2410 is 25600, 8, 0, NONE
data_bits: 8
stop_bits: 1
parity: NONE
#############################################
# 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
# cache_services: true
#
#esp32_ble_tracker:
# scan_parameters:
# active: true
# continuous: false
#############################################
# Global Variables for use in automations etc
# https://esphome.io/guides/automations.html?highlight=globals#global-variables
#############################################
#############################################
# 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
#############################################
#############################################
# LD2410 Sensors
# https://esphome.io/components/sensor/ld2410.html
# https://www.hlktech.net/index.php?id=988
#############################################
ld2410:
uart_id: ld2410_uart
#############################################
# Number Sensors (custom component)
# refer https://github.com/ssieb/esphome_components/tree/master/components/serial
#############################################
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: ${friendly_name} LD2140 Distance Resolution
baud_rate:
name: ${friendly_name} LD2140 Baud Rate
light_function:
name: ${friendly_name} LD2140 Light Function
out_pin_level:
name: ${friendly_name} LD2140 Out Pin Level
#############################################
# General Sensors
# https://esphome.io/components/sensor/index.html
#############################################
sensor:
# - platform: bme280_i2c
# address: 0x76
# update_interval: ${update_time}
# 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
################################
# 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: 20s
#retain: true #retain useful if sleeping
- platform: uptime
name: ${friendly_name} Uptime
update_interval: 20s
#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.
#Bluetooth switch is only useful of you have a B or C model
switch:
- platform: ld2410
engineering_mode:
name: ${friendly_name} LD2140 Engineering Mode
#bluetooth:
#name: ${friendly_name} LD2140 Control Bluetooth
#The ld2410 button allows resetting
#button:
# - platform: ld2410
# factory_reset:
# name: ${friendly_name} LD2140 Factory reset"
# restart:
# name: ${friendly_name} LD2140 Restart
## query_params:
# name: Query Parameters
#############################################
# Text Sensors
# refer https://esphome.io/components/text_sensor/index.html
#############################################
#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:
# - platform: ld2410
# version:
# name: ${friendly_name} LD2140 Firmware Version
#mac_address:
#name: ${friendly_name} LD2140 BT MAC Address
#############################################
# Binary Sensors
# https://esphome.io/components/binary_sensor/index.html
#############################################
binary_sensor:
- platform: ld2410
has_target:
name: ${friendly_name} Presence
has_moving_target:
name: ${friendly_name} Moving Target
has_still_target:
name: ${friendly_name} Still Target
out_pin_presence_status:
name: ${friendly_name} LD2140 Out Pin Presence Status
#Standard PIR Sensor
- platform: gpio
pin:
number: GPIO13
mode:
input: True
pullup: False
inverted: True
filters:
- delayed_on: 50ms
name: ${friendly_name} PIR Sensor
device_class: motion
#RF Input from Vibration Sensor (Green Bin)
- platform: gpio
pin:
number: GPIO04
mode:
input: true
pullup: true
inverted: True
filters:
- delayed_on: 20ms
name: ${friendly_name} Green Bin motion
device_class: vibration
#RF Input from Vibration Sensor (Red Bin)
- platform: gpio
pin:
number: GPIO15
mode:
input: true
pullup: true
inverted: True
filters:
- delayed_on: 20ms
name: ${friendly_name} Red Bin motion
device_class: vibration