esphome mi 1s lamp

This commit is contained in:
root
2024-09-04 22:46:30 +12:00
parent 74d1c18615
commit 83549c6c1e
26 changed files with 2934 additions and 929 deletions

View File

@@ -1,65 +1,3 @@
- id: '1671746148141'
alias: Turn Off Xmas Decorations
description: ''
trigger:
- platform: state
entity_id:
- input_boolean.xmas_decorations
from: 'on'
to: 'off'
condition: []
action:
- type: turn_off
device_id: bbfa51e4e883fafa1d38824f11d83ba1
entity_id: switch.xmas_decoration_power_plug_zpp02
domain: switch
- type: turn_off
device_id: 506b3518661f7b2854e42ba5a26e0610
entity_id: switch.kogan_smarterhometm_smart_plug_new_socket_1
domain: switch
- type: turn_off
device_id: a9865914a7b7de1e81d1df47784282a8
entity_id: switch.tasmota_5
domain: switch
mode: single
- id: '1671746242166'
alias: Turn On Xmas Decorations
description: ''
trigger:
- platform: state
entity_id:
- input_boolean.xmas_decorations
from: 'off'
to: 'on'
condition: []
action:
- type: turn_on
device_id: bbfa51e4e883fafa1d38824f11d83ba1
entity_id: switch.xmas_decoration_power_plug_zpp02
domain: switch
- type: turn_on
device_id: 506b3518661f7b2854e42ba5a26e0610
entity_id: switch.kogan_smarterhometm_smart_plug_new_socket_1
domain: switch
- type: turn_on
device_id: a9865914a7b7de1e81d1df47784282a8
entity_id: switch.tasmota_5
domain: switch
mode: single
- id: '1682158655752'
description: ''
trigger:
- platform: state
entity_id:
- group.basement_lights
- group.foxhole_lights
to: 'ON'
from: 'OFF'
condition:
- condition: or
conditions: []
action: []
mode: single
- id: '1693027703299'
alias: Downstairs Kitchen turn ON LEDs on with main lights
description: ''

View File

@@ -24,14 +24,27 @@ conversation:
logger:
default: info
logs:
custom_components.hacs: debug
custom_components.evnex: debug
evnex: debug
# logs:
#custom_components.hacs: debug
#custom_components.evnex: debug
#evnex: debug
zha:
enable_quirks: true
custom_quirks_path: /config/custom_zha_quirks/
device_config: # https://community.home-assistant.io/t/turning-a-light-entity-to-switch-entity/589599/7
a4:c1:38:02:58:65:86:ed-1: # format: {ieee}-{endpoint_id}
type: “switch” # corrected device type
a4:c1:38:a1:db:1d:38:b7-1: # format: {ieee}-{endpoint_id}
type: “switch” # corrected device type
zigpy_config:
ota:
otau_directory: /config/zigpy_ota
ikea_provider: true
ledvance_provider: true
salus_provider: true
inovelli_provider: true
thirdreality_provider: true
device_tracker:
- platform: bluetooth_le_tracker

View File

