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

 找回密码
 立即注册
查看: 3447|回复: 1

[求助] 请教高手自动化代码写状态触发的问题

[复制链接]

1

主题

38

帖子

160

积分

注册会员

Rank: 2

积分
160
金钱
122
HASS币
0
发表于 2018-8-30 14:02:56 | 显示全部楼层 |阅读模式
请教各位高手帮忙指教: 写自动化代码是这两种方式哪个不容易出错:
举例:

1、状态改变5秒后触发:
    - platform: state
      entity_id: binary_sensor.motion_sensor_158d00015b8ae7
      to: 'off'
      for:
       seconds: 30
2、状态改变后触发,然后延时执行:
    - platform: state
      entity_id: binary_sensor.motion_sensor_158d00015b8ae7
      to: 'on'
  action:
    - delay: 00:00:30
    - service: automation.turn_off
      entity_id: automation.restore1

先不管其它状况,就这两种方式在现实应用时会有哪个会比较容易误执行(不执行)嘛?按理论同样情况下是应该都一样的,实际经验上有哪位同学发现有出错的情况嘛?



回复

使用道具 举报

72

主题

1154

帖子

6417

积分

论坛元老

Rank: 8Rank: 8

积分
6417
金钱
5258
HASS币
30
发表于 2018-8-30 14:44:46 | 显示全部楼层
1、变为off,要保持状态30秒才触发后执行。
2、变为off就触发,30秒后肯定执行。
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-6-30 02:55 , Processed in 0.044375 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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