|
本帖最后由 xuyang 于 2022-5-16 19:40 编辑
想要随机时间对自动化进行触发:
- platform: time_pattern
seconds: "/24"
# seconds: "/{{ ['10','15','24'] | random }}" 使用这个报错,请教一下宅在哪里?
解决方法: - platform: time_pattern,可能不支持模板
采用- delay,它支持模板
trigger: - platform: time_pattern
seconds: '/60'
condition: []
action:
- delay: '{{ [1,5,11,15,18]|random() }}'
- service: switch.turn_on
data:
entity_id: switch.ddd
每六十秒触发一次,延迟1,5,11,15,18中的随机某个秒,然后打开开关。
|
|