Get app specific notifcations from android phone to HA instance

Hi,
I’m looking to get app specific notifications from the phone as entity states in HA. For example, an on/off switch entity for a new message or missed phone call.
After some googling i found some old threads about doing this with tasker, is this still the preferable approach or are there any newer solutions for this?

If you use the HA companion app, you can whitelist apps to allow their notifications to appear in the last_notification sensor then pipe those values wherever you want using trigger-based template sensors or automations.

Example
template:
  - trigger:
      - platform: state
        entity_id:
          - sensor.phone_last_notification
        not_to:
          - unknown
    sensor:
      - name: "Discord Notifications"
        state: >-
          {% set current = this.state %}
          {% if trigger.to_state.attributes.package != "com.discord") %}
          {{ current | default('No Notifictions') }}
          {% else %}{{ trigger.to_state.state }}
1 Like

Thank you, this is probably a lot easier than doing it with tasker.