Phone ring action

I have used OpenHAB Cloud Connector add-on to be able to register and send notifications to my device. However, I am trying to play a sound on that registered phone when notification is received (“doorbell.mp3”). I looked everywhere I could and wasn’t able to find anything.

Also when that notification is received, I want to be able to click it and it opens a custom widget that has a clickable image (for camera).

Alternatively, I would like if it was a call (ring tone) displaying that custom widget when it happens.

I basically used this rule below, but the sound is played on the web browser and I would like if that same doorbell.mp3 sound plays on the phone notification, or be able to do a call to the related widget.

Rule:

configuration: {}
triggers: []
conditions: []
actions:
  - inputs: {}
    id: "2"
    configuration:
      type: application/vnd.openhab.dsl.rule
      script: >-
        sendNotification("email@email.com", "Someone Rang your door")
          var v = "doorbell.mp3"
        Audio.playSound(v)
    type: script.ScriptAction

Usually the sound played by a notification is controlled by the end device. On Android you can change the sound played on a per app basis and even on a per type of notification per app (e.g. you can have a different sound for default and alert notifications for the OH app,.

There is no ability to send a sound to play as part of the notification.

However you can send audio streams to audio sinks. First you need to have one of the UIs up and running on the device. I only know MainUI for this but the docs indicated BasicUI and HABPanel work too. You need to register the app as a web audio sink under Help and About → Miscellaneous.

Then you can use one of the playsound Actions from a rule to play a streamed file or a URL.

1 Like

To do a similar thing to what your wanting, I use a google Nest home hub, but the cheaper Nest Home Mini works as well. You can play to one or a group of multiples around the home, you use the chromecast binding and the PLay URI channel which can only be seen if you tick the ‘show advanced’ button in openHAB.

Kitchen_Speaker_Volume.sendCommand(75)			
Kitchen_Speaker_Play_URI.sendCommand("http://192.168.8.8:8080/static/doorbell.mp3") 

openHAB 4.2 will support enhanced notifications that will allow you to show up to 3 buttons, which when clicked can take you to a sitemap/UI page, or to a URL, or send a command to an item.

Regarding sound, it is as explained by @rlkoshak:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.