changes to esphome devices and packages to start removing node red dependencies

This commit is contained in:
root
2026-04-25 21:05:32 +12:00
parent 51bff34d2e
commit 15f348570f
71 changed files with 1322 additions and 202 deletions
+100 -11
View File
@@ -6,6 +6,7 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-occupancyoffice.yaml
#:########################################################################################:#
# VERSIONS:
# v1.1 2026-04-24 Added MQTT remote timer command script triggered by mmWave occupancy or movement
# v1.0 2026-02-25 Updated yaml to zorruno layout V1.1
#:########################################################################################:#
# HARDWARE:
@@ -32,17 +33,21 @@
# - Publishes a text occupancy state (Movement/Occupancy/Clearance) and binary sensors for:
# - mmWave Occupancy or Movement (occupancy)
# - mmWave Movement (motion)
# - When mmWave Occupancy or Movement turns ON, this device publishes MQTT timer commands to:
# - ${mqtt_remote_device1_command_topic}
# - ${mqtt_remote_device2_command_topic}
# - BLE scanning is started/stopped based on HA API client connection (reduces BLE load when unused).
#:########################################################################################:#
# OFFLINE NOTES:
# a) Home Assistant OFFLINE, but Network and MQTT ONLINE
# - Device continues running mmWave logic and environment sensors.
# - MQTT still functions; HA entities will update again when HA returns.
# - MQTT remote timer commands still function if MQTT is online.
# - HA entities will update again when HA returns.
# b) MQTT OFFLINE (or broker unreachable)
# - Device continues running locally and via HA API (if HA is reachable).
# - MQTT-based integrations/updates will not function until MQTT returns.
# - MQTT-based remote timer commands will not function until MQTT returns.
# c) Entire WiFi/Network OFFLINE
# - Device continues running locally, but HA/MQTT integration is unavailable.
# - Device continues running local mmWave/environment logic, but HA/MQTT integration is unavailable.
# - Accurate time is NOT needed (SNTP not needed): logic uses relative time (time since boot),
# but timing resets on reboot.
#:########################################################################################:#
@@ -61,14 +66,16 @@ substitutions:
# Project Naming
project_name: "HiLink.LD1125H Office Occupancy"
project_version: "v1.0"
project_version: "v1.1"
# Passwords & Secrets (unfortunately you can't use substitutions inside secrets names)
api_key: !secret esp-occupancyoffice_api_key
ota_pass: !secret esp-occupancyoffice_ota_pass
static_ip_address: !secret esp-occupancyoffice_ip
mqtt_command_main_topic: !secret mqtt_command_main_topic
mqtt_status_main_topic: !secret mqtt_status_main_topic
# If we are changing IP addresses, you must update the current IP address here, otherwise it remains
# If we are changing IP addresses, you must update the current IP address here, otherwise it remains.
# Don't forget to switch it back when changed.
current_ip_address: ${static_ip_address}
@@ -76,6 +83,31 @@ substitutions:
log_level: "INFO" # NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
update_interval: "60s" # general sensor update interval
# Remote light timer payloads, in seconds.
remote_timer_left_lights_payload: "10"
remote_timer_right_lights_payload: "360"
# MQTT REMOTE Controls
mqtt_remote_device1_name: "office-dual-lights-left"
mqtt_remote_device1_command_topic: "${mqtt_command_main_topic}/${mqtt_remote_device1_name}"
mqtt_remote_device1_command1: "On"
mqtt_remote_device1_command2: "${remote_timer_left_lights_payload}"
mqtt_remote_device2_name: "office-dual-lights-right"
mqtt_remote_device2_command_topic: "${mqtt_command_main_topic}/${mqtt_remote_device2_name}"
mqtt_remote_device2_command1: "On"
mqtt_remote_device2_command2: "${remote_timer_right_lights_payload}"
mqtt_remote_device3_name: "office-main-lights-left"
mqtt_remote_device3_command_topic: "${mqtt_command_main_topic}/${mqtt_remote_device3_name}"
mqtt_remote_device3_command1: "On"
mqtt_remote_device3_command2: "${remote_timer_left_lights_payload}"
mqtt_remote_device4_name: "office-main-lights-right"
mqtt_remote_device4_command_topic: "${mqtt_command_main_topic}/${mqtt_remote_device4_name}"
mqtt_remote_device4_command1: "On"
mqtt_remote_device4_command2: "${remote_timer_right_lights_payload}"
#:########################################################################################:#
# PACKAGES: Included Common Packages
# https://esphome.io/components/packages.html
@@ -97,12 +129,12 @@ packages:
local_device_name: "${device_name}"
#### SNTP (Only use if you want/need accurate timeclocks) ####
common_sntp: !include common/sntp_common.yaml
#common_sntp: !include common/sntp_common.yaml
#### DIAGNOSTICS Sensors ####
diag_basic: !include common/include_basic_diag_sensors.yaml
diag_more: !include common/include_more_diag_sensors.yaml
diag_debug: !include common/include_debug_diag_sensors.yaml
#diag_debug: !include common/include_debug_diag_sensors.yaml
#diag_resetcount: !include common/include_resetcount_diag_sensors.yaml
#:########################################################################################:#
@@ -114,7 +146,7 @@ esphome:
friendly_name: "${friendly_name}"
comment: "${description_comment}"
area: "${device_area}"
min_version: 2024.6.0
min_version: 2026.4.1
project:
name: "${project_name}"
version: "${project_version}"
@@ -156,7 +188,6 @@ esphome:
esp32:
board: esp32dev
framework:
# type: arduino
type: esp-idf
version: recommended
@@ -185,6 +216,7 @@ logger:
api:
encryption:
key: "${api_key}"
reboot_timeout: 0s
on_client_connected:
- esp32_ble_tracker.start_scan:
continuous: true
@@ -355,7 +387,7 @@ number:
return std::vector<uint8_t>(rmaxst.begin(), rmaxst.end());
- platform: template
name: "Clearence Time (s)"
name: "Clearance Time (s)"
id: ld1125h_clear_time
icon: "mdi:cogs"
optimistic: true
@@ -466,6 +498,59 @@ text_sensor:
id: ld1125h_occupancy
icon: "mdi:motion-sensor"
#:########################################################################################:#
# SCRIPT
# https://esphome.io/components/script.html
#:########################################################################################:#
script:
- id: send_remote_light_on_commands
mode: restart
then:
- mqtt.publish:
topic: "${mqtt_remote_device1_command_topic}"
payload: "${mqtt_remote_device1_command1}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device2_command_topic}"
payload: "${mqtt_remote_device2_command1}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device3_command_topic}"
payload: "${mqtt_remote_device3_command1}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device4_command_topic}"
payload: "${mqtt_remote_device4_command1}"
qos: 0
retain: false
- id: send_remote_light_timer_commands
mode: restart
then:
- mqtt.publish:
topic: "${mqtt_remote_device1_command_topic}"
payload: "${mqtt_remote_device1_command2}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device2_command_topic}"
payload: "${mqtt_remote_device2_command2}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device3_command_topic}"
payload: "${mqtt_remote_device3_command2}"
qos: 0
retain: false
- mqtt.publish:
topic: "${mqtt_remote_device4_command_topic}"
payload: "${mqtt_remote_device4_command2}"
qos: 0
retain: false
#:########################################################################################:#
# BINARY SENSOR
# https://esphome.io/components/binary_sensor/
@@ -475,8 +560,12 @@ binary_sensor:
name: "mmWave Occupancy or Movement"
id: ld1125h_movocc_binary
device_class: occupancy
on_press:
- script.execute: send_remote_light_on_commands
on_release:
- script.execute: send_remote_light_timer_commands
- platform: template
name: "mmWave Movement"
id: ld1125h_mov_binary
device_class: motion
device_class: motion