Trash pick-up reminder

I’ve created a blueprint that sends you trash reminders based on a calendar with trash events. If trash is put out is tracked using an input button helper. The trash reminders are send as a notification that includes a button to mark the job done. It will send you a reminder every 30 minutes until you put the trash out :slight_smile:

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

IMG_6337 Medium

blueprint:
  name: Trash Reminder
  description: Send a notification the evening before trash pick up day.
  domain: automation
  input:
    trash_calendar:
      name: Trash calendar
      description: Calendar containing all-day events when trash needs to be picked up.
      selector:
        entity:
          filter:
            domain: calendar
    bin_put_outside_button:
      name: Trash put outside button
      description: Button that you press when trash is put outside.
      selector:
        entity:
          filter:
            domain: input_button
    notify_device:
      name: Device to notify
      selector:
        device:
          filter:
            integration: mobile_app

mode: single
max_exceeded: silent

trigger:
  platform: calendar
  event: start
  offset: "-4:00:00"
  entity_id: !input trash_calendar

action:
  - variables:
      bin_put_outside_button: !input bin_put_outside_button
  - repeat:
      while: >
        {{ states(bin_put_outside_button) | as_datetime < this.last_updated | as_datetime }}
      sequence:
        - domain: mobile_app
          type: notify
          device_id: !input notify_device
          message: Put the trash outside
          data:
            actions:
              - action: TRASH-DONE
                title: Done
        - wait_for_trigger:
            - platform: event
              event_type: mobile_app_notification_action
              event_data:
                action: TRASH-DONE
            - platform: state
              entity_id: !input bin_put_outside_button
          timeout:
            minutes: 30
        - if: '{{ wait.trigger.platform == "event" }}'
          alias: Handle notification action
          then:
            service: input_button.press
            data: {}
            target:
              entity_id: !input bin_put_outside_button

8 Likes

Hi,

I love this, makes what I had a bit simpler.

Though could you please tweak to provide the following options?

  1. Ability to adjust the offset in the automation.
  2. Add multiple devices to notify

Thanks / appreciated,
David

1 Like

I second these two suggestions.

Would love the additional functionality, but 1st I am struggling with getting this working,
Is there a step by step somewhere?
I set up a “garbage” calendar and filled that with necessary bin type schedule.
Apparently I need a button, I created a lovely button, but what is it meant to do?
I think I am missing something basic… as I am not getting any reminder.

Once you have both, create a new automation based on this blueprint and select both calendar and device to be notified

Thank you…
I think it was working, but it sends the reminder at 8pm the night before,
That is too late for my circumstance, so I edited the blueprint yaml to give -7:00:00 offset, to hopefully push the reminder at 5pm.
So it would be a nice enhancement to the.blueprint to make the offset configurable in the setup.
I am assuming the trigger is at midnight of the day for the entry in the calendar, minus the offset, so it prompts the evening before?
I am no coding expert, but that is how I read the blueprint code?

Thanks for this. Any ideas about what’s gone wrong here?

Button doesn’t exist

button existed. removing the underscore from the name fixed it.

Hi,

Where did you remove the underscore? I have the same issue, though no underscore in my button:

Hi again,
I am trying to edit the code to add the option to ‘announce’ on a media player (Alexa in my house)
as well as send the notify message…

I added this section to the Blueprint on my local HA.

   announce_device:
      name: Device to announce on
      description: Smart speaker device to announce message
      selector:
        device:
          filter:
          - integration: alexa_media_player
          multiple: false

which lines up exactly with the already existing ‘notify_device’ code for indentation.
But when I have this added, it breaks the automation completely

image

What am I doing wrong?
(sorry complete novice having a play here)

Hi David,
My guess is its not an underscore issue with yours,
but as Balloob initially stated, the button ‘button.binsout’ doesn’t exist on your HA?

For me under entities I have…

Thanks, but the button exists. It had to of initially as it was a required field in the blueprint.

Trying to get this blueprint to work. I have the automation setup based on the blueprint like this

alias: Trash Reminder
description: ""
use_blueprint:
  path: balloob/trash-pick-up-reminder.yaml
  input:
    trash_calendar: calendar.trash_schedule
    bin_put_outside_button: input_button.binsout
    notify_device: a5e7cb0d9a47e2ed1ba511737b798a9c

Last night at 8pm the automation triggered, but I didn’t get a notification.

