Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notifications improvements for OH 4.0 #3193

Open
digitaldan opened this issue Feb 5, 2023 · 13 comments
Open

Push Notifications improvements for OH 4.0 #3193

digitaldan opened this issue Feb 5, 2023 · 13 comments
Labels
enhancement Indicates new feature requests

Comments

@digitaldan
Copy link
Contributor

Hi @maniac103 and @mueller-ma, I would also like to invite @weakfl and @timbms from the IOS project https://github.com/openhab/openhab-ios/ to this discussion.

I would like to propose enhancing our push notifications across both mobile platforms. While i'm sure there is a very long list of stuff we could do, i was thinking about starting of with 2 new features and see what people think.

The first feature would be to let users add in a UI navigation target , so that when the notification is clicked on the users device, the app can open to a specific page. I was thinking about name spacing this, so you might have:
sitemap:main/00000100
or
webui:/page/cameras

The user would have this as an option when generating the notification from rules, for example:
actions.NotificationAction.sendNotification(email, message, path);

The second feature i would propose is adding a media-url property, so users could attach an image or even a video URL to the notification. This URL would need to be accessible by the device, either a public URL, VPN or proxy, or through myopenHAB, but is a common pattern for media rich notifications. In rules this may look like:
actions.NotificationAction.sendNotificationWithMedia(email, message, media);
actions.NotificationAction.sendNotificationWithMedia(email, message, path, media);

I would welcome feedback on the naming conventions in the addon for these, i have not put much thought there.

Both of these would require work on the native devices to respond to these new payload fields. I am happy to work on the binding as well as myopenHAB, and can pitch in if needed on the IOS client.

wdyt?

@digitaldan digitaldan added the enhancement Indicates new feature requests label Feb 5, 2023
@cinemarene
Copy link

Another feature I have always missed is that it would be possible to use the Android notification categories.
Important events should be heard even when the phone is on silent. The category is then configured accordingly in the system settings.
actions.NotificationAction.sendNotificationWithMedia(email, message, path, category, media);

@maniac103
Copy link
Contributor

Another feature I have always missed is that it would be possible to use the Android notification categories.

That already is supported. The Android app (ab?)uses the 'severity' field of the notification as category.

@cinemarene
Copy link

That already is supported. The Android app (ab?)uses the 'severity' field of the notification as category.

Good to know, I didn't realise that. I have been using OpenHAB since version 2.5. How embarrassing.

@mueller-ma
Copy link
Member

I would like to propose enhancing our push notifications across both mobile platforms. While i'm sure there is a very long list of stuff we could do, i was thinking about starting of with 2 new features and see what people think.

First of all: Good to see some enhancements here 👍
I'd say that we can implement new features even if it won't be supported on both platforms.

Both new features seem useful to me. 👍

sitemap:main/00000100

These IDs will change when the Sitemap is edited. Maybe Sitemaps should be enhanced, so subpages can be tagged with user-chooses tags. These tags could be used in other places, e.g. #3140.

actions.NotificationAction.sendNotification(email, message, path);

IMO we should use a builder here. Otherwise there are too many combinations of function names and parameters.

Something like

actions.NotificationAction.sendNotification(
	actions.NotificationAction.Notification("foo@bar") // Or no mail address here to create a broadcast
		.setIsLogOnly(boolean)
		.setIcon(string)
		.setPriority(string)
		.setMedia(string)
		.setWhatEverIsAddedInTheFuture()
)

I'd add another feature as well: Notification actions (https://developer.android.com/develop/ui/views/notifications#Actions) have been requested several time, e.g. here: openhab/openhab-cloud#160

@digitaldan
Copy link
Contributor Author

These IDs will change when the Sitemap is edited. Maybe Sitemaps should be enhanced, so subpages can be tagged with user-chooses tags.

Yeah, that had crossed my mind, but i did not have a good solution for it. Tags sounds like a reasonable solution.

IMO we should use a builder here

👍

i'd add another feature as well: Notification actions

I think that sounds useful as well, and probably is not that much more work on top of rich/media notifications . This can actually be done on IOS as well i think. It would be nice to try and keep similar(ish) features if we can. The builder pattern might be useful here as well, i could see something like:
.addUserAction(itemName, label, state)
You could call this multiple times to add buttons as needed.

I am working right now to clean up the cloud notification architecture, and have it able to pass generic payloads so new features can be added without changing the cloud code. I'm also thinking about moving IOS to fcm in an effort to reduce complexity and have one way of doing things.

If we can agree on these features (and then prevent further scope creep), i think that sounds like a good place to start and get the ball rolling.

@maniac103
Copy link
Contributor

i could see something like:
.addUserAction(itemName, label, state)

What might be (equally? even more?) useful is triggering rules (basically as equivalent to trigger channels). Not sure what the best way to accomplish that would be, though.
A workaround to achieve that with your proposal would be a proxy item with expire profile, but that certainly is less user friendly.

@cinemarene
Copy link

I have one more thing that I miss. There is the possibility of withdrawing notifications. For example, you get a message about an event, and when you have done what the notification tells you to do, the message disappears without you having to take action. Of course, the system then has to know what the notification ID is that comes back from Firebase.

An example from my life: I am asked by OpenHAB to open a window because the humidity is very high. I receive the message, take note of it, go to the window and open it. The message disappears from my smartphone.

@mueller-ma
Copy link
Member

The Android app (ab?)uses the 'severity' field of the notification as category.

There is the possibility of withdrawing notifications.

One solution could be to rename "severity" to "tag" or "category" and add an action that hides all notifications of one "tag"/"category".

@digitaldan
Copy link
Contributor Author

Just FYI i am still working on cleaning up the server side ( running into a few fcm hiccups), once thats done, i'll circle back here to continue our discussion. Hopefully that will be soon,.

@florian-h05
Copy link

@digitaldan Any news?

@digitaldan
Copy link
Contributor Author

So, i ran into an issue with our legacy GCM/FCM account on Google, and paused for a while while i looked to shore up our cloud service. Thats been running nicely, so your ping is a good reminder to pick this up again. I will need to probably discuss some options with @mueller-ma and @maniac103 about our FCM account on google going forward. I'll see if i can dig into that this weekend.

@florian-h05
Copy link

openHAB 4.0 is out now, so this is hpefully something for 4.1?
@digitaldan Have you made any progress?

@tkarle
Copy link

tkarle commented Nov 2, 2023

I am also interested in this. Any news on this development?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

6 participants