I have a raspberry pi zero with the speaker pHat from Pimoroni and my plan is to have it say something when a certain event occurs in openhab. Openhab is running on a separate machine but on the same local network.
I was wondering if someone here knows if there’s some service I can install on my raspberry pi and use an audio sink to send the audio to that service which in turns plays the sound?
The other option I see is creating a custom web service on the Pi and use the http binding to trigger some sound.
In my case, an RPi with a HiFiBerry Amp2 in living room, while OpenHAB is running on another SBC in a different room. I want to be able somehow to send TTS from OpenHAB to the other device, to play on speakers in the living room.
I have found lots of ways to do this using proprietary solutions like Google, Amazon Alexa, etc. but I want to do something self hosted and on my own hardware, etc.
I read about the concept of sources and sinks in OpenHAB, however I am not sure if these concepts have been implemented over network protocols to other devices yet.
I was reading the documentation for festival package on GNU/Linux, and this apparently has some client/server option. Not sure how good the audio will be.
I will update when I come up with a workable solution. In the meantime just wanted to bump this and see if anyone else had any ideas on other solutions to investigate.
OK, so already I learned that not only festival but also MaryTTS both can function in a client-server mode. I am not sure if this is implemented in OpenHAB’s MaryTTS plug in, however. And I am not sure my sink target (RPi) has the horsepower needed to run the MaryTTS server…
I just listened to MaryTTS in their web demo, the voices sound a lot nicer than festival, which sounds to me like espeak (or maybe just the default free licenced voice that comes by default in Debian sounds like this; I see there are others also available).
The good news is that there appear to be lots of command line options, so it seems something could be strung together using (if needed) Exec binding (and/or) MQTT -> speech server on remote device.
The MQTT would only be needed if you had a number of devices and wanted to send different messages to all devices vs just some of them. I think in my use case I only need one source (OpenHAB) and one sink (living room RPi) as our place is small.
Since I am already running Kodi on the RPi in the living room, I suppose I could also do something with the Kodi OpenHAB binding and “play” commands to play pre-recorded notification sounds and/or pre-rendered text to speech files…
That might work especially in the case that RPi does not have the horsepower to run MaryTTS, perhaps that could be run on a more powerful server, and somehow the resulting files streamed over the network to play in the RPi in living room. I suspect doing all of that would result is some unacceptable latency…
Hope no one minds I’m using this thread as a place to collect my ideas and research… I usually use private text files for that purpose, but this way perhaps others will be helped who may be trying to do a similar thing (although the proprietary solutions seem much more “popular”, regrettably IMHO…).
OK, now I feel like a ninny!
All Kodi instances are registered as an audio sink in the framework. Audio streams are sent to the playnotification channel and will change the volume of the audio sink using the notificationVolume defined in the properties for the thing, not the volume .
I vaguely remember reading about that before, back before I had ordered hardware (Amp2). I think this is the avenue I will be pursuing. If I am understanding correctly, I should be able to run the MaryTTS (or other) speech engine / plug-in on the more powerful OpenHAB “server” back end (Cubietruck, ODROID-XU4 or similar) while then piping the audio files directly over the network to Kodi (via OpenHAB plug in) to be played on the speakers. I wonder how bad the network latency will be?
I will report back if/when I get that running. In the meantime, hopefully some of the terms I added will aid others in their search some day…
yes, this topic is old, but for me, the problem is new.
I want to output openhab sounds to a box that is not directly physically connected to the openhab server. I am thinking the box is powered by a hifiberry or something.
Do we have a tutorial for that or is there anybody out there that solved this issue, so I don’t have to figure this out alone?
let me revive this topic for you.
I am using mycroft AI assistant. (It’s an open source based voice assistant which can run on RPI, they have rpi image - for people who are not keen on using google/alexa and company).
I’m using it mostly to voice control openhab items such as lights, AC, TV etc…
Also this assistant has a CLI tool that is TTS.
You can see below example of .sh script that I am using with openhab exec binding. so, firing openhab switch Mycroft1 will execute this script. then, of course, various rules get triggered and they trigger those TTS items.
there is a delay of about 3 seconds, I dont know if it’s a problem for you…while he connects via ssh to mycroft machine(thats probably under a second), but then executing the TTS CLI command takes 2-3 seconds (even if you run it locally on mycroft). I dont know how fast is TTS of openhab. I didnt even try it because my openhab machine is in the communication/knx/electrical cabinet…
I dont know how come its so slow, maybe RPI3 is underpowered for this voice AI tasks…
anyway, my friends laugh how mycroft takes 4 seconds to switch on a light, while alexa does it instant…these are the “advantages” of obscure opensource solutions
sshpass -p 'yourpass' -v ssh -o "StrictHostKeyChecking no" email@example.com '/home/pi/mycroft-core/bin/mycroft-speak cannot start cooling as balcony door is opened'