Estimated reading time: 12 minutes

In the world of home automation, Home Assistant is one of the most popular platforms for connecting various smart devices and services. One particularly useful feature is the ability to create automated notifications that can inform the user of important events or trigger actions. In this article, we take a look at the basics of notifications in Home Assistant. Here you will learn how to withdraw or update notifications that have already been sent to keep your communication efficient and relevant. This feature can be crucial to avoid unnecessary distractions and ensure your automations are doing exactly what they're supposed to.

For detailed instructions and an explanation of all configuration options, I recommend the YouTube video linked below. In this video, every single setting is explained in detail so that you receive comprehensive instructions for the exact setup. You can find any code from the video in this article so that you can use it directly without having to type it in.

What is Home Assistant?

Home Assistant is an open source platform for home automation that aims to connect and centrally control all devices in the home. It is designed to provide a unified user interface and simple, flexible control for a variety of smart home devices from different ecosystems. Here are some points in favor of Home Assistant:

  1. CompatibilityHome Assistant supports thousands of devices and services from various manufacturers, including lighting, air conditioning, heating, cameras, weather sensors, voice assistants and more.
  2. Local controlUnlike many commercial smart home platforms that rely on cloud services, Home Assistant runs locally on your network. This means increased privacy and reliability, as your smart home devices work even without an active internet connection.
  3. Automation and scenesOne of the main features of Home Assistant is the ability to create complex automations and scenarios. For example, you can have lights switch on automatically when it gets dark or turn on the heating when the temperature falls below a certain level.
  4. Simple user interfaceHome Assistant offers a user-friendly interface that makes it easy to monitor and control devices. This interface is fully customizable.
  5. Integration with voice assistantsHome Assistant can be integrated with voice assistants such as Amazon Alexa or Google Assistant to enable voice-controlled control of your smart home devices.
  6. Open source and community-drivenSince Home Assistant is open source, it is supported by an active community that is constantly developing new integrations and improving existing ones.
  7. Data protection and securityAs a locally running platform, Home Assistant has the advantage that the data remains within its own network. This protects privacy and increases security compared to cloud-based solutions.

In summary, Home Assistant is a powerful and flexible solution for those who want to design their own smart home and control their devices centrally, regardless of the manufacturer or ecosystem.

Main part

Imagine your robot vacuum cleaner working diligently in the background while you take care of more important things. But how do you keep track of when it starts and finishes its work? That's where automated notifications in Home Assistant come in! With Home Assistant, you can easily set up notifications to let you know when your robot starts vacuuming and when it's finished. And the best part: you can even replace old notifications with the clear_notification so that your notification center does not overflow.

All you need is the annotation persistent: true and a tag name of your choice with, for example tag: vacuum_statuswhen you send a notification. You can then pick up the notification(s) again and also delete them automatically. I'll show you how to use it using a complete example.

Automation: Vacuum cleaner - start when on the move

alias: Vacuum cleaner - Start when on the move
description: >-
  Starts cleaning by the robot vacuum cleaner when at least 12 hours
  have passed since the last cleaning and sends a notification to smartphones.
  smartphones.
trigger:
  - platform: zone
    entity_id: person.sascha
    zone: zone.home
    event: leave
    enabled: true
condition:
  - condition: template
    value_template: >-
      {{ (as_timestamp(now()) -
      as_timestamp(states('sensor.roborock_s7_last_clean_end')) > 43200) or
               states('sensor.roborock_s7_last_clean_end') == 'none' }}
    alias: If the last cleaning was at least 12 hours ago (43200)
action:
  - service: notify.smartphones
    data:
      message: Robot vacuum cleaner started in apartment
      title: Cleaning started
      data:
        notification_icon: mdi:robot-vacuum
        channel: Emergency
        priority: high
        ttl: 0
        color: blue
        tag: vacuum_status
        persistent: true
  - service: vacuum.start
    data: {}
    target:
      device_id: 67655efcf2a57d5c5115ac4245ff864c