@@ -19,19 +19,36 @@ substitutions:
description_comment: "Atto3 12V Battery Monitor (when home)"
api_key: !secret esp-attobat_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-attobat_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
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
#A static IP will speed things up slightly in that it doesn't have to negotiate DHCP
static_ip_address: !secret esp-attobat_static_ip
static_ip_gateway: !secret esp-attobat_gateway
static_ip_subnet: !secret esp-attobat_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_commandstopic: "viewroad-commands" #main topic for commands (ie sleep), call it what you like
#web_server_username: !secret web_server_username
#web_server_password: !secret web_server_password
update_time: 10s #update time for for general temp sensors etc
#############################################
# ESPHome
#############################################
# https://esphome.io/components/esphome.html
#############################################
esphome:
name: $devicename
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
@@ -66,39 +83,49 @@ api:
# https://esphome.io/components/ota.html?highlight=ota
#############################################
ota:
safe_mode: true #Safe mode will detect boot loops
password: ${ota_pass}
- 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: !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
# Static IP (for lower power/quicker on time)
manual_ip:
manual_ip: #optional static IP address
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
ap_timeout: 5min #default is 1min
captive_portal: # Fallback captive portal https://esphome.io/components/captive_portal.html
password: ${fallback_ap_password}
ap_timeout: 30min #Time until it brings up fallback AP. default is 1min
#############################################
# Web Portal for display and monitoring
#############################################
web_server:
port: 80
version: 2
include_internal: true
ota: false
auth:
username: !secret web_server_username
password: !secret web_server_password
#version: 2
#include_internal: true
#ota: false
#auth:
#username: ${web_server_username}
#password: ${web_server_password}
#############################################
# MQTT Monitoring
@@ -106,29 +133,42 @@ web_server:
# 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}
# Availability Topic
#birth_message:
# topic: esphome/esp-leafbat2/availability
# payload: online
#will_message:
# topic: esphome/esp-leafbat2/availability
# payload: offline
birth_message:
topic: ${mqtt_topic}/${devicename}/availability
payload: online
will_message:
topic: ${mqtt_topic}/${devicename}/availability
payload: offline
# A way to prevent deep sleep using MQTT command
on_message:
- topic: viewroad-commands/attobat/deepsleep
payload: 'OFF'
- topic: ${mqtt_commandstopic}/${devicename}/deepsleep
payload: "OFF"
then:
- deep_sleep.prevent: deep_sleep_1
- topic: viewroad-commands/attobat/deepsleep
payload: 'ON'
- topic: ${mqtt_commandstopic}/${devicename}/deepsleep
payload: "ON"
then:
- deep_sleep.enter: deep_sleep_1
# on_message:
# - topic: ${mqtt_commandstopic}/${devicename}/deepsleepon
# payload: 'ON'
# then:
# - deep_sleep.prevent: deep_sleep_1
# - topic: ${mqtt_commandstopic}/${devicename}/deepsleepoff
# payload: 'OFF'
# then:
# - deep_sleep.enter: deep_sleep_1
########################################
# Deep Sleep
# https://esphome.io/components/deep_sleep.html
@@ -144,27 +184,32 @@ deep_sleep:
#############################################
#############################################
sensor:
# Quality of Wifi in dBm
#Quality of Wifi in dBm
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 10s
retain: true
# Analog sensor for voltage reading (A0)
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
#Analog sensor for voltage reading (A0)
- platform: uptime
name: "Uptime"
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
- platform: adc
pin: A0
name: "Battery Voltage"
update_interval: 10s
retain: true
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
filters:
#- multiply: 18.52 # trial and error calc/measure
- calibrate_linear:
- 0.41 -> 6.00
- 0.48 -> 7.00
- 0.54 -> 8.00
- 0.61 -> 9.00
- 0.68 -> 10.00
- 0.75 -> 11.00
- 0.81 -> 12.00
- 0.88 -> 13.00
- 0.94 -> 13.99
- 0.99 -> 14.70
- multiply: 3.3 #D1 mini V divider, 3.3V -> 1V on esp8266
- calibrate_linear: #Read values with voltmeter and bench supply
- 3.11 -> 14.00
- 3.00 -> 13.50
- 2.89 -> 13.00
- 2.77 -> 12.50
- 2.67 -> 12.00
- 2.55 -> 11.50
- 2.45 -> 11.00
- 2.34 -> 10.50
- 2.22 -> 10.00
- 2.11 -> 09.50
- 2.00 -> 09.00

View File

@@ -1,131 +0,0 @@
#############################################
#############################################
#
#############################################
#############################################
#############################################
# 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

189
esphome/esp-entbtproxy.yaml Normal file
View File

@@ -0,0 +1,189 @@
#############################################
# Variable Substitutions
# Give the device a useful name & description here
# and change values accordingly.
#############################################
substitutions:
devicename: "esp-entbtproxy"
friendly_name: "Outside Entrance Bluetooth Proxy"
description_comment: "D1 Mini ESP32 outside entranceway with BT Proxy"
#if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-entbyproxy_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-entbtproxy_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 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
captive_portal:
#############################################
# 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}
#############################################
# 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:
scan_parameters:
# We currently use the defaults to ensure Bluetooth
# can co-exist with WiFi In the future we may be able to
# enable the built-in coexistence logic in ESP-IDF
active: true
button:
- platform: safe_mode
id: button_safe_mode
name: Safe Mode Boot
- platform: factory_reset
id: factory_reset_btn
name: Factory reset
sensor:
################################
# 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: 10s

View File

@@ -0,0 +1,488 @@
#############################################
#############################################
#
#
#############################################
#############################################
#############################################
# 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}
#############################################
# 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

488
esphome/esp-entmulti.yaml Normal file
View File

@@ -0,0 +1,488 @@
#############################################
#############################################
#
#
#############################################
#############################################
#############################################
# 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}
#############################################
# 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: True
inverted: True
filters:
- delayed_on: 200ms
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

View File

