doorbell-listener: flash plug on alert (configurable interval/duration)
On a fresh (< MAX_AGE_SECONDS) ntfy message, spawn a thread that publishes N TOGGLEs spaced FLASH_INTERVAL_SECONDS apart so total runtime is FLASH_DURATION_SECONDS. Defaults: 5 toggles @ 3s = 15s. Env vars (all in compose.yaml): FLASH_INTERVAL_SECONDS default 3 FLASH_DURATION_SECONDS default 15 MAX_AGE_SECONDS default 180 (replay protection) Each alert gets its own thread; concurrent alerts spawn concurrent flashes. z2m just flips state per toggle, so the lamp alternates regardless of overlap.
This commit is contained in:
@@ -57,6 +57,8 @@ services:
|
||||
# Listens to ntfy.sh for doorbell events and toggles a smart plug on each alert.
|
||||
# Topic: ALERT_klubhaus_topic_test (matches ESP32 firmware DEBUG_MODE suffix)
|
||||
# Action: TOGGLE on zigbee2mqtt/Sideboard Lamp/set
|
||||
# On a fresh alert, flash the plug: N toggles spaced FLASH_INTERVAL_SECONDS
|
||||
# so the total runtime is FLASH_DURATION_SECONDS.
|
||||
doorbell-listener:
|
||||
build: ./doorbell-listener
|
||||
container_name: doorbell-listener
|
||||
@@ -70,6 +72,9 @@ services:
|
||||
MQTT_PORT: "1883"
|
||||
PLUG_TOPIC: "zigbee2mqtt/Sideboard Lamp/set"
|
||||
POLL_INTERVAL: "30"
|
||||
MAX_AGE_SECONDS: "180"
|
||||
FLASH_INTERVAL_SECONDS: "3"
|
||||
FLASH_DURATION_SECONDS: "15"
|
||||
TZ: America/Los_Angeles
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user