Declare a 'fake' variable to remeber path file and delete that file

1 - Declare a fake variable in Home Assistant.
Code for configuration.yaml can’t declare a variable, here is a mothod to declare a fake variable, by create a input_text.
Something as

# input_text:
picture_name:
  name: Picture name

2 - Delete files in Home Assistant.
See this link: custom component delete file.

3 - Example
Auto snapshot and push notification

  • alias: Notify motion to phone
    trigger:
    platform: numeric_state
    entity_id: sensor.ip_webcam_motion
    above: 500
    action:
    • service: input_text.set_value
      data_template:
      entity_id: input_text.picture_name
      value: “/camera/ring_{{ now().strftime(’%d’)+now().strftime(’%b’)+now().strftime(’%Y’)}}_ {{ now().hour }}_{{ now ().minute }}.jpg”
    • service: camera.snapshot
      data_template:
      entity_id: camera.ip_webcam
      filename: “/config/www{{ states.input_text.picture_name.state }}”
    • delay: ‘00:00:01’
    • service: notify.ios_phone
      data_template:
      message: ’ {{ trigger.to_state.attributes.friendly_name }} was {{ trigger.to_state.state }} ’
      data:
      attachment:
      url: “https://your_domain/local{{ states.input_text.picture_name.state }}”
      content-type: jpg
    • delay: ‘00:00:03’
    • service: hass_delete.files
      data_template:
      file_path: “/config/www{{ states.input_text.picture_name.state }}”

It seems that I can’t use it at v0.96.0.