@@ -0,0 +1,205 @@
# This is a generic starter yaml file for
# espHome, by zorruno 2024
# <DEVICENAME> would be something like loungefancontroller
# yaml file would then be esp-loungefancontroller.yaml
#############################################
#############################################
# TITLE
# Details of what the device is plus
# any relevant web links
#############################################
#############################################
#############################################
# SECRETS
# Secrets file is usually at config/secrets.yaml
# or config/esphome/secrets.yaml
# depending on your setup with HA
#############################################
# SECRETS FILE needs these specific secrets:
# esp-<DEVICENAME>_api_key
# esp-<DEVICENAME>_ota_pass
# esp-<DEVICENAME>_static_ip (Optional)
# esp-<DEVICENAME>_gateway (Optional)
# esp-<DEVICENAME>_subnet (Optional)
#
# SECRETS FILE needs these generic Secrets:
# wifi_ssid
# wifi_password
# fallback_ap_password
# mqtt_server
# mqtt_username
# mqtt_password
# web_server_username (Optional)
# web_server_password (Optional)
#############################################
#############################################
# VARIABLE SUBSTITUTIONS
# Give the device a useful name & description here
# and change values accordingly.
#############################################
substitutions:
device_name: esp-<DEVICENAME>
friendly_name: "Device friendly name"
description_comment: "A Description of this device"
# if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-<DEVICENAME>_api_key # unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-<DEVICENAME>_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-<DEVICENAME>_static_ip
#static_ip_gateway: !secret esp-<DEVICENAME>_gateway
#static_ip_subnet: !secret esp-<DEVICENAME>_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: 60s # update time for for general temp sensors etc
#############################################
# ESPHome
# https://esphome.io/components/esphome.html
#############################################
esphome:
name: ${device_name}
friendly_name: ${friendly_name} # appears as main name on the esphome page in HA
comment: ${description_comment} # appears as comment on the esphome page in HA
#min_version: 2024.6.0
#############################################
# ESP Platform and Framework
# https://esphome.io/components/esp32.html
#############################################
esp32:
board: <ESP-DEVICE>
framework:
type: esp-idf # Suggest using the ESP-IDF Framework. Changing from 'arduino' to 'esp-idf' needs a cabled flash to correct partitions
version: recommended # recommended, latest or dev
#############################################
# ESPHome Logging Enabl
# 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:
- 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: ${device_name} fallback AP
password: ${fallback_ap_password}
ap_timeout: 30min # 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}/${device_name}
username: ${mqtt_username}
password: ${mqtt_password}
#############################################
# Time Component
# https://esphome.io/components/time/index.html#time-component
# Sync with HA Time. Probably not really necessary.
#############################################
#time:
# - platform: homeassistant
# id: homeassistant_time
#############################################
# Text Sensors
# https://esphome.io/components/text_sensor/index.html
#############################################
text_sensor:
- platform: version
name: ${friendly_name} Version
- platform: wifi_info
ip_address:
name: ${friendly_name} IP Address
#############################################
# General Sensors
# https://esphome.io/components/sensor/index.html
#############################################
sensor:
- platform: uptime # Uptime for this device
name: ${friendly_name} Uptime
update_interval: ${update_time}
- platform: wifi_signal # Wifi Strength
name: ${friendly_name} Wifi Signal
update_interval: ${update_time}
#############################################
# Binary Sensors
# https://esphome.io/components/binary_sensor/index.html
#############################################
#binary_sensor:

247
esphome/esp-leafbat.yaml Normal file
View File

@@ -0,0 +1,247 @@
#############################################
#############################################
# BYD ATTO3 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/
##############################################
#############################################
#############################################
# Variable Substitutions
#############################################
substitutions:
devicename: "esp-leafbat"
friendly_name: "Nissan Leaf 12V Battery Monitor"
description_comment: "Nissan Leaf 12V Battery Monitor (when home)"
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
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
#A static IP will speed things up slightly in that it doesn't have to negotiate DHCP
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" #main topic for the mqtt server, call it what you like
mqtt_commandstopic: "viewroad-commands" #main topic for commands (ie sleep), call it what you like
#web_server_username: !secret web_server_username
#web_server_password: !secret web_server_password
update_time: 10s #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/esp8266.html
# https://esphome.io/components/esp32.html
#############################################
esp8266:
board: d1_mini
framework:
version: latest #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
#uart:
# id: uart_output
# tx_pin: GPIO12
# rx_pin: GPIO13
# baud_rate: 9600
#############################################
# 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:
- 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 (captive portal) in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode
ssid: ${devicename} fallback AP
password: ${fallback_ap_password}
ap_timeout: 30min #Time until it brings up fallback AP. default is 1min
#############################################
# Web Portal for display and monitoring
#############################################
web_server:
port: 80
#version: 2
#include_internal: true
#ota: false
#auth:
#username: ${web_server_username}
#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}
# Availability Topic
birth_message:
topic: ${mqtt_topic}/${devicename}/availability
payload: online
will_message:
topic: ${mqtt_topic}/${devicename}/availability
payload: offline
# A way to prevent deep sleep using MQTT command
on_message:
- topic: ${mqtt_commandstopic}/${devicename}/deepsleep
payload: 'OFF'
then:
- deep_sleep.prevent: deep_sleep_1
- topic: ${mqtt_commandstopic}/${devicename}/deepsleep
payload: 'ON'
then:
- deep_sleep.enter: deep_sleep_1
########################################
# Deep Sleep
# https://esphome.io/components/deep_sleep.html
########################################
deep_sleep:
run_duration: 20s
sleep_duration: 5min
id: deep_sleep_1
#time:
# - platform: homeassistant
# id: ha_time
# timezone: Pacific/Auckland
#text_sensor:
# - platform: template
# name: "Current time"
# id: current_time
# lambda: return id(ha_time).now().strftime("%H%M");
# lambda: |-
# char str[17];
# time_t currTime = id(ha_time).now().timestamp;
# strftime(str, sizeof(str), "%Y-%m-%d %H:%M", localtime(&currTime));
# return { str };
# update_interval: ${update_time}
#############################################
#############################################
# MAIN SENSORS
#############################################
#############################################
sensor:
#Quality of Wifi in dBm
- platform: wifi_signal
name: "WiFi Signal"
id: wifi_strength
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
#Analog sensor for voltage reading (A0)
- platform: uptime
name: "Uptime"
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
- platform: adc
pin: A0
name: "Battery Voltage"
id: battery_voltage
#mqtt_id: battery_voltage
update_interval: ${update_time}
retain: true #Retain this as you'll have no value between sleeps otherwise
# This set used a voltage divider with a 100k and a 4.7k R value
filters:
- multiply: 3.3 #D1 mini V divider, 3.3V -> 1V on esp8266
- calibrate_linear: #Read values with voltmeter and bench supply
- 0.72 -> 16.00
- 0.68 -> 15.00
- 0.63 -> 14.00
- 0.59 -> 13.00
- 0.55 -> 12.00
- 0.51 -> 11.00
- 0.45 -> 10.00
- 0.40 -> 09.00
- 0.36 -> 08.00
- 0.32 -> 07.00
- 0.28 -> 06.00
- 0.23 -> 05.00
# on_value:
# - logger.log:
# level: INFO
# format: "time,%s,battery,%.1f,wifi,%.1f"
# args: [ 'id(ha_time).now()', 'id(battery_voltage).state', 'id(wifi_strength).state' ]
# - uart.write:
# id: uart_output
# data: !lambda char buf[128];
# sprintf(buf, "%s", id(battery_voltage).state);
# std::string s = buf;
# return std::vector<unsigned char>( s.begin(), s.end() );
# - logger.log:
# level: INFO
# format: "time,%.1f,battery,%.1f,wifi,%.1f"
# args: [ 'id(sntp_time).now()', 'id(battery_voltage).state', 'id(wifi_strength).state' ]

