Web Audio to specific client?

I am using openhab for a few different projects, used by different people. Part of the latest project is that audio is played when a particular switch goes ON

I have this working through a rule, it works very well through chrome but I have just found out that the audio clip is playing for anyone in paperui or in another habpanel. Which is becoming annoying for them

Is there a way for openhab to only play audio on a particular panel or (even better) a particular client?

I don’t think this is possible but maybe someone who uses audio sinks will chime in.

But I question that if these are separate projects for different people why you are not running separate openHAB instances? As OH is right now, every user has access to every other user’s stuff.

Thanks, that’s what I thought

I have no idea on where to start with running openhab in separate instances. I think it’s going to come to that though.

There are lots of options, and if you are planning on maintaining these multiple systems you should learn about them all. Some ideas off the top of my head:

  • multiple RPis
  • multiple virtual machines running on one or more “beefy” computers
  • using containers like Docker with each instance on its own port.

I read in another topic here, that it is possible to play webaudio on a specific device/browser. Have to look, where that was!?!?

There it is:

I think there’s a slight confusion there.

The WebAudio sink will only send audio to any and all Web Browsers that have the PaperUI or HabPanel loaded. (I haven’t tried with BasicUI or Classic etc)

The topic you linked to moves on to talk about using Google Chromecast Audio dongles and seperate speakers in each zone.

Much as a Sonos / Heos / Yamaha audio sink might operate.

It would be amazing if there were a way to identify specific browser sessions and only send audio to that instance.

The big question is…

Do you want to play a music / audio file or would a TextToSpeech be suitable?

It is possible to push a TTS to specific instances of HabPanel. :smile:

Just setup a String item for each instance (or group of) HabPanels.

Then go to each instance of HabPanel and look for the Panel settings.

For example

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

In there you’ll find an option box named “Speak the new value of following item when it changes”

Just set this to the String item you’ve assigned.

Then all you need to do is set the content of the String file in a rule / selection widget / buttons and so on.

As a laugh, I did use a https connection from my phone to OH and used a String item to capture SpeechToText from Google Android Chrome, then push that string.state into the Say commands in a rule, so that a unique announcement was sent to all audio sinks.

The idea was that we could TalkBack to the house, if we were alerted to something happening within the house.

I got it working well, and have not used it since.
(Other than surprising visitors)

2 Likes