Regarding my WTH suggestion about the Android app

I don’t mean to be a difficult person (it comes naturally), but I just wanted to mention again my suggestion that I posted since the thread was closed and locked as soon as possible and before I could respond:

I should have accentuated the part where I said “A SIMPLE WAY”. Just because the features exist, does not mean that they are easily accessible for us mere mortals. Snarkiness aside, I think both HA and the companion app are incredible and I’m grateful to be able to use them, so please don’t take my comments as entitlement or an insult.
My main reasoning behind the post was that I was thinking it would be amazing if there was a way to have built-in events and entities accessible from the GUI that could be set up simply and in a matter of minutes rather than having to dedicate a week to figuring out the inner workings of the Android sensors and allow lists. Just reading the documentation is giving me PTSD. While I realize it’s unavoidable in many cases, YAML coding makes me feel like I have a learning disability so I avoid it as much as possible.
That’s all. Thanks for listening

You mean like this?

These were setup and available immediately when I installed the Companion App on my Pixel 8.

Yes, like that – except I enabled “Last notification” after finding the options by some miracle (only visible when accessing settings through the companion app on the phone for some reason) and I have no idea what comes next. Some vague mention about creating an allow list.
Can you direct me to where I can find the caller ID information in the HA UI to use for caller ID announcements? Thanks

You’re really exaggerating how hard this is. Enable the last_notification entity shown in @MaxK’s image. Then just use that entity as a trigger. No yaml needed, just a normal automation.

1 Like

hmm. Well, I did manage to find the “Last Notification” trigger after following your advice, which is progress. Pretty sure I was searching for that before but missed it because I was looking for something more along the lines of callerID or something and that tripped me up, ending my attempts to get it to work. I still can’t find anything that might work for that. I’m assuming I would need to set up some sort of template to run with trigger.event.data or something. Can you give me some more hints? :slight_smile:
Can’t find any mention of “Allow List” in my settings, either.

I don’t know what you’re talking about with the allow list. All you need to use is the entity for the trigger. What you do after that depends on what you want to do.

I found the allow list. It’s buried in the sensor settings for “Last Notification”, at the bottom under the heading “Sensor Settings”. It also seems that I must’ve found the setting before at some point while trying to get this to work in the past, because I have somehow included Gmail, MmsService, Phone Calls, etc. in that list.
There is a list of attributes above that, which are outlined on the page that I was linked to by dshokouhi in my WTH post, but I have no idea which one to use to grab the caller ID information (name/number) of who is actively calling.
This may not be as simple as you credit it to be. Just saying. :wink:

1 Like

TBH, from my standpoint, it looks like you aren’t even trying to learn to walk before you run. You’ve been using home assistant for 2 years, at this point you should know where to look for information in relation to devices and entities. It honestly feels like you’re purposely avoiding these pages to make a point.

What’s the state of the last_notification entity? What are it’s attributes?

Not at all. I just find that after I waste hours upon hours using search engines to try to find answers I get flustered and probably lose focus and determination. The closest I found to a solution last time I undertook this task was a Reddit post where everyone else gave up too, and one person concluded that it’s not even possible. (I can find you a link if you’re curious)
Setting up an “Allow List”, as instructed in the documentation (and that’s as far as that goes as far as instruction in that regard), is a guessing game since you’re left scrolling through a seemingly endless list with zero explanation as to what those items are or why you are even checking them off to begin with. Is “Phone Calls” for the caller ID? I dunno, but let’s throw it in to the mix. Why not?
The Last Notification attributes are plentiful as well, but at least you can inspect the contents to try to glean their purpose. I see ZERO mention of Caller ID, and so that leaves me to guess that it must be something that I’ll need to scrape out of one of these fields such as “android.subText” or “android.title”. Unfortunately, I cannot phone myself, otherwise I would try to figure it out by trial and error as I did with the IMAP integration for my email announcements (with some assistance).
So tell me, do you have this set up with your phone? I know it would probably be a piece of cake for you, but I’m curious if there is something blatantly obvious that’s staring me in the face and I’m a complete idiot for missing it. I have a fair number of reasonably complex automations that use YAML extensively. It took me a crazy amount of effort to figure the stuff out, but the material seemed a lot more accessible.

Have a friend/family call you and don’t answer. The information is likely in the attributes.

Just looking at the documentation, if your notification was “missed call from xyz”, then it would clearly be in the message or title of the notification.

I have no friends. :rofl:
Yeah, but seriously, I tried texting my brother to call yesterday, but he has kids, so I guess he was distracted. I guess instead of seeking advice here I could always just call 911 and hang up. lmao

I’m trying to set up TTS announcements that happen as soon as my phone rings. I can see how to use the state of one of the attributes to trigger the automation when the phone is ringing, so I’m on the right track.
Right now I have cobbled together Tasker and Tasker plugins to send the caller ID info as a payload, using the REST API to trigger them and it works, but it’s very slow and I’d rather collate everything under Home Assistant for simplicity.

Some sales person just called me.

I got this when I hung up:


I assume the last notification would show something similar when the phone rang

Looking at those particular attribute that you’ve highlighted, I’m seeing my own email address under android.subtext (probably from when I was testing my IMAP automations), android.text is showing the body of an email from Amazon from the order that I placed just a while ago, and android.title is showing Amazon.ca.

Interesting – Thanks for the hope. :slight_smile:
So I guess the only way of doing this is to get someone to take some time out of their day to phone me a bunch of times while I fiddle around trying to find the nested info.
One thing I like about my Tasker solution is that it takes the name from my contacts list if available. I hope I can find the same functionality.

When I call myself from my work phone I get this:

See, you don’t need friends

Will you be my friend?

lol jk

Cool, thanks! Now that I can use. I can at least try to come up with the script so it’s ready for the next time I get a call. I’m a hermit though, so it could be a while. :wink:

And that’s the phone number it gives

Ok, so only the number is provided and not the contact name? I guess that’s not the end of the world if I can figure out a way to automate my contact list into a script somehow.

Oh, and since I have you guys’ attention and we’re on the topic of simple Caller ID :wink: , what would be the tidiest way of fixing up this code so that it’s not so amateurish, if you don’t mind?

 {% set Caller_Name = state_attr('sensor.pixel_5_last_notification', 'android.title') %}
{% if Caller_Name[:2]=="+1" %} {% set Caller_Name = Caller_Name[2:] %} 
{% elif Caller_Name[:1]=="1" %} {% set Caller_Name = Caller_Name[1:] %}
{% endif %}
{% set digits=((Caller_Name).join(Caller_Name)).count(Caller_Name) + 1 %}
{% if Caller_Name.isnumeric and digits==10 %}
{% set Caller_Name="Incoming call from "+ Caller_Name[0:1] +" "
+ Caller_Name[1:2] +" "+ Caller_Name[2:3] +","+ Caller_Name[3:4] 
+" "+ Caller_Name[4:5] +" "+ Caller_Name[5:6] +","+ Caller_Name[6:7] 
+" "+ Caller_Name[7:8] +" "+ Caller_Name[8:9] +" "+ Caller_Name[9:10] 
+"." %} {% else %} {% set Caller_Name="Incoming call from "+ Caller_Name %} 
{% endif %}
{{Caller_Name}}