Regarding my WTH suggestion about the Android app

But if it’s not from someone you have in your phone list, do you really care about the phone number?
Wouldn’t it be better to translate phone numbers to names and if that’s not possible say “unknown”

Sure, because sometimes there are numbers that I’ll recognize but don’t necessarily want them in my contact list. Plus, if I hear a strange area code I’m automatically more guarded when answering.
My plan is to try to stick to how I have it now with Tasker – name first and if that fails, pass the number (without the leading 1 or +1).

I understand but in this case it won’t be able to access your contact list in the phone anyways, you need to “manually” type this in to your template.
So adding the few you know but don’t have in the contact list is trivial

I’d like to find a way to automatically export and format my contact list into HA. Maybe I’ll need to learn some database stuff, but it’s probably doable. Pretty sure there at least a few tools for that sort of thing. If I can use something like Syncthing to copy around music and photos I don’t see why a contact list would be any different.

Ok…
But you can replace your rather large template with this:

{{ ("+11234567890" |regex_replace(find='\+1', replace='') |regex_findall(find='(\d)')) | join(' ')}}

Oh… Sorry this doesn’t add the commas.
What are those needed for?

Excellent! That’s what I was looking for.
The commas are to make the announcement more TTS-friendly, otherwise it just speeds through the numbers too quickly to catch them all.
Thanks!

Will this remove the leading 1 if there are 11 digits or the +1 if there are 12 characters including the +?

Ok… sadly we need to make it a bit more ugly:

{% set p = ("+11234567890" |regex_replace(find='\+1', replace='') |regex_findall(find='(\d)')) | join(' ') %}
{{ p[0:5] }}, {{ p[6:11] }}, {{ p[12:19] }}

It will always remove any +1. So if they call from a country code with +11 then it will keep one of the 1’s.

Since it can’t know if there is a leading one, two or three digit country code, or even more, then its impossible to know what to do.
I mean look at this country code:

CountryCode.org: Guernsey Country Code 44 1481 Country Code GG

1 Like

Where I am in Canada it’s either 1 or +1 followed by a 3-digit area-code and then a 7-digit number. The code that I posted works pretty much perfectly since I don’t get overseas calls. So I’m looking for a + as the first character, that means it will be followed by a 1. Otherwise, if the number of digits is 11, then I also know a 1 has been tagged on to the beginning.

I have to go take care of something, but I was thinking – if I was able to get the caller ID name already a couple of years ago using the Tasker app on my phone and send it to HA, then why is it that the HA companion can’t? It’s all the same Android notification system, is it not? I’m going to look at the code again to see if I can remember exactly how I accomplished that and maybe there will be some clues.

Change the regex to find='[\+?]1

Thanks. I’ll give it a shot.
I received a call and there was no mention of the name or number of the caller in the attributes that were supposed to hold that information. This must have something to do with this “allow list” that is strongly encouraged in the documentation.
but yeah, I guess I’m just a bozo that’s trying to run before I can walk. :roll_eyes:
I checked my Tasker configuration and all I can see without delving back into that whole mess again is an action with the code

{ "entity_id": "input_text.caller_id_name", "value": "%CNAME" }

so we know that the caller id name is presented to the Android system for use with other apps.

Ok man, you just melted my brain. (it was already overheating from standard use, but I think I’m way out of my league here. That much was quite apparent some time ago). Can you please tell me how the F you learned all this and how can I become a Rain Man superhuman too so that I can set up caller ID? :wink: :laughing:

You just need to practice.
But regarding the app, it seems it’s Google dailer, but I just added them all.

Trying, but it’s hard to find resources. I learned some Lua many years ago for another home automation software, but in that case I had found e-books that were basically a self-taught course. I read little bits online here and there on YAML and Jinja2, but the stuff just makes my head swirl.
When you said that you “added them all”, so you mean every Google app? Adding every single app on the list would defeat the purpose of an “allow list”, no?
Thanks

Yes but I don’t care.
It was a lot simpler than trying to find what I needed.

I would recommend looking here in the forum for syntaxes. Try and read and understand them.
If you can add them to your developer tools and look at each part of it to understand it.