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

 找回密码
 立即注册
查看: 4052|回复: 7

求助自动化条件“or”

[复制链接]

20

主题

123

帖子

1335

积分

金牌会员

Rank: 6Rank: 6

积分
1335
金钱
1212
HASS币
0
发表于 2017-11-13 22:23:44 | 显示全部楼层 |阅读模式
求助:怎样把下面自动化的执行条件设置成“or” ,我的需求是在太阳落山后到第二天早上8点之间执行,由人体传感器触发一个“script”
- action:
  - data: {}
    service: script.15103*
  alias: Toilet_light_night
  condition:
  - after: sunset
    condition: sun
  - before: 08:00:00
    condition: time
  id: '151032******'
  trigger:
  - entity_id: binary_sensor.motion_sensor_158d***
    platform: state
    to: 'on'
回复

使用道具 举报

68

主题

302

帖子

1964

积分

金牌会员

Rank: 6Rank: 6

积分
1964
金钱
1662
HASS币
0
发表于 2017-11-13 23:14:09 | 显示全部楼层
本帖最后由 mr-one 于 2017-11-13 23:17 编辑

這是一個完整的自動化,你看看

- alias: "turn on both curtain when main door opened"
  initial_state: 'on'
  trigger:
    - platform: state
      entity_id: binary_sensor.door_window_sensor_158d00016fd92b
      to: 'on'
      
  condition:
    condition: or
    conditions:  
      - condition: time
        after: '05:29:00'
        before: '02:00:00'
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d00015daa8a
        state: 'off'   
      - condition: state
        entity_id: binary_sensor.motion_sensor_158d00015db8ef
        state: 'off'
      - condition: state
        entity_id: binary_sensor.door_window_sensor_158d0001a645cf
        state: 'off'
      - condition: state
        entity_id: media_player.sony_bravia_tv
        state: 'off'
            
  action:
    - service: switch.turn_on
      entity_id: switch.windows
回复

使用道具 举报

20

主题

123

帖子

1335

积分

金牌会员

Rank: 6Rank: 6

积分
1335
金钱
1212
HASS币
0
 楼主| 发表于 2017-11-13 23:24:30 | 显示全部楼层
mr-one 发表于 2017-11-13 23:14
這是一個完整的自動化,你看看

- alias: "turn on both curtain when main door opened"

我这个也是完整的,是在页面上面编辑的,从自动化文件中打开的。 感觉格式完全不对啊?
回复

使用道具 举报

59

主题

731

帖子

4221

积分

论坛元老

Rank: 8Rank: 8

积分
4221
金钱
3485
HASS币
20
发表于 2017-11-14 08:25:12 | 显示全部楼层
mr-one 发表于 2017-11-13 23:14
這是一個完整的自動化,你看看

- alias: "turn on both curtain when main door opened"

如果是并列条件,把or改成其他是吗?
回复

使用道具 举报

1

主题

159

帖子

552

积分

高级会员

Rank: 4

积分
552
金钱
393
HASS币
0
发表于 2017-11-14 09:53:23 | 显示全部楼层
我理解的这段话是在太阳落山后 并且 第二天早上8点前, 当人体传感器处于on状态,执行script。
我理解的是and。
automation:
  alias: "name of the automation"
    trigger:
      - platform: state
        entity_id: binary_sensor.motion_sensor_158d***
        from: 'off'
        to: 'on'
    condition:
      condition: and
      conditions:
        - condition: sun
          after: sunset  
        - condition: time
          before: '8:00:00'
    action:
      service: script.15103*
回复

使用道具 举报

30

主题

999

帖子

4117

积分

论坛元老

Rank: 8Rank: 8

积分
4117
金钱
3113
HASS币
0

活跃会员

发表于 2017-11-14 09:56:26 | 显示全部楼层
guitengyue 发表于 2017-11-14 08:25
如果是并列条件,把or改成其他是吗?

OR 或者 and
回复

使用道具 举报

20

主题

123

帖子

1335

积分

金牌会员

Rank: 6Rank: 6

积分
1335
金钱
1212
HASS币
0
 楼主| 发表于 2017-11-14 13:29:29 | 显示全部楼层
61741514 发表于 2017-11-14 09:53
我理解的这段话是在太阳落山后 并且 第二天早上8点前, 当人体传感器处于on状态,执行script。
我理解的是a ...

谢谢!
我现在最大的疑惑是,通过编辑器写的自动化, 在automations.yaml中读取以后,和各位大神给出的格式不一样.第一楼的就是从文件中读取的.
回复

使用道具 举报

1

主题

159

帖子

552

积分

高级会员

Rank: 4

积分
552
金钱
393
HASS币
0
发表于 2017-11-14 14:22:08 | 显示全部楼层
jiangjian197 发表于 2017-11-14 13:29
谢谢!
我现在最大的疑惑是,通过编辑器写的自动化, 在automations.yaml中读取以后,和各位大神给出的格式不 ...

没用过那个东西,我觉得手写 更能表达出想要表达的意思。毕竟那个是根据逻辑写的方便大家的东西,就像google翻译一样,难免出错。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-26 13:21 , Processed in 0.053153 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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