Thanks, seems to trigger fine. However it will have a cooldown of 60 some seconds i think before it will trigger again, ie the sensor itself.
I want to keep the last 3 timestamps. How do I add that to the below, ie I want to insert timestamp in history. (just coiped from another automation which keeps a callsign from opensky)
- id: '1531691917334'
alias: Set mailstate
trigger:
- event_data:
entity_id: binary_sensor.vibration_158d0002a925ee
movement_type: vibrate
event_type: xiaomi_aqara.movement
platform: event
condition: []
action:
- service: variable.set_variable
data:
variable: last_mail
attributes_template: "{\n \"history_1\": \"{{ variable.state }}\",\n \"history_2\"\
: \"{{ variable.attributes.history_1 }}\",\n \"history_3\": \"{{ variable.attributes.history_2\
\ }}\"\n}\n"
data_template:
value: '{{now().strftime("%c")}}'