home-assistant / home-assistant/iOS

sourceDeviceName not being passed in Actionable Notifications

Open
#2,033 6 comments 1 reaction 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

**iOS device model, version and app version**

Model Name: iPhone 11 Pro Max
Software Version: 15.1
App version: 2021.12.1 (2021.327)

**Home Assistant Core Version**
2021.12.6

**Describe the bug**
I'm no longer seeing `sourceDeviceName` being passed in Home Assistant's event bus when an actionable notification has been triggered on my iOS device. I rely on the device name to differentiate which user is responding to the actionable notification so the appropriate action is triggered.

**To Reproduce**
Here's the notification script I use (updated per the migration documentation):

```
affresh_wm_notify:
alias: Affresh Washing Machine Notify
description: 'Affresh Washing Machine Notification Routine'
sequence:
- service: notify.group
data:
title: "Affresh Washing Machine"
message: "It's time to clean the washing machine. Have you done a maintenance cycle?"
data:
actions:
- action: 'AFFRESH_WM_CLEANED'
title: 'Done'
- action: 'AFFRESH_WM_SNOOZE_15M'
title: 'Remind me in 15 min'
- action: 'AFFRESH_WM_SNOOZE_30M'
title: 'Remind me in 30 min'
- action: 'AFFRESH_WM_SNOOZE_1H'
title: 'Remind me in 1 hour'
- action: 'AFFRESH_WM_SNOOZE_2H'
title: 'Remind me in 2 hours'
- action: 'AFFRESH_WM_SNOOZE_24H'
title: 'Remind me tomorrow'
tag: "affresh_wm"
```

When triggered, this script produces the expected actionable notification. But when selecting an option, the event bus for mobile_app_notification_action looks like this:

```
{
"event_type": "mobile_app_notification_action",
"data": {
"action": "AFFRESH_WM_SNOOZE_15M"
},
"origin": "REMOTE",
"time_fired": "2021-12-29T01:10:17.072375+00:00",
"context": {
"id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"parent_id": null,
"user_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
```
That means this automation is no longer triggered:
```
automation:
...
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: 'AFFRESH_WM_SNOOZE_15M'
sourceDeviceName: 'Phone1'
...
```
This automation works if I remove the `sourceDeviceName`, but that doesn't solve the problem that no user-defined device name is being passed on the event bus.

**Expected behavior**
A device identifier (preferably the user-defined device name) be passed in the data payload for mobile_app_notification_action.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.