{
  "trace": {
    "last_step": "action/1/repeat/while/0",
    "run_id": "48c9e2ff9c2957514df263c16f2d7a67",
    "state": "stopped",
    "script_execution": "finished",
    "timestamp": {
      "start": "2023-11-03T01:00:00.003053+00:00",
      "finish": "2023-11-03T01:00:00.007938+00:00"
    },
    "domain": "automation",
    "item_id": "1698883370028",
    "trigger": null,
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2023-11-03T01:00:00.003082+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.trash_reminder",
              "state": "on",
              "attributes": {
                "id": "1698883370028",
                "last_triggered": "2023-11-01T23:56:55.145105+00:00",
                "mode": "single",
                "current": 0,
                "friendly_name": "Trash Reminder"
              },
              "last_changed": "2023-11-02T13:09:01.646097+00:00",
              "last_updated": "2023-11-02T13:09:01.646097+00:00",
              "context": {
                "id": "01HE82DH2ECXV8P961E8W3JCZC",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "alias": null,
              "platform": "calendar",
              "event": "start",
              "offset": {
                "__type": "<class 'datetime.timedelta'>",
                "total_seconds": -14400
              },
              "calendar_event": {
                "start": "2023-11-03T00:00:00-05:00",
                "end": "2023-11-03T12:00:00-05:00",
                "summary": "Trash Day",
                "description": "",
                "uid": "0cf69ee2-7912-11ee-a44b-0800274eaefc",
                "recurrence_id": "20231103T000000",
                "rrule": "FREQ=WEEKLY;BYDAY=FR",
                "all_day": false
              }
            }
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2023-11-03T01:00:00.004654+00:00",
          "changed_variables": {
            "context": {
              "id": "01HE9B3BM3E31KY2TK4CD5AFE6",
              "parent_id": null,
              "user_id": null
            }
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2023-11-03T01:00:00.004741+00:00",
          "changed_variables": {
            "bin_put_outside_button": "input_button.binsout"
          }
        }
      ],
      "action/1/repeat": [
        {
          "path": "action/1/repeat",
          "timestamp": "2023-11-03T01:00:00.004982+00:00",
          "changed_variables": {
            "repeat": {
              "first": true,
              "index": 1
            }
          },
          "result": {
            "result": null
          }
        }
      ],
      "action/1/repeat/while/0": [
        {
          "path": "action/1/repeat/while/0",
          "timestamp": "2023-11-03T01:00:00.004995+00:00",
          "error": "In 'template' condition: TypeError: '<' not supported between instances of 'NoneType' and 'datetime.datetime'"
        }
      ]
    },
    "config": {
      "mode": "single",
      "max_exceeded": "silent",
      "trigger": {
        "platform": "calendar",
        "event": "start",
        "offset": "-4:00:00",
        "entity_id": "calendar.trash_schedule"
      },
      "action": [
        {
          "variables": {
            "bin_put_outside_button": "input_button.binsout"
          }
        },
        {
          "repeat": {
            "while": "{{ states(bin_put_outside_button) | as_datetime < this.last_updated | as_datetime }}\n",
            "sequence": [
              {
                "domain": "mobile_app",
                "type": "notify",
                "device_id": "a5e7cb0d9a47e2ed1ba511737b798a9c",
                "message": "Put the trash outside",
                "data": {
                  "actions": [
                    {
                      "action": "TRASH-DONE",
                      "title": "Done"
                    }
                  ]
                }
              },
              {
                "wait_for_trigger": [
                  {
                    "platform": "event",
                    "event_type": "mobile_app_notification_action",
                    "event_data": {
                      "action": "TRASH-DONE"
                    }
                  },
                  {
                    "platform": "state",
                    "entity_id": "input_button.binsout"
                  }
                ],
                "timeout": {
                  "minutes": 30
                }
              },
              {
                "if": "{{ wait.trigger.platform == \"event\" }}",
                "alias": "Handle notification action",
                "then": {
                  "service": "input_button.press",
                  "data": {},
                  "target": {
                    "entity_id": "input_button.binsout"
                  }
                }
              }
            ]
          }
        }
      ],
      "id": "1698883370028",
      "alias": "Trash Reminder",
      "description": ""
    },
    "blueprint_inputs": {
      "id": "1698883370028",
      "alias": "Trash Reminder",
      "description": "",
      "use_blueprint": {
        "path": "balloob/trash-pick-up-reminder.yaml",
        "input": {
          "trash_calendar": "calendar.trash_schedule",
          "bin_put_outside_button": "input_button.binsout",
          "notify_device": "a5e7cb0d9a47e2ed1ba511737b798a9c"
        }
      }
    },
    "context": {
      "id": "01HE9B3BM3E31KY2TK4CD5AFE6",
      "parent_id": null,
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "name": "Trash Reminder",
      "message": "triggered",
      "source": null,
      "entity_id": "automation.trash_reminder",
      "context_id": "01HE9B3BM3E31KY2TK4CD5AFE6",
      "when": 1698973200.003131,
      "domain": "automation"
    }
  ]
}

I can provide a screenshot of the trace UI if that’s easier.

Have you already found a solution for this?
I have exactly the same problem.
Button exists, but the same error message appears.

Thanks

No I havent. I have shelved this idea for now, but would like to investigate in the future. If you get it sorted please do report back.

Same issue with the button. I believe this Blueprint does not work.