Edit esp-occupancyoffice.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-25 13:08:53 +12:00
parent 37faf62809
commit 474a911ba9
+96 -8
View File
@@ -6,9 +6,10 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-occupancyoffice.yaml # https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-occupancyoffice.yaml
#:########################################################################################:# #:########################################################################################:#
# VERSIONS: # VERSIONS:
# v1.2 2026-07-25 Removed MQTT light control commands. Light 2-way sync is now handled # v1.3 2026-07-25 Restored MQTT light timer commands. Light 2-way sync is handled directly
# directly between esp-officelights and esp-officeduallights via MQTT. # between esp-officelights and esp-officeduallights via MQTT. This device
# This device now only reports occupancy and environment data to HA. # sends On/timer commands to all 4 light topics for occupancy-based control.
# v1.2 2026-07-25 Removed MQTT light control commands (reverted)
# v1.1 2026-04-24 Added MQTT remote timer command script triggered by mmWave occupancy or movement # 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 # v1.0 2026-02-25 Updated yaml to zorruno layout V1.1
#:########################################################################################:# #:########################################################################################:#
@@ -36,18 +37,23 @@
# - Publishes a text occupancy state (Movement/Occupancy/Clearance) and binary sensors for: # - Publishes a text occupancy state (Movement/Occupancy/Clearance) and binary sensors for:
# - mmWave Occupancy or Movement (occupancy) # - mmWave Occupancy or Movement (occupancy)
# - mmWave Movement (motion) # - mmWave Movement (motion)
# - When mmWave Occupancy or Movement turns ON, this device publishes MQTT On commands to
# all 4 office light topics. When it turns OFF, it publishes timer commands (10s or 360s)
# so lights stay on briefly after the room is vacated.
# - Light 2-way sync between esp-officelights and esp-officeduallights ensures both switches
# stay in sync regardless of which device initiates the change.
# - BLE scanning is started/stopped based on HA API client connection (reduces BLE load when unused). # - BLE scanning is started/stopped based on HA API client connection (reduces BLE load when unused).
# - Light control is handled by direct MQTT 2-way sync between esp-officelights and
# esp-officeduallights. This device does not control lights.
#:########################################################################################:# #:########################################################################################:#
# OFFLINE NOTES: # OFFLINE NOTES:
# a) Home Assistant OFFLINE, but Network and MQTT ONLINE # a) Home Assistant OFFLINE, but Network and MQTT ONLINE
# - Device continues running mmWave logic and environment sensors. # - Device continues running mmWave logic and environment sensors.
# - MQTT light timer commands still function if MQTT is online.
# - HA entities will update again when HA returns. # - HA entities will update again when HA returns.
# - Light control is not affected (handled by esp-officelights/officeduallights directly). # - Physical buttons on esp-officelights and esp-officeduallights still work and cancel
# any active timer if pressed.
# b) MQTT OFFLINE (or broker unreachable) # b) MQTT OFFLINE (or broker unreachable)
# - Device continues running locally and via HA API (if HA is reachable). # - Device continues running locally and via HA API (if HA is reachable).
# - HA entities will update again when MQTT returns. # - MQTT-based light timer commands will not function until MQTT returns.
# c) Entire WiFi/Network OFFLINE # c) Entire WiFi/Network OFFLINE
# - Device continues running local mmWave/environment logic, 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), # - Accurate time is NOT needed (SNTP not needed): logic uses relative time (time since boot),
@@ -67,7 +73,7 @@ substitutions:
# Project Naming # Project Naming
project_name: "HiLink.LD1125H Office Occupancy" project_name: "HiLink.LD1125H Office Occupancy"
project_version: "v1.2" project_version: "v1.3"
# Passwords & Secrets (unfortunately you can't use substitutions inside secrets names) # Passwords & Secrets (unfortunately you can't use substitutions inside secrets names)
api_key: !secret esp-occupancyoffice_api_key api_key: !secret esp-occupancyoffice_api_key
@@ -84,6 +90,31 @@ substitutions:
log_level: "INFO" # NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE log_level: "INFO" # NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
update_interval: "60s" # general sensor update interval 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 # PACKAGES: Included Common Packages
# https://esphome.io/components/packages.html # https://esphome.io/components/packages.html
@@ -474,6 +505,59 @@ text_sensor:
id: ld1125h_occupancy id: ld1125h_occupancy
icon: "mdi:motion-sensor" 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 # BINARY SENSOR
# https://esphome.io/components/binary_sensor/ # https://esphome.io/components/binary_sensor/
@@ -483,6 +567,10 @@ binary_sensor:
name: "mmWave Occupancy or Movement" name: "mmWave Occupancy or Movement"
id: ld1125h_movocc_binary id: ld1125h_movocc_binary
device_class: occupancy device_class: occupancy
on_press:
- script.execute: send_remote_light_on_commands
on_release:
- script.execute: send_remote_light_timer_commands
- platform: template - platform: template
name: "mmWave Movement" name: "mmWave Movement"