# HearthNodes recipe 08 - twilight path lighting
alias: "Light - twilight path lighting by sun elevation"
id: hn_light_twilight_path
description: "Two elevation thresholds: -4 deg on, -12 deg deep night"
mode: single
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: -4
id: dusk_on
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
below: -12
id: deep_night
- platform: numeric_state
entity_id: sun.sun
attribute: elevation
above: -4
id: dawn_off
variables:
bollards: light.path_bollards
condition:
- condition: numeric_state
entity_id: sensor.outdoor_temperature
above: -12
- condition: state
entity_id: input_boolean.garden_party_scene
state: "off"
action:
- choose:
- conditions:
- condition: trigger
id: dusk_on
sequence:
- service: light.turn_on
target:
entity_id: "{{ bollards }}"
data:
brightness_pct: 65
color_temp_kelvin: 2700
transition: 30
- conditions:
- condition: trigger
id: deep_night
sequence:
- service: light.turn_on
target:
entity_id: "{{ bollards }}"
data:
brightness_pct: 30
transition: 600
- conditions:
- condition: trigger
id: dawn_off
sequence:
- delay: "00:20:00"
- service: switch.turn_off
target:
entity_id: switch.path_circuit
# Elevation is computed from the hub's own clock and coordinates, so this works
# with no internet. A missed -12 deg crossing self-heals via a 02:00 assertion
# that forces the deep-night level if the group is still at 65 percent.
触发器 · numeric_state
sun.sun (elevation attribute)
傍晚太阳高度角下穿 -4°,或清晨上穿 -4°。
分步说明
- light.path_bollards (group 3)在 -4° 触发时把十一盏路径柱灯用 30 秒渐变升到 65 %。
turn_on · brightness_pct 65 · color_temp_kelvin 2700 · transition 30s - light.path_bollards (group 3)在 -12° 时用十分钟把整组降到 30 %,进入深夜状态:足以看清台阶边缘,又不会照进卧室。
brightness_pct 30 · transition 600s - light.driveway_flood把车道泛光灯完全排除在黄昏逻辑之外:它是事件灯,不是环境灯。
turn_on · brightness_pct 100 · for 4 min on vehicle arrival only - switch.path_circuit清晨 -4° 上穿后 20 分钟关闭;夏季再加一个 07:30 的硬性截断,因为那时穿越发生在没人起床之前。
turn_off at sunrise +20 min
使用两个高度角阈值,而不是一个
单一阈值会导致在同一亮度上硬开硬关。两个阈值——-4° 点亮、-12° 进入深夜档——复刻了优秀照明设计师的手工做法:黄昏时人眼仍适应日光,所以更亮;入夜后更暗。
渐变时间要比你以为的更长
黄昏升起 30 秒,深夜下降 10 分钟。不应该有人能捕捉到灯光变化的那一刻。10 分钟渐变完全在 Z-Wave 调光器作为本地过渡命令的处理能力之内。
把泛光灯排除在时间表之外
把泛光灯和安防灯放进黄昏时间表,是花园整夜亮着的根本原因。让它们保持事件触发并强制 4 分钟超时,而且要由继电器自身的自动关闭来兜底,不能只靠软件。
硬件
| 型号 | 协议 | 连接 | 在本链路中的作用 |
|---|---|---|---|
| Zooz ZEN71 relay in a weatherproof box | zwave |
有线 | 控制低压变压器市电侧;Z-Wave 800 系列从花园深处到车库的覆盖足够。 |
| Fibaro Dimmer 2 (or Z-Wave module) for the bollard group | zwave |
有线 | 为 2700 K 柱灯在低亮度下提供后沿调光。 |
| Power-monitoring module on the transformer circuit | zwave |
有线 | 确认回路确实在取电,自动化据此判断断路器是否跳闸,而不是假设命令成功。 |
失效时怎么办
太阳高度角由中枢的时钟与坐标本地计算,断网也能工作。若中枢时间不准,灯仍会亮,只是黄昏时刻错位;每晚做一次 NTP 检查,时钟漂移超过 60 秒就报警。如果 Z-Wave 模块失去响应,车库墙上的物理开关仍可控制回路。