home assistant 常见模版条件 最近在研究home assistant自动化的编写,本文将不断的更新,汇集常见的条件和触发器 # 条件类 ## 判定传感器(如小米夜灯)300秒无人 ```python condition: template value_template: >- {{ as_timestamp(now()) - as_timestamp(state_attr('binary_sensor.68abbc58bd0e_motion', 'last_triggered')) > 300 }} alias: 桌面夜灯300秒无动作 ``` 代码以template添加: ![](/static/upload/202308/file_1692809180000_87.png) ## 判定周一到周五 ```python condition: template value_template: "{{ now().weekday() in (0,1,2,3,4) }}" alias: 周一至周五 ``` 来自 大脸猪 写于 2023-08-24 00:44 -- 更新于2023-08-24 01:03 -- 0 条评论