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

@@ -2,6 +2,8 @@
#############################################
#############################################
# 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/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:
devicename: "esp-occupancyoffice"
friendly_name: "Office State"
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
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
@@ -67,7 +88,7 @@ esp32:
board: esp32dev
framework:
#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
#############################################
@@ -83,12 +104,13 @@ i2c:
#############################################
# 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 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
@@ -121,16 +143,16 @@ ota:
# https://esphome.io/components/wifi.html
#############################################
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
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: 192.168.x.x
#gateway: 192.168.X.x
#subnet: 255.255.255.0
#static_ip: ${static_ip_address}
#gateway: ${static_ip_gateway}
#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
ssid: $devicename fallback AP
password: !secret fallback_ap_password
ssid: ${devicename} fallback AP
password: ${fallback_ap_password}
ap_timeout: 5min #default is 1min
#############################################
@@ -140,8 +162,9 @@ wifi:
#############################################
#web_server:
# port: 80
# username: !secret web_server_username #probably a good idea to secure it
# password: !secret web_server_password
# auth:
# username: ${web_server_username} #probably a good idea to secure it
# password: ${web_server_password}
#############################################
# MQTT Monitoring
@@ -149,10 +172,10 @@ wifi:
# MUST also have api enabled if you enable MQTT
#############################################
mqtt:
broker: !secret mqtt_server
broker: ${mqtt_server}
topic_prefix: ${mqtt_topic}/${devicename}
username: !secret mqtt_username
password: !secret mqtt_password
username: ${mqtt_username}
password: ${mqtt_password}
#############################################
# Bluetooth
@@ -172,25 +195,16 @@ mqtt:
#############################################
# UART Serial
# 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:
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
@@ -370,8 +384,8 @@ sensor:
- heartbeat: 0.2s
#############################################
# Text Sensors (custom component)
# refer https://github.com/ssieb/esphome_components/tree/master/components/serial
# Text Sensors
# refer https://esphome.io/components/text_sensor/index.html
#############################################
text_sensor:
- platform: serial