Extract Title and Text from Android Notification?

I am running the HA companion app on an old tablet to get android notifications that I can send to LED displays through HA. They get published to the display through MQTT and I simply have the template below which displays the text from the notification. However I would like the notification to display the title and then the text all in one go.

{
“text”: "{{ states(‘sensor.lenovo_tb_8704f_last_notification’) }} ",
“repeat”: 2,
“duration”: 20
}

This is an below example of one of the notifications. In the example below I would like the text I sent to LED display to be: Matched ended Udinese 3-0 Bologna

Could anyone tell me how I could do this? Cheers

Attributes
Android.appInfo
ApplicationInfo{2a498b2 com.livescore}
Android.icon
2,131,232,005
Android.infoText
null
Android.largeIcon
null
Android.progress
0
Android.progressIndeterminate
false
Android.progressMax
0
Android.reduced.images
true
Android.remoteInputHistory
null
Android.showChronometer
false
Android.showWhen
true
Android.subText
null
Android.template
android.app.Notification$DecoratedCustomViewStyle
Android.text
Udinese 3-0 Bologna
Android.title
Match ended
Androidx.core.app.extra.COMPAT TEMPLATE
androidx.core.app.NotificationCompat$DecoratedCustomViewStyle
Category
null
Channel ID
livescore_channel_01
Group ID
8-1029236
Is clearable
true
Is ongoing
false
Package
com.livescore
Post time
1,703,951,799,179
Android.contains.customView
true

you need to use state_attr() so it should be {{ state_attr('sensor.last_notif', 'android.text') }} then repeat the same thing for android.title in place of android.text

1 Like