View File

@@ -1,177 +0,0 @@
#############################################
#############################################
# 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:
devicename: "esp-leafbat2"
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:
name: ${devicename}
comment: ${description_comment} #appears on the esphome page in HA
########################################
# Specific board for ESPHome device
########################################
esp8266:
board: d1_mini
#############################################
# ESPHome Logging Enable
#############################################
logger:
########################################
# Enable the Home Assistant API
########################################
api:
encryption:
key: ${api_key}
########################################
# Enable Over the Air Update Capability
# Safe mode will detect boot loops
########################################
ota:
safe_mode: true
password: ${ota_pass}
########################################
# Use Wifi
# (credentials are in secrets file)
########################################
wifi:
ssid: ${wifi_ssid}
password: ${wifi_password}
# Details for fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: ${fallback_ap_ssid}
password: ${fallback_ap_password}
# Static IP (for lower power/quicker on time)
manual_ip:
static_ip: ${static_ip_address}
gateway: ${static_ip_gateway}
subnet: ${static_ip_subnet}
#############################################
# Fallback captive portal
#############################################
captive_portal:
########################################
# Web Portal for display and monitoring
########################################
web_server:
port: 80
auth:
username: ${web_server_username}
password: ${web_server_password}
########################################
# MQTT Monitoring
########################################
mqtt:
broker: ${mqtt_server}
topic_prefix: ${mqtt_topic}
username: ${mqtt_username}
password: ${mqtt_password}
#
# Availability Topic
#birth_message:
# topic: esphome/esp-leafbat2/availability
# payload: online
#will_message:
# topic: esphome/esp-leafbat2/availability
# payload: offline
# A way to prevent deep sleep using MQTT command
on_message:
- topic: viewroad-commands/leafbat2/deepsleep
payload: 'ON'
then:
- deep_sleep.prevent: deep_sleep_1
- topic: viewroad-commands/leafbat2/deepsleep
payload: 'ON'
then:
- deep_sleep.enter: deep_sleep_1
########################################
# Deep Sleep
########################################
deep_sleep:
run_duration: 20s
sleep_duration: 10min
id: deep_sleep_1
#############################################
#############################################
# MAIN SENSORS
#############################################
#############################################
sensor:
# Quality of Wifi in dBm
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 10s
retain: true
# Analog sensor for voltage reading (A0)
- platform: adc
pin: A0
name: "Battery Voltage"
update_interval: 10s
retain: true
filters:
- multiply: 18.52 # trial and error calc/measure
- calibrate_linear:
- 5.99 -> 6.0
- 11.98 -> 11.99
- 16.98 -> 16.98
#name: "Battery Voltage"
# Optional variables:
#retain: true

View File

