2024年11月24日星期日 上午3:19:44

global | A - every 6 minute automation say time

8 个月 前
#29716 引用
http://192.168.2.50:8123/config/automation/edit/1702385677506

run ok



alias: global | A - every 6 minute  automation  say time
description: >-
  https://www.home-assistant.io/docs/automation/trigger/#time-pattern-trigger
  https://github.com/al-one/hass-xiaomi-miot/issues/537
  https://bbs.hassbian.com/thread-5609-1-1.html
  https://zhuanlan.zhihu.com/p/623197380 #strftime('%Y-%m-%d %H:%M:%S')
  http://localhost:4999/boards/topic/21940/global-a-every-6-minute-automation-say-time
  #本例中,字符串格式为‘年-月-日 时:分:秒’
trigger:
  - platform: time_pattern
    minutes: /6
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: time
                after: "07:00:00"
                before: "09:00:00"
                weekday:
                  - mon
                  - tue
                  - wed
                  - thu
                  - fri
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%H点%M分') }}
      - conditions:  # only for test
          - condition: and
            conditions:
              - condition: time
                after: "07:01:00"
                before: "07:02:00"
        sequence:
          - service: tts.edge_tts_say
            data:
              cache: false
              entity_id: media_player.wifipuffer1c
              message: 现在时间{{ now().strftime('%Y-%m-%d %H:%M:%S') }}
    default: []
mode: single



0