Vacuum dust bin full automation - Where can I be more efficient?

Hi everyone,

this is my first post on here, but I’ve been a still reader for the last half a year.

Today I automated my vacuum moving to the kitchen when his dust bin is full. I got it working, but I’m curious to know some best practices and what I could have done better or easier.

So I have 4 different automations:

  • Counter increase
  • Drive to Trash
  • Trash Notification
  • Trash Notification Done

The workflow looks something like this:

Counter increase

  1. is triggered by the state of my vacuum going from cleaning to returning
  2. increments a counter helper by 1
alias: Staubi - Counter Increase
description: ''
trigger:
  - platform: state
    entity_id: vacuum.staubi
    from: cleaning
    to: returning
condition: []
action:
  - service: counter.increment
    data: {}
    target:
      entity_id: counter.staubireinigung
mode: single

Drive to Trash

  1. is triggered by the state of my vacuum going from cleaning to returning
  2. condition: counter helper must be above 7
  3. actions:
    stop the vacuum (from going back to the dock)
    wait 5s
    drive vacuum to the kitchen
    turn on automation “Trash Notification”
alias: Staubi - Drive to trash
description: ''
trigger:
  - platform: state
    entity_id: vacuum.staubi
    from: cleaning
    to: returning
    for:
      hours: 0
      minutes: 0
      seconds: 5
condition:
  - condition: numeric_state
    entity_id: counter.staubireinigung
    above: '7'
action:
  - service: vacuum.stop
    data: {}
    target:
      entity_id: vacuum.staubi
  - delay:
      hours: 0
      minutes: 0
      seconds: 5
      milliseconds: 0
  - service: xiaomi_miio.vacuum_goto
    data:
      x_coord: '28849'
      y_coord: '23102'
    target:
      entity_id: vacuum.staubi
  - service: automation.turn_on
    data: {}
    target:
      entity_id: automation.staubi_trash_notification
mode: single

Trash Notification

  1. trigger: time pattern every minute
  2. condition: group status is home
  3. actions:
    send a telegram message with an inline keyboard
    turn on automation “Trash Notification Done”
    turns off itself
alias: Staubi - Trash  - Notification
description: ''
trigger:
  - platform: time_pattern
    minutes: /1
condition:
  - condition: state
    entity_id: group.blabla
    state: home
action:
  - service: telegram_bot.send_message
    data:
      inline_keyboard:
        - /erledigt
      message: 🗑️Staubi ist voll und steht zur Entleerung bereit🗑️
      target: TELEGRAM CHAT ID
      message_tag: staubi_erledigt
  - service: automation.turn_on
    data: {}
    target:
      entity_id: automation.staubi_trash_notification_erledigt
  - service: automation.turn_off
    data:
      stop_actions: false
    target:
      entity_id: automation.staubi_trash_notification
mode: single

Trash Notification Done

  1. trigger: telegram callback for inline keyboard response from “Trash Notification”
  2. actions:
    reset the counter helper
    turns off itself
    sends vacuum back to base
alias: Staubi - Trash Notification Done
description: ''
trigger:
  - platform: event
    event_type: telegram_callback
    event_data:
      command: /erledigt
condition: []
action:
  - service: counter.reset
    data: {}
    target:
      entity_id: counter.staubireinigung
  - service: automation.turn_off
    data:
      stop_actions: false
    target:
      entity_id: automation.staubi_trash_notification_erledigt
  - service: vacuum.return_to_base
    data: {}
    target:
      entity_id: vacuum.staubi
mode: single

As I said everything is working as it should, but I want to evolve a little bit further and would highly appreciate any tips regarding my structure, my automations and all possible improvements around this to make it cleaner and less messy.

Thanks,
Torben