home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.23k stars 623 forks source link

Allow notifications to be sent to the phone only and not mirrored to the watch #4118

Open mwhdc opened 8 months ago

mwhdc commented 8 months ago

I'm using HA on a Pixel phone and paired Samsung watch. Samsung uses its own app (Galaxy Wearable) to manage the connection between the phone and watch. Phone apps can be selected individually for notification mirroring on the watch. If the phone and watch both have an app with the same package name, Galaxy Wearable combines them into a single notification toggle (see first image).

For HA, the effect of this unified toggle is that the watch can display either notifications from both the phone app and the watch app, or no notifications at all. For the watch to display notifications sent to notify.mobile_app_watch, it must also display notifications sent to notify.mobile_app_phone.

I would like to send a small number of urgent notifications to the watch without mirroring the higher volume of notifications sent to the phone, which currently is not possible. If it doesn't break anything, I would suggest assigning a different package name to the Wear build of the HA Android app. This would allow a representation like the Alexa app (see second image) in Galaxy Wearable.

2 1

Edit: Trimmed images, image order

dshokouhi commented 8 months ago

Galaxy Wearable combines them into a single notification toggle (see first image).

interesting pixel watch allows me to differentiate between phone and watch here

image

I would like to send a small number of urgent notifications to the watch without mirroring the higher volume of notifications sent to the phone, which currently is not possible.

looks like we can achieve this by introducing a new option: https://developer.android.com/reference/android/app/Notification.Builder#setLocalOnly(boolean)

As a quick workaround you can set some of those urgent notifications to be persistent it will avoid adding the notification to the watch

I would suggest assigning a different package name to the Wear build of the HA Android app

we need to use the same package name to keep the listing the same and you need the phone app to login.

jpelgrom commented 8 months ago

I believe that you can enable watch notifications independently of a phone companion app using developer settings on the watch. Can't test as the Galaxy Wearable app is broken for me (Pixel with January 2024 update...) but you can see it on the watch in settings > developer options > app notifications.

(That even allows enabling/disabling notification channels for watch apps which for whatever reason Samsung didn't include in the Galaxy Wearable app either.)

mwhdc commented 8 months ago

@dshokouhi Ah, understood about the package name. Would you expose the localOnly option to the user in the phone app under Wear OS settings? It should probably default to off for intuitive behavior across OEMs and then users with specific use cases like mine could dig for it.

@jpelgrom Good point, I did find those settings and hoped that they would work as you described, but they didn't. Disabling HA notifications in Galaxy Wearable seems to tell the watch not to render any visible notifications, but notification commands still reach the watch app regardless of the toggle state. I believe disabling HA notifications in the watch's developer options blocked notification commands as well.

dshokouhi commented 8 months ago

Would you expose the localOnly option to the user in the phone app under Wear OS settings?

yes it would be exposed to the phone only here, no need to add to Wear OS as these are bridged notifications sent to the phone

It should probably default to off for intuitive behavior across OEMs and then users with specific use cases like mine could dig for it.

yes it actually does default to off as thats existing behavior :)

jpelgrom commented 8 months ago

I believe disabling HA notifications in the watch's developer options blocked notification commands as well.

That shouldn't happen as they are only notifications in name but unless you make an error aren't actually handled as notifications.

yuejon commented 4 months ago

Can there be a toggle on the wear os version to disable push notifications? I have a pixel watch so it's not been a problem for me to turn off the watch specific notifications from the pixel watch app, but my wife has a Galaxy watch and the duplicate notifications are driving her crazy.

dshokouhi commented 4 months ago

@yuejon if your wife is getting duplicate notifications then you need to use the correct service call so you don't send one to the phone and the other to the watch. It's always best to create a notify group and add the service calls you actually wish to get the notification on and use that.

yuejon commented 4 months ago

@dshokouhi - I do plan on separating the notification service call (which would involve going through and rewriting a lot of automations). However, the SensorWorker notifications still show up on her watch. It would be really nice to be able to turn off the Wear OS notifications in the companion app if the wearable does not have separate phone and watch notifications like Galaxy wearables.

dshokouhi commented 4 months ago

@yuejon you can turn off the notification channel for the sensor worker just like you can on the phone. I suggest reading the companion docs to better familiarize yourself with the features of the app and device

mwhdc commented 3 months ago

While this thread is bumped, may I please lobby for the original feature request to be included in an upcoming build?

@dshokouhi's solution was to implement a localOnly toggle in the phone app's Wear OS settings that would prevent phone notifications from being forwarded to the watch. This would allow owners of Galaxy Watches to target their phone and/or watch separately for notifications.

(This is a workaround for the overly simplified design of the Galaxy Wearable app, which doesn't allow notifications to be enabled for a watch app without also enabling notification forwarding from the companion phone app.)