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

 找回密码
 立即注册
查看: 5075|回复: 5

[进阶教程] 【六神自动化】悟空M1控制博联wifi插座实现空气净化器自...

[复制链接]

175

主题

2956

帖子

7555

积分

超级版主

我就是六神

Rank: 8Rank: 8

积分
7555
金钱
4574
HASS币
398

活跃会员教程狂人灌水之王

QQ
发表于 2018-3-1 22:34:46 | 显示全部楼层 |阅读模式
本帖最后由 jyz_0501 于 2018-10-29 18:50 编辑
- alias: auto_open_air_conditioner
  initial_state: true
  hide_entity: false
  trigger: 
    - platform: numeric_state
      entity_id: sensor.m1_a
      value_template: '{{ states.sensor.m1_a.attributes.pm25 }}'
      above: 75
    - platform: numeric_state
      entity_id: sensor.m1_a
      value_template: '{{ states.sensor.m1_a.attributes.hcho }}'
      above: 0.08
  condition:
  - condition: time
    after: '6:00:00'
    before: '22:00:00'
  action:
    - service: switch.turn_on
      entity_id: switch.aircleaner
    - service: tts.baidu_say
      data_template: 
        entity_id: media_player.kodi
        message:  >
          "室内空气质量较差,已为您自动开启空气净化器,维持十分钟!"
        cache: false
    - delay:
        minutes: 10
    - service: tts.baidu_say
      data_template: 
        entity_id: media_player.kodi
        message:  >
          "现在为您关闭空气净化器!"
        cache: false
    - service: switch.turn_off
      entity_id: switch.aircleaner
回复

使用道具 举报

16

主题

262

帖子

3723

积分

论坛元老

Rank: 8Rank: 8

积分
3723
金钱
3456
HASS币
0
发表于 2018-3-1 22:48:48 | 显示全部楼层
本帖最后由 alex950418 于 2018-3-1 22:51 编辑

我是自己用PMS5003ST做的空气检测器,并且 为了保持传感器的寿命设定了检测器定时工作,发现不好自动启动空净器,一直稳定工作,配置的策略如下:- alias: auto_air_checking
  initial_state: true
  hide_entity: false
  trigger:
  - platform: time
    minutes: 5
    seconds: 00
  condition:
  - condition: time
    after: '6:00:00'
    before: '23:00:00'
  action:
  - service: switch.turn_on
    entity_id: switch.air_testing
  - delay:
          minutes: 2
  - service: switch.turn_off
    entity_id: switch.air_testing


- alias: air_filter_on
  initial_state: true
  trigger:
  - platform: numeric_state
    entity_id: sensor.pm25
    value_template: '{{ state.sensor.pm25 }}'
    above: 60
  action:
  - service: switch.turn_on
    entity_id: switch.air_cleaner
  - delay:
          minutes: 5
  - service: switch.turn_on
    entity_id: switch.air_testing
  
- alias: air_filter_off
  initial_state: true
  trigger:
  - platform: numeric_state
    entity_id: sensor.pm25
    value_template: '{{ state.sensor.pm25 }}'
    below: 38
  action:
  - service: switch.turn_off
    entity_id: switch.air_cleaner
  - delay:
          seconds: 0.2
  - service: switch.turn_off
    entity_id: switch.air_testing
回复

使用道具 举报

9

主题

787

帖子

3831

积分

论坛元老

Rank: 8Rank: 8

积分
3831
金钱
3044
HASS币
87
发表于 2018-3-1 22:51:30 | 显示全部楼层
触发条件不对,你的触发条件是aircleaner这个打开的时候触发.
应该改成:
  trigger:
    - platform: numeric_state
      entity_id: sensor.m1_a.attributes.pm25
      above: 75 #高于75时触发
  - platform: numeric_state
      entity_id: sensor.m1_a.attributes.hcho
      above: 0.08
回复

使用道具 举报

175

主题

2956

帖子

7555

积分

超级版主

我就是六神

Rank: 8Rank: 8

积分
7555
金钱
4574
HASS币
398

活跃会员教程狂人灌水之王

QQ
 楼主| 发表于 2018-3-1 22:55:20 | 显示全部楼层
令狐鸣 发表于 2018-3-1 22:51
触发条件不对,你的触发条件是aircleaner这个打开的时候触发.
应该改成:
  trigger:

好的 明白了~~
回复

使用道具 举报

7

主题

348

帖子

1078

积分

金牌会员

Rank: 6Rank: 6

积分
1078
金钱
730
HASS币
0
发表于 2019-4-26 18:13:32 | 显示全部楼层
感谢大佬分享,学习学习传感器自动化
回复

使用道具 举报

1

主题

12

帖子

52

积分

注册会员

Rank: 2

积分
52
金钱
40
HASS币
0
发表于 2019-4-27 00:07:39 来自手机 | 显示全部楼层
谢谢分享~
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-5-2 12:34 , Processed in 0.781893 second(s), 29 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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