How do I set my if-condition to be a certain string within an attribute in this case?

I run an automation that checks whether the HA Companion App’s LastNotification sensor 's attributes equal certain strings.

The if-conditions look like this:

{{ trigger.to_state.attributes.package == 'com.google.android.calendar' and
trigger.to_state.attributes.channel_id == 'REMINDERS' }}

This has worked without any issues, but I’ve been trying to add a condition: One that checks whether a certain attribute contains a certain string rather than whether it equals it and I don’t know how to do that.
I thought it might work like this:

'[email protected]' in trigger.to_state.attributes.android.wearable.EXTENSIONS

Unfortunately it didn’t and the automation traces showed the error Error: In 'template' condition: UndefinedError: 'homeassistant.util.read_only_dict.ReadOnlyDict object' has no attribute 'android'

In the following image I’ve highlighted the attribute of the notification we’re trying to work with here:

{{ '[email protected]' in trigger.to_state.attributes['android.wearable.EXTENSIONS'] }}

1 Like

Thanks, petro. You’re an angel, seriously!