Silly me - I pasted the code from the visual editor. Here is the code for the yaml condition:
condition:
- condition: template
value_template: |-
value_template: >
{{ 'Me' in trigger.event.data['android.messages.0.sender'] }
Even copying and pasting that was an experience for me - I had no idea about the back-tick or where it was on the keyboard. Tilde yes but missed “back-tick”. Pre 80s high school.
Here’s my attempt at pasting the trace. It IS very long:
{
"trace": {
"last_step": "condition/0",
"run_id": "211abc31d442b31b11a1e950bca0750a",
"state": "stopped",
"script_execution": "failed_conditions",
"timestamp": {
"start": "2024-09-27T15:02:51.141756+00:00",
"finish": "2024-09-27T15:02:51.142631+00:00"
},
"domain": "automation",
"item_id": "1695074365574",
"trigger": "state of sensor.moto_g_stylus_5g_last_notification",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2024-09-27T15:02:51.141807+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.notification_test",
"state": "on",
"attributes": {
"id": "1695074365574",
"last_triggered": "2024-09-27T06:22:13.126877+00:00",
"mode": "single",
"current": 0,
"friendly_name": "MotoGStylus text from Sally"
},
"last_changed": "2024-09-27T06:22:09.877518+00:00",
"last_reported": "2024-09-27T06:22:13.127547+00:00",
"last_updated": "2024-09-27T06:22:13.127547+00:00",
"context": {
"id": "01J8S29TM6RT5FXNQWPGWYNN7R",
"parent_id": "01J8S29TM6EFCSXH3HEP0EVVTP",
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "state",
"entity_id": "sensor.moto_g_stylus_5g_last_notification",
"from_state": {
"entity_id": "sensor.moto_g_stylus_5g_last_notification",
"state": "Monitoring for mail",
"attributes": {
"android.appInfo": "ApplicationInfo{bc8e904 com.hermes.enotifylite}",
"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.text": "null",
"android.title": "Monitoring for mail",
"category": "null",
"channel_id": "com.hermes.enotify.channel_foreground",
"group_id": "null",
"is_clearable": false,
"is_ongoing": true,
"package": "com.hermes.enotifylite",
"post_time": 1727449343422,
"icon": "mdi:bell-ring",
"friendly_name": "moto g stylus 5G Last notification"
},
"last_changed": "2024-09-27T14:58:10.386289+00:00",
"last_reported": "2024-09-27T15:02:25.458850+00:00",
"last_updated": "2024-09-27T15:02:25.458850+00:00",
"context": {
"id": "01J8T02BDJJMCFBM2KN6QQ6GM7",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "sensor.moto_g_stylus_5g_last_notification",
"state": "Testing ",
"attributes": {
"android.appInfo": "ApplicationInfo{bd959bc com.google.android.apps.googlevoice}",
"android.car.EXTENSIONS": "{invisible_actions={0={extras={android.support.allowGeneratedReplies=true}, showsUserInterface=false, remoteInputs=null, semanticAction=2, icon=2131231034, title=Mark as Read, actionIntent=PendingIntent{f73a1af: android.os.BinderProxy@99530df}}}}",
"android.conversationUnreadMessageCount": 0,
"android.hiddenConversationTitle": "null",
"android.infoText": "null",
"android.isGroupConversation": false,
"android.largeIcon": "Icon(typ=BITMAP size=111x111)",
"android.messages": [
"{extras={}, sender_person=android.app.Person@2778a1ee, sender=Me, text=Testing , time=1727449365316}"
],
"android.messagingStyleUser": "{key=null, uri=null, icon=null, name=You, isBot=false, isImportant=false}",
"android.messagingUser": "android.app.Person@9aa2142",
"android.people.list": [
"android.app.Person@7ac64d3e"
],
"android.progress": 0,
"android.progressIndeterminate": false,
"android.progressMax": 0,
"android.reduced.images": true,
"android.remoteInputHistory": "null",
"android.selfDisplayName": "You",
"android.showChronometer": false,
"android.showWhen": true,
"android.subText": "[email protected]",
"android.support.v4.app.extra.COMPAT_TEMPLATE": "androidx.core.app.NotificationCompat$MessagingStyle",
"android.template": "android.app.Notification$MessagingStyle",
"android.text": "Testing ",
"android.title": "Me",
"android.wearable.EXTENSIONS": "{background=android.graphics.Bitmap@f4fc9a, actions=[android.app.Notification$Action@662a9cb]}",
"category": "msg",
"channel_id": "2TXT",
"group_id": "null",
"is_clearable": true,
"is_ongoing": false,
"package": "com.google.android.apps.googlevoice",
"post_time": 1727449369127,
"icon": "mdi:bell-ring",
"friendly_name": "moto g stylus 5G Last notification"
},
"last_changed": "2024-09-27T15:02:51.140015+00:00",
"last_reported": "2024-09-27T15:02:51.140015+00:00",
"last_updated": "2024-09-27T15:02:51.140015+00:00",
"context": {
"id": "01J8T034G42BRTFCKAVWZWMPZM",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of sensor.moto_g_stylus_5g_last_notification"
}
}
}
],
"condition/0": [
{
"path": "condition/0",
"timestamp": "2024-09-27T15:02:51.141850+00:00",
"error": "In 'template' condition: UndefinedError: 'dict object' has no attribute 'event'"
}
]
},
"config": {
"id": "1695074365574",
"alias": "MotoGStylus text from Sally",
"trigger": [
{
"platform": "state",
"entity_id": [
"sensor.moto_g_stylus_5g_last_notification"
],
"to": null
}
],
"condition": [
{
"condition": "template",
"value_template": "value_template: >\n {{ 'Me' in trigger.event.data['android.messages.0.sender'] }} \n "
}
],
"action": [
{
"action": "notify.persistent_notification",
"metadata": {},
"data": {
"message": "It worked"
}
}
]
},
"blueprint_inputs": null,
"context": {
"id": "01J8T034G5CD1RQBQAVXFS8Y7G",
"parent_id": "01J8T034G42BRTFCKAVWZWMPZM",
"user_id": null
}
},
"logbookEntries": []
}
I made sure I had just sent a message from “Me”; last notification pulls up everything - push, weather. text, etc.
Thanks for the help. If nothing else at least I found out how to ask a question correctly here