Edit esp-occupancyoffice.yaml

This commit is contained in:
ESPHome Device Builder
2026-07-25 12:53:51 +12:00
parent af3302c9a5
commit 64631fac30
+8 -89
View File
@@ -6,6 +6,9 @@
# https://home.fox.co.nz/gitea/zorruno/zorruno-homeassistant/src/branch/master/esphome/esp-occupancyoffice.yaml
#:########################################################################################:#
# VERSIONS:
# v1.2 2026-07-25 Removed MQTT light control commands. Light 2-way sync is now handled
# directly between esp-officelights and esp-officeduallights via MQTT.
# This device now only reports occupancy and environment data to HA.
# 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
#:########################################################################################:#
@@ -33,26 +36,24 @@
# - 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).
# - Light control is handled by direct MQTT 2-way sync between esp-officelights and
# esp-officeduallights. This device does not control lights.
#:########################################################################################:#
# OFFLINE NOTES:
# a) Home Assistant OFFLINE, but Network and MQTT ONLINE
# - Device continues running mmWave logic and environment sensors.
# - MQTT remote timer commands still function if MQTT is online.
# - HA entities will update again when HA returns.
# - Light control is not affected (handled by esp-officelights/officeduallights directly).
# b) MQTT OFFLINE (or broker unreachable)
# - Device continues running locally and via HA API (if HA is reachable).
# - MQTT-based remote timer commands will not function until MQTT returns.
# - HA entities will update again when MQTT returns.
# c) Entire WiFi/Network OFFLINE
# - 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.
#:########################################################################################:#
#:########################################################################################:#
# SUBSTITUTIONS: Specific device variable substitutions
# If NOT using a secrets file, just replace these with the passwords etc (in quotes)
@@ -66,7 +67,7 @@ substitutions:
# Project Naming
project_name: "HiLink.LD1125H Office Occupancy"
project_version: "v1.1"
project_version: "v1.2"
# Passwords & Secrets (unfortunately you can't use substitutions inside secrets names)
api_key: !secret esp-occupancyoffice_api_key
@@ -83,31 +84,6 @@ 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
@@ -498,59 +474,6 @@ 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/
@@ -560,10 +483,6 @@ 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"