Check if regular action was performed (NFC, webhook confirmation)

This blueprint regularly checks if a certain action (webhook, NFC-tag) has been performed within a given period. The action can be confirmed by NFC-tag, manually flipping the connected toggle in the UI or calling a webhook. Useful e.g.

  • to get an notification if a regular backup-job did not run (using a webhook at the end of the backup-script)
  • a medication has been taken (using an NFC tag, …). If the action is not registered to have happened, the specified actions are executed (e.g. notification)
  • the waste bin was not put in front of the house

As the blueprint cannot setup the required input_boolean, a input_boolean needs to be MANUALLY created beforehand. In order to do this go to “Configuration” → “Helpers” → “+ ADD HELPER” → “Toggle”. The state of this toggle will indicate if the task has been performed. It will be automatically reset when the blueprint checks if the action has been performed.

My first blueprint and I’m still learning templating in general … working nicely for me, hopefully also for you, but pl. check carefully…

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.


blueprint:
  name: Done Checker
  description: Send a notification if a task was not performed within a given time frame. Unsefull for regular like bringing out the waster, a backup-job completed, ... Confirmation that the task was performed can be done via the input boolen, a tag/QR-code or a webhook
  domain: automation
  input:
    checkingtime:
      name: Checking time
      description: At what time do you want to check if the action has been performed?
      selector:
        time:

    checkingWeekDay:
      name: Weekday to check (Optional)
      description: (Optional) Integer (1-7) - if you want to check only on one day of the week; 0 = every day
      selector:
        number:
          min: 0
          max: 7
      default: 0

    remindername:
      name: Reminder name
      description: A name of an existing (!) input_boolean helper that is used to see (or set) if the task was done since the last reset. This is also used for the webhook (http://homeassistant:8123/api/webhook/REPLACETHISWITHREMINDERNAME).
      default: "checkedreminder"

    tag_id:
      name: NFC tag (optional)
      description: Optional input; Input the ID of a tag. Scanning it will indicate that the action was performed
      default: []

    done_boolean:
      name: done_boolean
      description: The name of the input_boolean to handle history and state of the automation (must be created manually beforehand... limitation of blueprints....)
      selector:
        entity:
          domain: input_boolean

    optional_action:
      name: Optional action
      description: Run an action like send a message via the matrix integration...
      selector:
        action:
      default: []

trigger:
  - platform: webhook
    webhook_id: !input remindername
  - platform: time
    at: !input checkingtime
  - platform: tag
    tag_id: !input tag_id

mode: single

condition: []

action:
  - variables:
      input_remindername: !input "remindername"
      input_nfcname: !input "tag_id"
      input_checkingWeekDay: !input checkingWeekDay

  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.webhook_id == input_remindername }}"
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: !input done_boolean
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.tag_id == input_nfcname }}"
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: !input done_boolean
      - conditions:
          - condition: state
            entity_id: !input done_boolean
            state: "off"
          - condition: template
            value_template: "{{ now().isoweekday() == input_checkingWeekDay or input_checkingWeekDay == 0}}"
        sequence:
          - service: input_boolean.turn_on
            target:
              entity_id: !input done_boolean
    default:
      - condition: template
        value_template: "{{ now().isoweekday() == input_checkingWeekDay or input_checkingWeekDay == 0}}"

      - service: persistent_notification.create
        data:
          message: The action {{input_remindername}} was not performed!
          title: Reminder!
      - choose: []
        default: !input "optional_action"
2 Likes

Is there anyway to get this to repeatedly alert if you havent scanned the nfc tag?

Im trying to create an automation that will remind me to do physio exercises at 10 o’clock each day and if i dont do them within 10 minutes the alert repeats until I scan the nfc tag.

With the latest changes to the webhook, this needs to be updated to:

blueprint:
  name: Done Checker
  description:
    Send a notification if a task was not performed within a given time
    frame. Unsefull for regular like bringing out the waster, a backup-job completed,
    ... Confirmation that the task was performed can be done via the input boolen,
    a tag/QR-code or a webhook
  domain: automation
  input:
    checkingtime:
      name: Checking time
      description: At what time do you want to check if the action has been performed?
      selector:
        time: {}
    checkingWeekDay:
      name: Weekday to check (Optional)
      description:
        (Optional) Integer (1-7) - if you want to check only on one day
        of the week; 0 = every day
      selector:
        number:
          min: 0.0
          max: 7.0
          mode: slider
          step: 1.0
      default: 0
    remindername:
      name: Reminder name
      description:
        A name of an existing (!) input_boolean helper that is used to
        see (or set) if the task was done since the last reset. This is also used
        for the webhook (http://homeassistant:8123/api/webhook/REPLACETHISWITHREMINDERNAME).
      default: checkedreminder
    tag_id:
      name: NFC tag (optional)
      description:
        Optional input; Input the ID of a tag. Scanning it will indicate
        that the action was performed
      default: []
    done_boolean:
      name: done_boolean
      description:
        The name of the input_boolean to handle history and state of the
        automation (must be created manually beforehand... limitation of blueprints....)
      selector:
        entity:
          domain: input_boolean
    optional_action:
      name: Optional action
      description: Run an action like send a message via the matrix integration...
      selector:
        action: {}
      default: []
  source_url: https://github.com/udorda/HA_DoneChecker/blob/293884be9f04f54bb2449914970b51be1d262a97/DoneChecker.yaml
trigger:
  - platform: webhook
    webhook_id: !input "remindername"
    local_only: true
  - platform: time
    at: !input "checkingtime"
  - platform: tag
    tag_id: !input "tag_id"
mode: single
condition: []
action:
  - variables:
      input_remindername: !input "remindername"
      input_nfcname: !input "tag_id"
      input_checkingWeekDay: !input "checkingWeekDay"
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.webhook_id == input_remindername }}"
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: !input "done_boolean"
      - conditions:
          - condition: template
            value_template: "{{ trigger.event.data.tag_id == input_nfcname }}"
        sequence:
          - service: input_boolean.turn_off
            target:
              entity_id: !input "done_boolean"
      - conditions:
          - condition: state
            entity_id: !input "done_boolean"
            state: "off"
          - condition: template
            value_template:
              "{{ now().isoweekday() == input_checkingWeekDay or input_checkingWeekDay
              == 0}}"
        sequence:
          - service: input_boolean.turn_on
            target:
              entity_id: !input "done_boolean"
    default:
      - condition: template
        value_template:
          "{{ now().isoweekday() == input_checkingWeekDay or input_checkingWeekDay
          == 0}}"
      - service: persistent_notification.create
        data:
          message: The action {{input_remindername}} was not performed!
          title: Reminder!
      - choose: []
        default: !input "optional_action"

@repeated alerts: The script can’t do this, but you can add an action that flips the state of a toggle (-settings → helpers → toggle). You can then add a automation to this toggle state switching or add e.g. the following to your configuration yaml (this examples reminds me that the washing machine is full(

alert:
  washing_machiner:
    name: Washing machine is full
    done_message: Washing machine is emptied
    entity_id: input_boolean.washingmachine_full
    state: "on"
    repeat: 15
    can_acknowledge: true
    skip_first: false
    notifiers:
      - matrix_notify