# Analytics snippet placeholder — HearthNodes (gatherer.top) # Paste the measurement snippet here (server.js inlines any content that contains # a markup tag into on every page). No GA4 property is assigned to this # site yet, so leave this file as comments only and the build emits no tracking # code.
HearthNodesgatherer.top 已发布 27/28 EN 中文

入睡渐降:房间一间间空掉,房子自己变暗

不用固定的就寝场景:房子持续观察哪些房间还有人,每 10 分钟把其余区域的灯光降一档,最后一个人走向卧室时,房子已经自己暗下来了。

协议 · zigbee 延迟 · 600000 ms 供电 · mains 发布 · 2026-10-26 3 devices
自动化 YAML presence-bedtime-presence-taper.yaml
# HearthNodes recipe 05 - bedtime taper
alias: "Presence - bedtime taper as rooms empty"
id: hn_presence_bedtime_taper
description: "Rooms emptying after 22:30 step the rest of the house down 15 points"
mode: restart
max_exceeded: silent

trigger:
  - platform: state
    entity_id: sensor.house_occupied_rooms
  - platform: numeric_state
    entity_id: sensor.house_occupied_rooms
    below: 2

variables:
  step: "{{ states('input_number.taper_step') | int(100) }}"
  next_step: "{{ [step - 15, 8] | max }}"
  taper_targets:
    - light.living_room
    - light.dining
    - light.kitchen
    - light.hall_downlights

condition:
  - condition: time
    after: "22:30:00"
    before: "01:30:00"
  - condition: state
    entity_id: binary_sensor.cooking_active
    state: "off"
  - condition: state
    entity_id: binary_sensor.bath_running
    state: "off"
  - condition: state
    entity_id: input_boolean.guest_mode
    state: "off"

action:
  - service: input_number.set_value
    target:
      entity_id: input_number.taper_step
    data:
      value: "{{ next_step }}"
  - service: light.turn_on
    target:
      entity_id: "{{ taper_targets }}"
    data:
      brightness_pct: "{{ next_step }}"
      color_temp_kelvin: 2200
      transition: 4
  - choose:
      - conditions:
          - condition: state
            entity_id: binary_sensor.bedroom_presence
            state: "on"
        sequence:
          - service: media_player.volume_set
            target:
              entity_id: media_player.living_room_tv
            data:
              volume_level: 0.25
  - service: lock.lock
    target:
      entity_id: lock.front_door
    data:
      code: "{{ states('input_text.service_code') }}"

# Oscillating occupied-room count suspends the taper for 30 minutes and applies
# a flat 12 percent night level instead. Bedroom sensor failure falls back to the
# bedroom door contact plus a fixed 23:30 start.
触发器 · state

sensor.house_occupied_rooms

本地时间 22:30 之后,有人房间的数量减少至少一个。

入睡渐降:房间一间间空掉,房子自己变暗 topology

分步说明

  1. light.living_room · light.dining · light.kitchen每 10 分钟把紧邻空置房间的灯具下调 15 个百分点,且不低于 8 %。 turn_on · brightness_pct {{ state_attr('input_number.taper_step','level') }} · color_temp_kelvin 2200 · transition 4s
  2. input_number.taper_step递减渐变 helper,让下一个空掉的房间从当前亮度继续下调其余灯光。 decrement · min 8
  3. media_player.living_room_tv一旦卧室分区报告有人,把客厅电视音量上限设为 25 %,以免吵到已入睡的人。 volume_set · 0.25
  4. lock.front_door当有人房间数降到 1 时锁前门,而不是等到整屋无人。 lock
分步说明
每次降 15 个百分点,而不是直接减半

每一步都减半会很明显,感觉像房子在催你。4 秒内降 15 个百分点,低于大多数人看手机时的察觉阈值。测试方法:用眼角余光看一盏灯,你应当说不出它具体是什么时候变的。

设置一个绝不到零的下限

8 % 的下限既够走路不用手机手电,更重要的是避开了一些驱动在低亮度区闪烁的工作范围。查一下驱动的调光下限——有些 Zigbee 灯泡低于 5 % 会直接熄灭。

先保护睡着的人,再去调暗房子

音量上限和光线方向比整体亮度更重要。让剩余的光避开卧室门方向,并把音量上限写进同一条自动化,避免只执行了一半的保护。

硬件

型号协议连接在本链路中的作用
Aqara FP2 wifi 无线 客厅与厨房分区传感器;有人房间计数即由其分区输出汇总而来。
IKEA TRADFRI bulbs on a Zigbee coordinator zigbee 无线 渐降的目标灯具;能平滑接受 4 秒过渡,这正是让调光不易察觉的关键。
Bedroom zone sensor (any presence sensor) zigbee 无线 用于判断何时开始为已入睡的人隔离噪声与光线。

失效时怎么办

如果两个传感器互相矛盾导致有人房间数来回震荡,渐降暂停 30 分钟,改为统一的固定 12 % 夜间亮度。如果卧室传感器失效,则回退为「卧室门磁 + 固定 23:30 开始渐降」,优雅度差一些但可预测。

同一触发源的配方

条款 仅供参考。这些配方会控制市电、水路与物理门禁。当地电气与给排水规范、熔断与隔离措施、以及每一处失效保护的实际测试,都需要你自己负责。本页内容不构成专业工程、法律或安全建议。