@@ -69,8 +69,15 @@ api:
# https://esphome.io/components/ota.html?highlight=ota
#############################################
ota:
safe_mode: true #Safe mode will detect boot loops
password: ${ota_pass}
- platform: esphome
password: ${ota_pass}
#############################################
# Safe Mode
# Safe mode will detect boot loops
# https://esphome.io/components/safe_mode
#############################################
safe_mode:
#############################################
# Wifi Settings
@@ -80,20 +87,21 @@ ota:
# NONE (least power saving, Default for ESP8266)
# LIGHT (Default for ESP32)
# HIGH (most power saving)
#############################################
#############################################
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
ap_timeout: 5min #default is 1min
captive_portal: # Fallback captive portal https://esphome.io/components/captive_portal.html
ssid: ${devicename} fallback AP
password: ${fallback_ap_password}
ap_timeout: 30min #Time until it brings up fallback AP. default is 1min
captive_portal:
#############################################
# Web Portal for display and monitoring
@@ -127,7 +135,6 @@ mqtt:
# PEZEM4 Power Monitoring
# https://esphome.io/components/sensor/pzemac.html
#############################################
uart:
rx_pin: GPIO3
tx_pin: GPIO1

View File

@@ -0,0 +1,291 @@
#############################################
#############################################
# Mi Smart LED Desk Lamp 1S
# ESP32, LED Strip with variable white colour temp, rotary encoder
# https://www.mi.com/global/product/mi-led-desk-lamp-1s/
#############################################
#############################################
#############################################
# SECRETS
# Secrets file is usually at config/secrets.yaml
# or config/esphome/secrets.yaml
# depending on your setup with HA
#############################################
# SECRETS FILE needs these specific secrets:
# esp-midesklamp1s_api_key
# esp-midesklamp1s_ota_pass
# esp-midesklamp1s_static_ip (Optional)
# esp-midesklamp1s_gateway (Optional)
# esp-midesklamp1s_subnet (Optional)
#
# SECRETS FILE needs these generic Secrets:
# wifi_ssid
# wifi_password
# fallback_ap_password
# mqtt_server
# mqtt_username
# mqtt_password
# web_server_username (Optional)
# web_server_password (Optional)
#############################################
#############################################
# VARIABLE SUBSTITUTIONS
# Give the device a useful name & description here
# and change values accordingly.
#############################################
substitutions:
device_name: esp-midesklamp1s
friendly_name: "Mi 1S Lamp Office "
description_comment: "Office Desk Lamp with variable white colour temp and rotary encoder for brightness"
# if NOT using a secrets file, just replace these with the passwords etc (in quotes)
api_key: !secret esp-midesklamp1s_api_key # unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-midesklamp1s_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-midesklamp1s_static_ip
#static_ip_gateway: !secret esp-midesklamp1s_gateway
#static_ip_subnet: !secret esp-midesklamp1s_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: 60s # update time for for general temp sensors etc
#############################################
# ESPHome
# https://esphome.io/components/esphome.html
#############################################
esphome:
name: ${device_name}
friendly_name: ${friendly_name} # appears as main name on the esphome page in HA
comment: ${description_comment} # appears as comment on the esphome page in HA
#min_version: 2024.6.0
#############################################
# ESP Platform and Framework
# https://esphome.io/components/esp32.html
#############################################
esp32:
board: esp32doit-devkit-v1
framework:
type: esp-idf # Suggest using the ESP-IDF Framework. Changing from 'arduino' to 'esp-idf' needs a cabled flash to correct partitions
version: recommended # recommended, latest or dev
# these just for the esp32doit-devkit-v1 and Mi S Lamp
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
advanced:
ignore_efuse_mac_crc: true
#############################################
# ESPHome Logging Enabl
# 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:
- 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: ${device_name} fallback AP
password: ${fallback_ap_password}
ap_timeout: 30min # 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}/${device_name}
username: ${mqtt_username}
password: ${mqtt_password}
#############################################
# Time Component
# https://esphome.io/components/time/index.html#time-component
# Sync with HA Time. Probably not really necessary.
#############################################
time:
- platform: homeassistant
id: homeassistant_time
#############################################
# Text Sensors
# https://esphome.io/components/text_sensor/index.html
#############################################
text_sensor:
- platform: version
name: ${friendly_name} Version
- platform: wifi_info
ip_address:
name: ${friendly_name} IP Address
#############################################
# General Sensors
# https://esphome.io/components/sensor/index.html
#############################################
sensor:
- platform: uptime # Uptime for this device
name: ${friendly_name} Uptime
update_interval: ${update_time}
- platform: wifi_signal # Wifi Strength
name: ${friendly_name} Wifi Signal
update_interval: ${update_time}
# Mi Desk Lamp 1S Configuration
- platform: rotary_encoder
id: rotation
pin_a: GPIO27
pin_b: GPIO26
resolution: 2
on_value:
then:
- if:
condition:
# Check if Button is pressed while rotating
lambda: "return id(button).state;"
then:
# If Button is pressed, change CW/WW
- lambda: |-
auto min_temp = id(light1).get_traits().get_min_mireds();
auto max_temp = id(light1).get_traits().get_max_mireds();
auto cur_temp = id(light1).current_values.get_color_temperature();
auto new_temp = max(min_temp, min(max_temp, cur_temp + (x*10)));
auto call = id(light1).turn_on();
call.set_color_temperature(new_temp);
call.perform();
else:
# If Button is not pressed, change brightness
- light.dim_relative:
id: light1
relative_brightness: !lambda |-
return x / 25.0;
# Reset Rotation to 0
- sensor.rotary_encoder.set_value:
id: rotation
value: 0
#############################################
# Binary Sensors
# https://esphome.io/components/binary_sensor/index.html
#############################################
binary_sensor:
- platform: gpio
id: button
pin:
number: GPIO33
inverted: True
mode: INPUT_PULLDOWN
on_click:
then:
- light.toggle:
id: light1
transition_length: 0.2s
#############################################
# Base Output Component
# https://esphome.io/components/output/index.html#base-output-configuration
#############################################
output:
- platform: ledc # Cool White LED PWM
pin: GPIO2
id: output_cw
frequency: 40000Hz
power_supply: power
- platform: ledc
pin: GPIO4 # Warm White LED PWM
id: output_ww
power_supply: power
frequency: 40000Hz
#############################################
# Power Supply Component
# https://esphome.io/components/power_supply.html#power-supply-component
#############################################
power_supply:
- id: power
pin: GPIO12
enable_time: 0s
keep_on_time: 0s
#############################################
# Light Component
# https://esphome.io/components/light/index.html#light-component
#############################################
light:
- platform: cwww # https://esphome.io/components/light/cwww.html#cold-white-warm-white-light
id: light1
default_transition_length: 0s
constant_brightness: true
name: "${friendly_name} Light"
cold_white: output_cw
warm_white: output_ww
cold_white_color_temperature: 4800 K
warm_white_color_temperature: 2500 K # 2500k is the original value of the lamp. To correct binning for 2700k to look more like 2700k use 2650k instead
restore_mode: ALWAYS_ON
gamma_correct: 0

