Beyond Basics: Mastering Advanced Notifications with Home Assistant Companion Apps

Represent Beyond Basics: Mastering Advanced Notifications with Home Assistant Companion Apps article
4m read

In the vast ecosystem of Home Assistant, notifications are the lifeline that connects your smart home's actions to your awareness. While basic alerts like 'door opened' are fundamental, the true power of Home Assistant's communication lies in its deep integration with the official iOS and Android Companion Applications. These apps transform simple messages into interactive experiences, leveraging your mobile device's capabilities to provide rich, actionable insights and controls.

Getting Started: Your Mobile Companion

Before diving into advanced features, ensure your Home Assistant Companion App is correctly set up and connected to your instance. Download the official app from your device's respective app store (App Store for iOS, Google Play Store for Android). Upon first launch, the app will guide you through connecting to your Home Assistant instance, either locally or via a Nabu Casa subscription/manual remote access setup. Once connected, your device will automatically register as a new integration, making its services and sensors available to Home Assistant.

You'll typically find a new notification service available, named something like notify.mobile_app_your_device_name (e.g., notify.mobile_app_iphone_pro or notify.mobile_app_galaxy_s22). This is your primary conduit for sending messages to your phone.

The Anatomy of an Advanced Notification

Beyond the simple message field, Home Assistant's mobile notifications support a wealth of options that elevate their utility:

  • Title: A clear, concise headline for your notification.
  • Message: The main body of text.
  • Data: This is where the magic happens. The data field is a dictionary allowing you to specify actionable buttons, persistent IDs, notification channels, and more.

1. Actionable Notifications: Bringing Your Smart Home to Your Fingertips

Perhaps the most transformative feature is the ability to add actionable buttons directly to your notifications. This means you can respond to alerts without even opening the Home Assistant app. For instance, if a motion sensor detects activity while you're away, you could get a notification asking 'Who's there?' with 'Dismiss' and 'View Camera' buttons.

To create actionable notifications, you use the actions key within the data field. Each action requires an action ID and a title (the button text).

service: notify.mobile_app_your_device_name
data:
  message: "Someone is at the front door!"
  title: "Doorbell Alert"
  data:
    actions:
      - action: "VIEW_CAMERA"
        title: "View Camera"
      - action: "DISMISS_ALERT"
        title: "Dismiss"

Once a button is pressed, Home Assistant fires an event (mobile_app_notification_action for Android, ios.notification_action for iOS) that you can then trigger automations from:

automation:
  - alias: "Doorbell Action: View Camera"
    trigger:
      - platform: event
        event_type: mobile_app_notification_action # or ios.notification_action
        event_data:
          action: "VIEW_CAMERA"
    action:
      - service: lovelace.set_view
        data:
          view_path: "/lovelace/security"
      - service: # ... additional actions like opening camera stream app, etc.

Remember to handle both Android and iOS event types if you have users on both platforms.

2. Persistent Notifications and Grouping: Taming the Notification Storm

For critical alerts that require ongoing attention, or to group related notifications, use the tag parameter in the data field. Notifications with the same tag will replace previous ones, preventing a flood of identical alerts. You can also use a group for Android to combine notifications under a single expandable entry.

service: notify.mobile_app_your_device_name
data:
  message: "Garage door has been open for 10 minutes!"
  title: "Urgent: Garage Alert"
  data:
    tag: "garage_open_alert"
    # For Android to group similar notifications:
    group: "home_alerts"

You can later dismiss a persistent notification using the tag:

service: notify.mobile_app_your_device_name
data:
  message: "clear_notification"
  data:
    tag: "garage_open_alert"

3. Notification Channels (Android) / Categories (iOS): Granular Control

Give your notifications custom sounds, vibrations, and importance levels by defining channels (Android) or categories (iOS). This allows users to customize their alert preferences directly from their phone's settings for different types of Home Assistant notifications.

For Android:

service: notify.mobile_app_your_device_name
data:
  message: "Motion detected in the living room."
  title: "Security Alert"
  data:
    channel: "security_alerts"
    importance: "high" # 'default', 'low', 'high', 'max'
    ttl: 0 # Never expire

You must define these channels within the Companion App's settings on the Android device for them to appear and be customizable by the user. iOS uses a similar concept of 'categories' defined within the app's configuration.

4. Leveraging Device Sensor Data in Notifications

The Companion App exposes a wealth of sensor data from your mobile device to Home Assistant, including battery level, charger status, steps, activity, and most powerfully, location data via geofencing. You can use these sensors to trigger automations that send highly relevant notifications.

Example: Battery Level Alert

automation:
  - alias: "Low Phone Battery Notification"
    trigger:
      - platform: numeric_state
        entity_id: sensor.your_device_name_battery_level
        below: 20
    condition:
      - condition: state
        entity_id: sensor.your_device_name_is_charging
        state: "off"
    action:
      - service: notify.mobile_app_your_device_name
        data:
          message: "Your phone battery is at {{ states('sensor.your_device_name_battery_level') | int }}% and not charging."
          title: "Low Battery Alert"
          data:
            channel: "system_alerts"
            priority: "high" # For iOS, similar to Android importance
            ttl: 0

Example: Geofencing for 'Welcome Home' or 'Leaving' Alerts

automation:
  - alias: "Welcome Home Notification"
    trigger:
      - platform: zone
        entity_id: person.your_name
        zone: zone.home
        event: enter
    action:
      - service: notify.mobile_app_your_device_name
        data:
          message: "Welcome home, {{ states('person.your_name') }}!"
          title: "Home Assistant"

Best Practices for a Reliable Notification System

A well-configured notification system is key to a responsive and reliable smart home. Here are some best practices:

  • Be Concise and Clear: Notifications should convey information quickly. Avoid overly verbose messages.
  • Avoid Notification Fatigue: Too many irrelevant notifications will lead to users ignoring them. Use conditions and throttling (e.g., using `for` in triggers, or delays) to limit the frequency of alerts.
  • Prioritize and Categorize: Use channels/categories and importance/priority levels to differentiate critical alerts from informational ones.
  • Implement Actionable Responses Thoughtfully: Ensure the actions provided are truly useful and don't lead to accidental commands. Always consider confirmation steps for destructive actions.
  • Test Thoroughly: Send test notifications for all scenarios (e.g., app in background, phone locked, different network conditions).
  • Leverage Templating: Use Jinja2 templates (as seen in the battery example) to make your notifications dynamic and personal.
  • Consider Fallbacks: For truly critical alerts (e.g., smoke alarm), consider sending notifications via multiple channels (e.g., Companion App + Pushover/SMS) to ensure delivery even if one service fails.
  • Educate Users: If others use your Home Assistant instance, explain the purpose of different notification channels and how they can customize them on their devices.

Conclusion

Mastering advanced notifications with the Home Assistant Companion Apps elevates your smart home from a collection of devices to an intuitive, interactive environment. By thoughtfully implementing actionable alerts, leveraging device sensors, and adhering to best practices, you can create a communication system that keeps you informed, in control, and truly connected to your home, wherever you are. Experiment with these features, and discover new ways to make your smart home truly intelligent and responsive to your needs.

Avatar picture of NGC 224
Written by:

NGC 224

Author bio: DIY Smart Home Creator

There are no comments yet
loading...