『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 4032|回复: 3

【蟋蟀】卫生间灯光自动化(非标准卫生间设置)

[复制链接]

15

主题

656

帖子

2826

积分

金牌会员

Rank: 6Rank: 6

积分
2826
金钱
2170
HASS币
91

教程狂人

QQ
发表于 2018-12-1 21:39:11 | 显示全部楼层 |阅读模式

前言:卫生间平时不关门,直接适用于非标准卫生间设置(干湿区分离或有镜前灯);普通卫生间删除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文件夹下


light_automation范例2_卫生间.zip

1.33 KB, 下载次数: 16

注意修改设备ID

评分

参与人数 1金钱 +16 收起 理由
eric + 16 论坛有你更精彩!

查看全部评分

回复

使用道具 举报

9

主题

334

帖子

1285

积分

金牌会员

Rank: 6Rank: 6

积分
1285
金钱
951
HASS币
0
发表于 2018-12-1 21:57:13 | 显示全部楼层
学习了 先看看
回复

使用道具 举报

7

主题

224

帖子

2009

积分

论坛积极会员

积分
2009
金钱
1785
HASS币
0
发表于 2019-7-19 18:03:17 | 显示全部楼层
不错不错
回复

使用道具 举报

12

主题

67

帖子

1049

积分

论坛技术达人

积分
1049
金钱
932
HASS币
200

教程狂人

发表于 2019-7-22 14:55:10 | 显示全部楼层
话说你这判断有人了吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-6-1 10:13 , Processed in 1.160421 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表