View File

@@ -1,439 +0,0 @@
#############################################
#############################################
# 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

View File

@@ -1,4 +1,3 @@
#############################################
#############################################
# HiLink LD1125H mmWave sensor, with BME280 Temp/Hum/Pres Sensor on an ESP32
@@ -24,7 +23,7 @@
#############################################
substitutions:
devicename: "esp-occupancyoffice"
friendly_name: "Office State"
friendly_name: "Office Occupancy & Environment"
description_comment: "D1 Mini ESP32 with LD1125H mmWave and environment sensors for downstairs office"
#if NOT using a secrets file, just replace these with the passwords etc (in quotes)
@@ -54,7 +53,9 @@ substitutions:
#############################################
esphome:
name: ${devicename}
friendly_name: ${friendly_name}
comment: ${description_comment} #appears on the esphome page in HA
min_version: 2024.6.0
on_boot: #LD1125H Initial Setting, will remember previous values (if set)
priority: -200
then:
@@ -84,23 +85,12 @@ esphome:
# https://esphome.io/components/esp32.html
#############################################
esp32:
#board: nodemcu-32s
board: esp32dev
framework:
#type: arduino
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
#############################################
# 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
@@ -129,14 +119,26 @@ logger:
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:
safe_mode: true #Safe mode will detect boot loops
password: ${ota_pass}
- platform: esphome
password: ${ota_pass}
#############################################
# Safe Mode
# Safe mode will detect boot loops
# https://esphome.io/components/safe_mode
#############################################
safe_mode:
#############################################
# Wifi Settings
@@ -155,10 +157,10 @@ wifi:
#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
ap: #Details for fallback hotspot in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode
ssid: ${devicename} fallback AP
password: ${fallback_ap_password}
ap_timeout: 5min #default is 1min
ap_timeout: 30min #Time until it brings up fallback AP. default is 1min
#############################################
# Web Portal for display and monitoring
@@ -182,20 +184,17 @@ mqtt:
username: ${mqtt_username}
password: ${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:
#############################################
# 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: 50kHz
#############################################
# UART Serial
@@ -211,6 +210,24 @@ uart:
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:
continuous: false
#############################################
# Global Variables for use in automations etc
# https://esphome.io/guides/automations.html?highlight=globals#global-variables
@@ -374,8 +391,10 @@ sensor:
oversampling: 2x
address: 0x76
update_interval: ${update_time}
- platform: uptime
name: ${friendly_name} Uptime
- platform: template
name: ${friendly_name} LD1125H Distance
id: LD1125H_Distance

View File

@@ -18,7 +18,7 @@
#############################################
substitutions:
devicename: "esp-occupancystair"
friendly_name: "Stair Occupancy"
friendly_name: "Stair Occupancy and Underhouse Environment"
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
@@ -46,7 +46,9 @@ substitutions:
#############################################
esphome:
name: ${devicename}
friendly_name: ${friendly_name}
comment: ${description_comment} #appears on the esphome page in HA
min_version: 2024.6.0
#on_boot: #Initial Setting, will remember previous values (if set)
#priority: -200
#then:
@@ -95,8 +97,15 @@ api:
# https://esphome.io/components/ota.html?highlight=ota
#############################################
ota:
safe_mode: true #Safe mode will detect boot loops
password: ${ota_pass}
- platform: esphome
password: ${ota_pass}
#############################################
# Safe Mode
# Safe mode will detect boot loops
# https://esphome.io/components/safe_mode
#############################################
safe_mode:
#############################################
# Wifi Settings
@@ -115,18 +124,18 @@ wifi:
#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
ap: #Details for fallback hotspot in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode
ssid: ${devicename} fallback AP
password: ${fallback_ap_password}
ap_timeout: 5min #default is 1min
ap_timeout: 30min #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
#web_server:
# port: 80
# auth:
# username: ${web_server_username} #probably a good idea to secure it
# password: ${web_server_password}

View File

@@ -171,9 +171,15 @@ api:
#############################################
ota:
- platform: esphome
#safe_mode: true #Safe mode will detect boot loops
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
@@ -191,10 +197,10 @@ wifi:
#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
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 #default is 1min
ap_timeout: 30min #default is 1min
#############################################
# Web Portal for display and monitoring
@@ -473,9 +479,9 @@ sensor:
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
# 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

228
esphome/esp-winefridge.yaml Normal file
View File

@@ -0,0 +1,228 @@
#############################################
#############################################
#############################################
#############################################
#############################################
# Variable Substitutions
# Give this a useful name & description here
# and change values accordingly
#############################################
substitutions:
devicename: "esp-winefridge"
friendly_name: "Wine Fridge Controller"
description_comment: "Peltier based wine fridge thermostat controller"
#if NOT using a secrets file, just replace these with the passwords etc in speech marks
api_key: !secret esp-winefridge_api_key #unfortunately you can't use substitutions in secrets names
ota_pass: !secret esp-winefridge_ota_pass #unfortunately you can't use substitutions in secrets names
wifi_ssid: !secret wifi_ssid
wifi_pass: !secret wifi_password
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 various temp sensors etc
#############################################
# ESPHome
# https://esphome.io/components/esphome.html
#############################################
esphome:
name: ${devicename}
comment: ${description_comment} #appears on the esphome page in HA
#on_boot: #Initial Setting stuff
#priority: -200
#then:
#############################################
# ESP Platform and Framework
# https://esphome.io/components/esp32.html OR
# https://esphome.io/components/esp8266.html
#############################################
#esp32:
# board:
# framework:
# type: arduino
# #type: esp-idf #Suggested Use ESP-IDF Framework for ESP32, or unplugging the UART Cable Might Cause ESP32 Hang.
# version: recommended #recommended, latest or dev
esp8266:
board: d1_mini
#############################################
# 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:
- 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_pass}
#power_save_mode: LIGHT #https://esphome.io/components/wifi.html#wifi-power-save-mode
#manual_ip: #optional static IP address
#static_ip: 192.168.x.x
#gateway: 192.168.X.x
#subnet: 255.255.255.0
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: 30min #default is 1min
#############################################
# Web Portal for display and monitoring
# Turning this off if you don't really need it
# is probably a good idea to save resources.
# Also, don't use it with other big ESP32 components
# such as Bluetooth proxy (it will run out of flash
# and not compile, or it will crash occasionally)
# https://esphome.io/components/web_server.html
#############################################
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
#############################################
# 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}
#############################################
# General espHome status LED
# Not needed, but can be useful to see issues
# https://esphome.io/components/status_led.html
#############################################
status_led:
pin:
number: GPIO2 #Wemos ESP32 and ESP8266 Onboard LEDs use GPIO2
inverted: false
#ignore_strapping_warning: True #https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
#############################################
#############################################
# General Sensors
# https://esphome.io/components/sensor/index.html
#############################################
#############################################
sensor:
################################
# 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
- platform: resistance
sensor: temp_analogue
configuration: DOWNSTREAM
resistor: 4.7kOhm
name: Resistance Sensor
- platform: adc
id: temp_analogue
#update_interval: 10s
update_interval: never #don't update until the correect GPIO turns on. This allows two devices on one AI.
name: "Temp Analogue"
pin: A0
filters:
- multiply: 3.3
- platform: template
name: "Analogue Sensor 1"
update_interval: never
id: template_analoguesensor_1
lambda: |-
return id(temp_analogue);
- platform: template
name: "Analogue Sensor 2"
update_interval: never
id: template_analoguesensor_2
lambda: |-
return id(temp_analogue);
# lambda: |- return float(id(ch1s));
switch:
- platform: gpio
pin: D0
id: a1_sensor_vcc
- platform: gpio
pin: D1
id: a2_sensor_vcc
interval:
- interval: 60s
then:
- switch.turn_on: a1_sensor_vcc
- component.update: temp_analogue
- component.update: template_analoguesensor_1
- switch.turn_off: a1_sensor_vcc
- switch.turn_on: a2_sensor_vcc
- component.update: temp_analogue
- component.update: template_analoguesensor_2
- switch.turn_off: a2_sensor_vcc

