Companion app help

I’m trying to create an automation in home assistant using android companion app so that when my android phone gets a text message from certain people, it turns on lights.
I have this working for when the phone recieves a text message…however when I try to add the variable of the certain people it stops working. I’ve added an image of the automation yaml. It does not work. When I remove the below lines, it works…

condition: template
value_template: >
{{ state_attr(‘sensor.sm_g988u1_last_notification’, ‘android.title’) in
[‘Gini’, ‘Laura Cell’, ‘Katherine Cell’] }}

I attached an image of the trace showing how it wasnt triggered when ‘Katherine cell’ sent me a text message, the last one.

I’ve also attached an image of the ‘last notification’ attributes, looks like ‘Android.title’ can be used as an identifier. It reliably shows only those 3 individuals listed in the yaml.

What am I doing wrong? How do I fix?



test your templates with developer tools so you can make sure they work as expected, also double check the raw data maybe something is formatted differently from what the frontend shows you

How do I access raw data? I cant seem to find any problems with my logic so hoping thats it.

Is there any issue with what Im trying to accomplish, is there anything in HA that would prevent this from working?

developer tools > states and look at the attributes to make sure they are the same

no issue probably a template issue, you can test your template in developers tools > template and make sure the template is correct

Please do not post screenshots because we cannot copy the code to make fixes or suggestions. Post the actual code in a code block so it is properly formatted on the forum. The code that you did post wasn’t formatted and was not consistent with the screenshot.

Some suggestions. This is what you posted at start:

value_template: >
  {{ state_attr(‘sensor.sm_g988u1_last_notification’, ‘android.title’) in [‘Gini’, ‘Laura Cell’, ‘Katherine Cell’] }}

There Android is lowercase, in the screenshots it is uppercase. Also the case of Cell does not match.

So make 100% sure all case and whitespace etc is correct. Second. The attribute may be a full blown object. In that case the attribute isn’t Android.title but Android. So try the below templates in the template tester of the development tools and see what it says:

 {{ state_attr(‘sensor.sm_g988u1_last_notification’, ‘Android.title’) }}
 {{ state_attr(‘sensor.sm_g988u1_last_notification’, ‘Android’).get('title','?') }}