Play Sound on wall mounted tablet by change Switch to ON

OH2 is running on RPi3 and I want to play a sound when a switch changes from Off to On. I want to play it on the wall mounted tablet. How is this possible? Do I need the APP (it´s an Android Tablet) or should use the browser?

If you can get the tablet to register as an audio sink then yes you can get sounds to play on it from OH. Take a look at the Kodi/Sonos binding documentation, it should hopefully give you an idea or two. Not syaing it will give you the answer directly, but will explain how they work.

One idea would be to run Kodi on the tablet in the background, but that would add load to the CPU. But may suit your needs.

You shouldn’t need the OH app or browser running to make it work.

Thank you. I will have a look. I want to stream (always on) my camera and use a switch for the doorbell. At the moment I send myself a telegramm message but having a sound would be much better for my wife.

If understand correctly you want the sound to be played by the wallmounted tablet. correct?
If you by any chance are using HABPanel on that tablet use the build in feature of that UI. The downside is that it is playing a spoken string.
Select a Voice and select the item for which you want the tablet to announce the changed state is all you need to do!

1 Like

Neither of this is builtin so it will not work, and all attempts to work around (such as the audio sink) are awkward at best and not worth the effort.
Best advice you can be given is to just forget about it.

Just tested the HABPanel as posted above. It (sort of ) worked even when connected via myopenhab.org. The problem is that it only did send the state (fourthy point one) for an item showing a temperature.

I use Fully Kiosk Browser on my soon-wall-mounted tablet. The App has a REST API with a TTS-function (PLUS version for 5,90 Euro). So you can send a text string (via http) and it is then spoken on the tablet. Perhaps thats something for you.

My solution is just simple. I created an own telegram account for the tablet (Bot2) and when the doorbell - button is pushed, I send a message to the telegram Bot2 only.

HabPanel has this functionality :slight_smile:

Just look at the settings page

http://192.168.***.***:8080/habpanel/index.html#/settings

Just a matter of linking a String item to the instance of HabPanel

I suspect the same is possible with the fabulous Android app
HabPanelViewer on Google Play

@MDAR That is fine in normal browser but the list of voices is empty on my Android tablet when opening that page from Fully Kiosk Browser Same thing on two different tablets. Anyone else has this issue? @webboy81 ?

That’s a little odd.

Do you have any kind of TTS service installed on your tablet?

Yes that one is installed.

If I open the HabPanel from Chrome I see the list of voices, but from Fully drop-downlist is empty. I will contact the author

I see the same thing. Opening HABPanel from myopenhab shows the voices, opening via the android app the selection is empty (both from outside of my LAN).

I got answer from the author:

The Web Speech API and Speech Recognition API are not supported by the Android Webview, use Fully’s JavaScript interface instead for TTS.

You can use one of these JS functions:

void fully.textToSpeech(String text)
void fully.textToSpeech(String text, String locale)
void fully.textToSpeech(String text, String locale, String engine)

You can also use REST API commands:

// Text to speech
/?cmd=textToSpeech&text=[text]&password=[pass]
/?cmd=textToSpeech&text=[text]&locale=[locale]&password=[pass]
/?cmd=textToSpeech&text=[text]&locale=[locale]&engine=[engine]&password=[pass]

Anyone aware of text to speech hack, so I can like play notification sound first? It is good to have some short sound to catch the attention from the people in the room before it start “talking”.

1 Like

I don’t think you need such! IMHO you need a camera taking a video while such a notification is played (if they don’t know, it scares the sh* out of them🤣).

I use HabPanelViewer and if my system audio is set to webaudio, the tablet can play a sound

Well if English is not your native it is good to have something like “Beep!.. Water leakage detected”.

I would like to take pictures when the tablet is turned on (screensaver off) Seems like it is possible to implement this in Fully