View File

@@ -0,0 +1,486 @@
#############################################
#############################################
#
# 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
#
# 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
# Give the device a useful name & description here
# and change values accordingly.
#############################################
substitutions:
devicename: "esp-entmulti"
friendly_name: "Entrance Multisensor"
description_comment: "D1 Mini ESP32 outside entranceway with BT Proxy, mmWave presence 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}
comment: ${description_comment} #appears on the esphome page in HA
#############################################
# 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: DEBUG #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:
- 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}
#############################################
# 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
esp32_ble_tracker:
#############################################
# 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: 10s
#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: 200ms
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
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

View File

@@ -0,0 +1,7 @@
sensor:
- platform: anniversary
name: events
multiple: false
anniversaries:
- event: "Holiday"
date: "2024-9-14"

View File

@@ -2,7 +2,7 @@ mqtt:
switch:
- unique_id: mollies.internet
name: "Mollie's Internet Blocking"
state_topic: "viewroad-status/firewall/block-unblock-mollie-iphone7"
state_topic: "viewroad-status/firewall/block-unblock-mollie-iphone8"
command_topic: "viewroad-commands/firewall/block-unblock-mollie-devices"
payload_off: "Unblocked"
payload_on: "Blocked"
@@ -21,3 +21,9 @@ mqtt:
payload_press: "Unblocked"
icon: mdi:web
retain: false
- unique_id: mollies.internet.temp.unblock.1hr
name: "Mollie's Internet (1hr Unblock)"
command_topic: "viewroad-commands/firewall/tempunblock-mollie-devices-1hr"
payload_press: "Unblocked"
icon: mdi:web
retain: false