mode: single

This Home Assistant automation is about automatically starting the robot vacuum cleaner as soon as you leave the house and at least 12 hours have passed since the last cleaning. At the same time, you will receive a notification on your smartphone. Here is a detailed explanation of how it works:

Alias and description: The automation is called "Vacuum cleaner - start when on the move" and ensures that the vacuum cleaner starts when certain conditions are met. A short description indicates that the robot starts when you leave the house and 12 hours have passed since the last cleaning.

Trigger: The trigger for this automation is based on the location of "person.sascha". As soon as Sascha leaves the "home" zone, i.e. leaves the house, the automation is triggered.

Condition: To ensure that the robot is not cleaned too frequently, a condition checks whether at least 12 hours have passed since the last cleaning. The automation uses the sensor sensor.roborock_s7_last_clean_endwhich saves the time of the last cleaning. The condition is: If more than 12 hours (43200 seconds) have passed since the last cleaning or the sensor has no value, then cleaning may start.

Action: The action consists of two parts. First, a notification is sent to your smartphone. This notification informs you that the robot vacuum cleaner has started and displays a small robot icon. The notification is persistent, i.e. it remains visible until it is deleted by the user. Also very important here is the tagwhich can be used to address the notifications again later. The automation then starts the robot vacuum cleaner by calling up the relevant service and entering the robot's device ID.

Mode: The automation is configured in "single" mode. This means that it is not restarted as long as it is already running. If it is triggered again during a running execution, this new trigger is ignored until the current execution is completed.

This automation is a practical example of how you can make your everyday life even more convenient with Home Assistant. You no longer have to worry about the robot vacuum cleaner, as it starts automatically when you're out and about and it's time for another clean. At the same time, a notification keeps you up to date so that you always know what's happening in your home.

Automation: Vacuum cleaner - Ready notification

This Home Assistant automation ensures that you receive a notification when your robot vacuum cleaner has finished cleaning. It ensures that the message does not become superfluous by deleting old notifications. Here's how it works:

The name of the automation"Vacuum cleaner - ready notification", says it all: you will be informed when the robot is ready. The description says that the message is sent to smartphones.

The trigger for this automation is the change of robot state. It becomes active when the robot vacuum cleaner (vacuum.roborock_s7) to the state docked (returned to the charging station) or idle (standby) changes. Important point: This status change must not be triggered by unavailable, error, docked, idle or unknown come. This prevents unnecessary notifications that could be triggered by a robot restart, for example.

With the actions There are two important steps in the automation process. First, a previous notification is deleted. This is done by the message "clear_notification" with the Day vacuum_status. This prevents old notifications that are no longer up to date from being retained. We therefore delete the previous notification that the robot vacuum cleaner has started cleaning, if we have not already swiped it away.

A new notification is then sent containing detailed information about the completed cleaning. You will be informed how much area has been cleaned in square meters and how long it took. This data comes directly from the robot's sensors (sensor.roborock_s7_last_clean_area and sensor.roborock_s7_last_clean_duration). The message has the title "Cleaning done" and is designed to be conspicuous: a robot symbol, green color and high priority ensure that it is not overlooked.

The mode of automation is singlewhich means that it does not run in parallel. If the robot is currently sending a message and would trigger such a notification again, the automation waits until the current action has been completed.

This automation ensures that you are always well informed when the vacuum cleaner has finished its work without being inundated with old notifications. This keeps your notification center clean and you always have an overview of the cleaning status of your home.

Hide notifications by time

In Home Assistant, you can receive notifications using the timeout parameter to be hidden automatically after a certain time. This parameter specifies the duration in seconds how long a notification remains visible on your device before it disappears. For example timeout: 60that the notification is automatically hidden after 60 seconds. This is particularly useful to ensure that short-term information, such as a short status message or a success message, does not block the user interface for an unnecessarily long time. This keeps your notification center tidy and only the really important messages remain visible for longer.

