How to send push notification from iten via myopenhab to mobile phone

I want to exercise push notification from openhab to mobile phone.
Here is what I did so far:

  • created a BasicUI with a virtual switch
  • installed mqtt binding
  • installed mqtt broker (mosquitto) that runs externally to openhab
  • added some rules to send an mqtt message, when the switch changes states between off/on.
  • installed an mqtt client program (MQTT-Explorer) on my PC
    MQTT-Explorer is external to openhub.
    – It subscribes to the topic that openhab sends (e.g. testswitch001 ON, testswitch001 OFF)
    – verified that MQTT-Explorer receives the message when I change the switch state between on/off
  • connected to myopenhab.org in the cloud from a mobile phone:
    – in openhab - installed openhab cloud connector
    – downloaded the openhab app from Google Play
    – connected from a mobile phone to myopenhab.org, via the openhab app
    – verified that when e.g. changing the switch between on/off, in BasicUI from the PC, the state changes in the mobile phone as well.

These activities are summarized in here and here.

Now I want to enable notifications such that when changing the switch between on/off, in BasicUI from the PC, I get a notification in the phone.
Here is what I did:

  • In the openhab app in the mobile phone, enabled notifications (Settings → Notification)
    I see the status Notification registration completed successfully.
    I also turned all notification related settings to On: e.g. Show Notifications, Pop on Screen, Override Do Not Disturb)
  • From myopenhub.org I verified that I can send a message to my mobile phone device (in Device → Send Message), and a notification shows up in my phone as expected.

But when I change the state of the switch I don’t see a notification.
I guess that this is because I need to add some sendNotification command ?

My rule for “change switch on” is:

triggers:
  - id: "1"
    configuration:
      itemName: TestSwitch001
      command: ON
    type: core.ItemCommandTrigger
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/javascript
      script: actions.get("mqtt","mqtt:broker:3186791669").publishMQTT("testswitch001","ON")
    type: script.ScriptAction

What command should I add to the rule to send a notification for this event?

Thanks,
Avner

Ok, updated the rule and added a DSL script to send a notification:

sendNotification("my.email@gmail.com", "testswitch001 ON")

After doing this, when I change the switch between off/on triggers notification that pops-up in my mobile phone.

The rule to trigger mqtt message and notification