Automatisation : but do an action when there are 2triggers in 5seconds

Hello ,

i want to do an automation .
i trigger via a mqtt message.thas has an unique payload.

i want to change my yaml , that when the trigger occures 2times within 5seconds , then the action is allowed.

i trief with ID and for loop but my results didnt work ;(

alias: Nieuwe automatisering
description: ""
trigger:
 - platform: mqtt
   topic: home/OMG_ESP8266_IR/IRtoMQTT
condition:
 - condition: template
   value_template: "{{trigger.payload_json.hex == \"0xF7C03F\"}}"
action:
 - service: notify.mobile_app_iphone7
   data:
     message: ir
mode: single

Try this version.

alias: Nieuwe automatisering
description: ""
trigger:
  - platform: mqtt
    topic: "home/OMG_ESP8266_IR/IRtoMQTT"
    payload: "0xF7C03F"
    value_template: "{{ value_json.hex }}"
condition: []
action:
  - wait_for_trigger:
      - platform: mqtt
        topic: "home/OMG_ESP8266_IR/IRtoMQTT"
        payload: "0xF7C03F"
        value_template: "{{ value_json.hex }}"
    timeout: '00:00:05'
    continue_on_timeout: false
  - service: notify.mobile_app_iphone7
    data:
      message: ir
mode: single
max_exceeded: silent 
1 Like