View File

@@ -0,0 +1,45 @@
automation:
- id: publish_fridge_temps_drinks_fridge
alias: publish_fridge_temps_drinks_fridge
trigger:
- platform: state
entity_id: sensor.drinks_fridge_environment_lcd_btt01_temperature
not_to:
- "unavailable"
- "unknown"
action:
- service: mqtt.publish
data:
topic: "viewroad-status/fridges/drinks-fridge"
payload: "{{ trigger.to_state.state }}"
mode: single
- id: publish_freezer_temps_drinks_fridge
alias: pub_freezer_temps_drinks_fridge
trigger:
- platform: state
entity_id: sensor.drinks_freezer_environment_lcd_btt02_temperature
not_to:
- "unavailable"
- "unknown"
action:
- service: mqtt.publish
data:
topic: "viewroad-status/fridges/drinks-freezer"
payload: "{{ trigger.to_state.state }}"
mode: single
- id: publish_main_kitchen_fridge_temp_zth08
alias: publish_main_kitchen_fridge_temp_zth08
trigger:
- platform: state
entity_id: sensor.main_kitchen_fridge_temp_zth08
not_to:
- "unavailable"
- "unknown"
action:
- service: mqtt.publish
data:
topic: "viewroad-status/fridges/mainkitchen_fridge"
payload: "{{ trigger.to_state.state }}"
mode: single

View File

@@ -1,5 +1,5 @@
media_player:
# MPD Media Player on Lounge Touchscreen
- platform: mpd
host: !secret lounge_mpd_player
scan_interval: 1
#media_player:
# MPD Media Player on Lounge Touchscreen
# - platform: mpd
# host: !secret lounge_mpd_player
# scan_interval: 1

View File

@@ -0,0 +1,20 @@
input_text:
teams_status:
name: Microsoft Teams status
icon: mdi:microsoft-teams
teams_activity:
name: Microsoft Teams activity
icon: mdi:phone-off
sensor:
- platform: template
sensors:
teams_status:
friendly_name: "Microsoft Teams status"
value_template: "{{states('input_text.teams_status')}}"
icon_template: "{{state_attr('input_text.teams_status','icon')}}"
unique_id: sensor.teams_status
teams_activity:
friendly_name: "Microsoft Teams activity"
value_template: "{{states('input_text.teams_activity')}}"
unique_id: sensor.teams_activity

View File

@@ -0,0 +1,17 @@
automation:
- alias: Turn on pool light with downstairs lounge switch
trigger:
platform: state
entity_id: switch.tasmo_ks811t_0707_downstloun_2c
to: "on"
action:
service: homeassistant.turn_on
entity_id: switch.tasmo_athplug_5103_1
- alias: Turn off pool light with downstairs lounge switch
trigger:
platform: state
entity_id: switch.tasmo_ks811t_0707_downstloun_2c
to: "off"
action:
service: homeassistant.turn_off
entity_id: switch.tasmo_athplug_5103_1

View File

@@ -1,2 +0,0 @@
zha:
custom_quirks_path: /config/custom_zha_quirks/

Binary file not shown.