Network based audio alert system

Dear Open Hab Coders

I just discovered open hab yesterday and from what I understand it may be able to meet my needs. But being that the last language I learned to code was visual basic. (things are a little different in OpenHab) I wanted to make sure I am not barking up the wrong tree.

Here is what my company needs.

  1. raspberry Pi connected to our intercom system by audio out. (I have a PI with OpenHab on it, and just about every ui installed)
  2. Shortcut on desktop computers with a switch pertaining to each PC in the business where users can flip a digital switch causing an alarm.
  3. The alarm would sound until the switch was flipped off again at the inial PC or another PC.
  4. Hopefully, the alarm could contain spoken text and a song (mp3 or wav)

Is this doable with a single Raspberry pi and html based user interaction?

Thank you so much for your help and pointing me in the right direction.


Hi Peter,

Welcome to the openHAB community!
Check out our documentation on Audio Sinks and Multimedia
It’s a concept that allows you to play any audio over a specific device.

What you’ll need is an Item:

alarm.items file:

Switch Intercom_Alarm "Sound alarm" <soundvolume>

And a simple rule that would react on this item:


rule "Play a tune when switch goes on"
    Item Intercom_Alarm changed to ON
    playSound("someTune.mp3") // this file is located in $openhab-config/sounds/

You can also setup a text-to-speech add-on like VoiceRSS or Amazon Polly and use spoken text instead:

rule "Play a tune when switch goes on"
    Item Intercom_Alarm changed to ON
    say("What's up everyone!")

The PC desktop shortcut is the tricky part.
Ideally you’d need to write some bash script that would do a POST request to the openHAB REST API with curl or something. Here you can find wget approach.


curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "OFF" ""

Here’s interactive documentation page of openHAB REST API.



Wow thank you for your Ultra fast reply

Wondering could our users simply use the openhab interface and click a button on that?

Yep. Simplest would probably be set up HabPanel with a single switch on it for that item. Then each user accesses it from a browser, if that is acceptable.

Depending on number of users, you could give them an actual physical button very easily that will trigger the alarm. Cheap wifi enabled arduino and a big red button to hit. :wink:

1 Like

Ah, right! :slight_smile: Should’ve mention HABPanel

Great I think the panel is the best way to do it. As we are fairly limited on ips any how.

Thanks again for your help will do my best to figure out this programming stuff.

Was going to do it through ui but looking like I will have to drive into the cisole a bit.

Do you have a recomendation for videos or books for understanding the basics of open hab

This will be your authoritative source for docs.

To my knowledge, there is not a published book at this time. OH is changing so much right now by the time one was published it would become out of date before it was even published. There is a new rules engine in the works and the administration UIs are gaining new features almost constantly.

I’m sure there are tons of videos but I caution you to be a little careful as many are dated. Be sure that video or tutorial you are reviewing is specifically addressing OH 2.x and not 1.x.

Beyond that, search the forum and post questions. We are happy to help.

Rick thank you so much for your reply
I have noticed that a lot of the videos and stuff I found online I’ve been varied and a little confusing
I appreciate all the help from everyone here
What I’m really trying to find is a place that explains the setup and what each of these little programing parts are and how they interact

Is there a good tutorial section in this forums to walk me through just even a basic program

I love all the help and good coding that was already sent to me in this discussion however I wouldn’t even know where to put it

I’ve tried working with the UI quite a bit however it seems to have some holes in it at least from my understanding to link things and actually get things to happen

Thank you all again for your patience and your knowledge and your help

Start with the Beginners Tutorial and the Concepts section of the User Manual at the link I provided.

Then install the demo and play around with it. The demo includes a complete though basic setup that utilizes the core parts of OH: Things, Items, Rules, Persistence, and Sitemaps. Use it as a jumping off point.

1 Like