前言:卫生间平时不关门,直接适用于非标准卫生间设置(干湿区分离或有镜前灯);普通卫生间删除3-2,3-3,3-4
卫生间平时关门的,可以考虑添加其他条件(参考上一篇卧室双灯光自动化)或许会有一些思路!
【简单除暴】(分享方式简单粗暴,非以下内容简单粗暴)
#适用情况:卫生间有双灯光(镜灯、顶灯或者干湿区分离两区域灯),其他情况需自行做修改
#设备需求:门磁(贴卫生间门)、人体传感器(本范例是进湿区即马桶所在亮灯)放在湿区入口、灯光接入HA
#其中3-1与3-2是二选一
group:
automation_light: # Tab页 自动化 中group
name: 灯光自动化
view: no
icon: mdi:fingerprint
entities:
- automation.auto_BathRoom_light_on #灯3-1
- automation.auto_BathRoom_light_on_2 #灯3-2
- automation.auto_BathRoom_light_off #灯3-5
- automation.auto_BathRoom_light_door #灯3-6
#####################################################################################
homeassistant:
customize:
automation.auto_BathRoom_light_on:
friendly_name: 3-1卫生间有人-筒灯关-厕灯开
homebridge_hidden: true
icon: mdi:toilet
automation.auto_BathRoom_light_on_2:
friendly_name: 3-2卫生间有人-厕灯开
homebridge_hidden: true
icon: mdi:toilet
automation.auto_BathRoom_light_on_no_together:
friendly_name: 3-3卫生间有人开灯不能同时开
homebridge_hidden: true
icon: mdi:toilet
automation.auto_BathRoom_light_on_no_together_2:
friendly_name: 3-4卫生间有人开灯不能同时开二
homebridge_hidden: true
icon: mdi:toilet
automation.auto_BathRoom_light_off:
friendly_name: 3-5卫生间无人-厕门开-厕灯关
homebridge_hidden: true
icon: mdi:toilet
automation.auto_BathRoom_light_door:
friendly_name: 3-6卫生间门关-厕灯开
homebridge_hidden: true
icon: mdi:toilet
#####################################################################################
automation:
##灯3-1卫生间灯开:湿区人体感应-干区筒灯关闭-开湿区照明灯
- alias: auto_BathRoom_light_on
#initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_158XXXX #湿区人体传感器
to: 'on'
condition:
- condition: state
entity_id: switch.wall_switch_right_158XXXX #洗漱区筒灯
state: 'off'
action:
- service_template: switch.turn_on
entity_id: switch.wall_switch_left_158XXXX #湿区照明灯
##灯3-2卫生间灯开:湿区人体感应-开湿区照明灯
- alias: auto_BathRoom_light_on_2
initial_state: false
hide_entity: false
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_158XXXX #湿区人体传感器
to: 'on'
action:
- service_template: switch.turn_on
entity_id: switch.wall_switch_left_158XXXX #湿区照明灯
##灯3-3自动化“卫生间灯开” 3-1与3-2不能同时开,可同时关
- alias: auto_BathRoom_light_on_no_together
initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: automation.auto_BathRoom_light_on
to: 'on'
action:
- service: automation.turn_off
data:
entity_id: automation.auto_BathRoom_light_on_2
##灯3-4自动化“卫生间灯开” 3-1与3-2不能同时开,可同时关 2
- alias: auto_BathRoom_light_on_no_together_2
initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: automation.auto_BathRoom_light_on_2
to: 'on'
action:
- service: automation.turn_off
data:
entity_id: automation.auto_BathRoom_light_on
##灯3-5卫生间灯关:湿区人体无感应10秒后-卫生间门打开-湿区照明灯关灯
- alias: auto_BathRoom_light_off
#initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: binary_sensor.motion_sensor_158XXXX #湿区人体传感器
to: 'off'
for:
seconds: 10 #等待10秒
condition:
- condition: state
entity_id: binary_sensor.door_window_sensor_158XXXX #卫生间门
state: 'on'
action:
- service_template: switch.turn_off
entity_id: switch.wall_switch_left_158XXXX #湿区照明灯
##灯3-6卫生间灯开:卫生间门关-打开湿区照明灯
- alias: auto_BathRoom_light_door
#initial_state: true
hide_entity: false
trigger:
- platform: state
entity_id: binary_sensor.door_window_sensor_158XXXX #卫生间门
to: 'off'
action:
- service: switch.turn_on
entity_id: switch.wall_switch_left_158XXXX #湿区照明灯
可复制上面自己保存,可下载下面的直接放入packages文件夹下
|