iOS Notifications with openHAB Cloud Connector

A bit confused with sending the enhanced notifications via the cloud connector.

I am using OH4.3M2. iOS device is iPhone 13 on iOS 18.0.1. App version is 3.0.5(11). Using text-based JS rules.

Here is my command which does get sent to the phone:

actions.NotificationAction.sendNotification("me@me.com", 
  	"ALERT: This is a test.", "motion", "HVAC", 
	"Im Really Hot!!!", "msg-alert-its_hot", "ui:/basicui/app?w=0000&sitemap=Crib", null, 
	"OpenHAB=ui:/basicui/app?sitemap=Crib", "CoolTheHouse=rule:NotificationTest:prop1=OFF", "Cool The House=command:Test_Switch_1:ON");

A few things I am struggling with:

  1. I cannot seem to execute a rule using the action buttons (triggering items works fine).
    In the above, the second action button "CoolTheHouse=rule:NotificationTest:prop1=OFF" doesn’t do anything. I can confirm this because my logging statement never appears. In trying to troubleshoot this, I even used NotificationTest for the name, description and id of the rule just in case I was getting mixed up. I also tried with and without the prop1. The rule is a text-based rule, however I also tried with a UI created rule as well. Have I mucked up the syntax for this?

  2. Navigating to a specific sitemap page eg ui:/basicui/app?w=0000&sitemap=Crib" only really works if the iOS app has been previously opened and I have previously navigated to the sitemap (in Basic Ui). If the iOS app hasn’t already been accessed, then I just get the Overview page of Main UI. It doesn’t reliably open the Basic UI as requested. I think I read something about this in the docs, but is this right?

  3. Not so important - the icon argument never displays an icon. Is that right for iOS? I changed it to a few different options, eg motion and switch but it has never displayed anything obvious. I’m not worried about it, but it’s just confusing why I couldn’t get it to work.

  1. Should work, Adds opening 3rd party apps and triggering rules by digitaldan · Pull Request #793 · openhab/openhab-ios · GitHub has been merged before 3.0.5(11) was released. I haven‘t tested that myself, I will probably do if I don‘t forget about it. You should consider creating a issue on GitHub - openhab/openhab-ios: The repository of the iOS client and report that.
  2. That should definitely get reported as an issue.
  3. Yes, this is correct for iOS. Only Android does display that icon.

BTW, I would recommend you to use the notification builder instead of the raw notification actions so you don‘t have to remember the signature with those thousand method arguments: JavaScript Scripting - Automation | openHAB

Thanks for this. I have created 2 issues:

Unable to trigger rule from enhanced notification · Issue #841 · openhab/openhab-ios (github.com)

Navigating to Basic UI sitemap page from enhanced notification does not work consistently · Issue #842 · openhab/openhab-ios (github.com)

Thanks also for the hint about the notification builder, I will check it out.

1 Like

Does Hide option in NotificationBuilder works for IOS?
I run a test and sent a notification using a special ReferenceID. However I failed to hide this message later again.
Did I misunderstand the feature, or isn’t it working for IOS?

I can verify it is not working for me as well.

Reproduce code
var id = actions.notificationBuilder('Test').send();

setTimeout(() => {
  actions.notificationBuilder().withReferenceId(id).hide().send();
}, 15000)

@digitaldan FYI

Ah apologies, i missed this as well as those github issue in my email noise. I’m working on the IOS client this week and will take a look.

2 Likes

Would the issues described above, namely being unable to navigate to a sitemap menu and triggering a command be fixable for OH4 or would that be a OH 5 thing? (or maybe not fixable at all?)

Hello Dan,

many thanks - hide() is working now on IOS devices as well :slight_smile:

Maybe you can give me a hint for .withIcon() parameter.
Is the syntax wrong I’m using? my iPhone doesn’t display the Icon defined in withIcon() parameter.

refID = actions.notificationBuilder("Fenster Test").withTitle("Fenster Status").withReferenceId("w1_12").withIcon("temperature").send();

Unfortunately the icon option is not supported on IOS, just android, i’m not sure if it worked at one point way, way long ago in the past, but Apple does not allow icons on messages.

Thanks for the confirmation - at least nothing wrong with my code :slight_smile: