无窗设备间的暗房存在补充照明
无窗设备间完全没有日照参考,因此仅由存在感应驱动两段式场景:进入时 40 %,停留超过 20 秒升到 85 %,离开 90 秒后关闭。Thread 上从进入到亮灯延迟 400 毫秒。
# HearthNodes recipe 10 - dark room occupancy boost
alias: "Light - windowless utility room two stage"
id: hn_light_dark_room_boost
description: "40 percent on entry, 85 percent after 20 s dwell, off 90 s after clear"
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: binary_sensor.utility_room_presence
to: "on"
id: entered
- platform: state
entity_id: binary_sensor.utility_room_presence
to: "off"
for: "00:01:30"
id: cleared
- platform: state
entity_id: binary_sensor.utility_door_contact
to: "on"
id: door_opened
variables:
light_target: light.utility_ceiling
condition:
- condition: state
entity_id: select.utility_room_scene
state: "normal"
- condition: template
value_template: "{{ states('sensor.thread_border_router_lqi') | int(100) > 40 }}"
action:
- choose:
- conditions:
- condition: trigger
id: entered
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_target }}"
data:
brightness_pct: 40
transition: 0.4
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.utility_room_presence
to: "on"
for: "00:00:20"
timeout: "00:02:00"
continue_on_timeout: false
- service: light.turn_on
target:
entity_id: "{{ light_target }}"
data:
brightness_pct: 85
transition: 1.5
- conditions:
- condition: trigger
id: door_opened
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_target }}"
data:
brightness_pct: 40
transition: 0.4
- conditions:
- condition: trigger
id: cleared
sequence:
- service: light.turn_off
target:
entity_id: "{{ light_target }}"
data:
transition: 3
# Door contact fires before the person is in the sensor's view, which is exactly
# when the light needs to come on. Presence-sensor failure -> door contact alone
# drives a 3 minute full-brightness scene; the relay's own 5 minute local
# fallback covers a hub outage.
触发器 · state
binary_sensor.utility_room_presence
设备间存在感应置为有人,或转为无人(两个方向由同一配方处理)。
分步说明
- light.utility_ceiling进入时立即 40 %——足够看清地面,刻意不做全亮,因为大多数进出都在 15 秒以内。
turn_on · brightness_pct 40 · transition 0.4s - light.utility_ceiling仅在连续有人 20 秒后升到 85 %,这个信号说明是真的要干活,而不是路过。
brightness_pct 85 · transition 1.5s after 20s dwell - light.utility_ceiling报告无人 90 秒后关闭,使用 restart 模式计时,再次进入即取消倒计时。
turn_off · transition 3s after 90s clear
即使已有存在传感器,也要加门磁
PIR 与人之间关着一扇门,这是硬性遮挡。门磁的开门事件在人进入传感器视野之前就会触发,而那一刻正是需要亮灯的时刻。多加这一个传感器,能消掉大部分「这里灯总是慢半拍」的抱怨。
在过路型房间里,两段式优于单段式
设备间大多是人来人往的路过。为了一次 12 秒的进入把房间点到 100 %,既浪费电,也让房间像舞台。前 20 秒 40 %、之后 85 %,更贴合这个房间的真实使用方式。
把 Thread 路由放进房间里,而不是放在附近
洗衣机、烘干机和金属货架对 2.4 GHz 衰减很严重。在房间内部放一个市电供电的 Thread 设备能让网状网路径变短,而它同时充当天花灯具的继电器,不额外增加成本。
硬件
| 型号 | 协议 | 连接 | 在本链路中的作用 |
|---|---|---|---|
| Eve Motion (Thread) | thread |
无线 | Thread 上上报很快;400 毫秒的上报正是让进门的灯感觉即时亮起的原因。 |
| Aqara Door and Window Sensor P2 (Thread) | thread |
无线 | 门磁作为「或」触发,因为关闭的设备间门可能完全挡住 PIR。 |
| Thread smart relay behind the ceiling fixture | thread |
有线 | 市电继电器,同时充当 Thread 路由;在布满金属电器的房间里这能维持网状网健康。 |
失效时怎么办
如果存在传感器失效,仅由门磁驱动 3 分钟全亮场景——效率差一些,但绝不会把人留在无窗房间里摸黑。如果 Thread 不可达,继电器的物理墙面开关仍然可用,且具备本地兜底:任何按键都会让灯亮 5 分钟。