Example

alias: Monitor - Kitchen light on too long
description: ""
trigger:
  - platform: state
    entity_id:
      - light.kitchen_ceiling_lights
    to: "on"
    for:
      hours: 1
      minutes: 0
      seconds: 0
condition: []
action:
  - service: notify.smartphones
    data:
      title: Kitchen is still on!
      message: The light in the kitchen has been on for over 1 hour!
      data:
        channel: Warning
        priority: high
        ttl: 0
        color: yellow
        notification_icon: mdi:lightning-bolt-circle
        actions:
          - action: KUECHE_AUS
            title: Kitchen off
            icon: mdi:lightbulb-multiple-off
        timeout: 7200
mode: single

This home assistant automation monitors the light in the kitchen and sends a notification if it is left on for an extended period of time. Here is a detailed explanation of the automation, with a special focus on the timeout Parameters.

Alias and description: The automation is called "Monitor - Kitchen light on too long". It has no additional description, but the alias describes its function: monitoring the kitchen light.

Trigger:

  • The trigger for this automation is activated when the kitchen light (light.kuche_ceiling_lights) remains switched on. Specifically, the automation is activated if the light has been "on" for more than one hour without interruption. This is defined by the specification for: hours: 1, minutes: 0, seconds: 0 achieved.

Condition: No special conditions are defined, which means that the automation is always executed when the trigger is activated.

Action:

  • The action of the automation is to send a notification to your smartphones. This notification indicates that the light in the kitchen has been on for over an hour. Here are some of the details about the notification:
    • title: "Kitchen is still on!"
    • message: "The light in the kitchen has been on for over an hour!"
    • data:
      • channel: Warning - This channel flags the notification as a warning.
      • priority: high - The high priority ensures that the notification is noticed immediately.
      • ttl: 0 - The time-to-live parameter ttl is set to 0, which means that the notification is sent immediately, without delay.
      • color: yellow - The yellow color makes it clear that this is a warning.
      • notification_icon: mdi:lightning-bolt-circle - An icon that visually indicates the notification.
      • actions: An action with the name KUECHE_AUS which allows the light to be switched off directly via the notification. The action is marked with a corresponding symbol (mdi:lightbulb-multiple-off).
      • timeout: 7200 - This parameter defines how long the notification remains on the screen before it is automatically hidden. In this case, it is 7200 seconds (2 hours). The timeout parameter is particularly useful to ensure that important notifications remain visible for long enough, but also do not permanently block the screen. This removes the notification after the specified time has elapsed, which is particularly useful to avoid disturbing users if they have already received the information.

Mode:

  • The automation is in mode singlewhich means that it is not executed in parallel. If the automation is triggered again while it is still running, the second trigger is ignored until the first execution has been completed.

This automation helps you to save energy and become aware of unused electrical appliances by notifying you if the light in the kitchen is left on for too long. The timeout parameter ensures that the notification is only visible for a limited time, which improves user-friendliness.

YouTube video implementation

https://youtu.be/8Eq7niVhS4c

Conclusion

With Home Assistant, you can make your home more efficient and convenient by setting up smart automations and notifications. Not only do you receive up-to-date information about the status of your devices, such as your robot vacuum cleaner, but you can also react to them in a targeted manner. Automated notifications let you know when the robot starts and finishes its work, and you can even delete old notifications using the clear_notification delete. This keeps your notification center clear and prevents unnecessary distractions.

The option to deactivate notifications after a set time using the timeout Hiding parameters offers you additional convenience. This way, temporary information is automatically removed and you can keep track of the really important notifications. Overall, this blog post shows you how you can use Home Assistant to take your home automation to the next level by setting up practical and user-friendly notifications. Try out the automations presented for yourself and see how they simplify your everyday life!

The display of the products was implemented with the affiliate-toolkit plugin.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_US