Android Notification Category (e.g. to override the phone's DND status)

TIL: With Openhab cloud notification, I can specify icon and more importantly, the “severity” with any string, e.g. high, or superduperimportant (this is an arbitrary string, we will interpret the meaning of this string ourselves).

When received, the Android App registers a new notification category using that name (e.g. “high”, or whatever)

Then in the Android app, I can go into the App settings → Manage Notifications → Messages, and I’ll see this severity below the Default one.

I can enable/disable or customise this severity level, e.g. set as silent, assign a special ringtone, or perhaps more importantly, enable Allow notifications when Do Not Disturb is on for important messages.

RulesDSL

sendBroadcastNotification("The house fire alarm was triggered!", "fire", "high")

JRuby with notify method

notify("The house fire alarm was triggered!", icon: "fire", severity: "high")

JS Scripting

actions.NotificationAction.sendBroadcastNotification('The house fire alarm was triggered!', 'fire', 'high');
1 Like

Pro tip: don’t misspell your severity name…

@mueller-ma is there a way to remove the custom categories created by the app?

Clearing the application data would remove the extra categories, but it also removes all settings including server name, passwords, etc.

2 Likes

It’s on its way: Add option to remove all custom notification channels by mueller-ma · Pull Request #3549 · openhab/openhab-android · GitHub

2 Likes

hi, is it possible to send such notifications without cloud?
greets.

You can host the openhab-cloud component locally and use the app from F-Droid which uses polling to fetch notifications.

Does/can the app constantly “monitor” or would it know instantly when an item’s state changed (even when connected via local url)?

If so, perhaps we can use a string item to send a notification to the app?

While the app is in foreground, yes: Support UI control via Item by mueller-ma · Pull Request #3579 · openhab/openhab-android · GitHub

Otherwise that would be too battery consuming.