Difficulty Level: Easy to Medium -/- (Duration: ~2 hours) -/- version 2018111901
This is a very basic Tutorial on how to configure your openHAB2 System to enable Voice control and Text-To-Speech (TTS).
At the end of this Tutorial, you will be able to:
- Use Voice Commands on your Phone (using Google Assistant) to control openHAB2
- Use your Web Browser to listen to Audio Notifications from openHAB2
Table of Contents
-
Installation Guide
2.1 openHAB Cloud service
2.2 Google Text-To-Speech Add-On
2.3 Google Home Mobile App
2.4 HABPanel -
Advanced Setup (Audio from rules, etc)
3.1 Google Home Timed Devices setup
1. Introduction
This guide is based on and was last tested with the following components:
- openHAB 2 running on a Laptop with Linux (Debian Jessie) with:
- Android Mobile Phone (Galaxy 8 with Android 8) with Google Home App v2.7.21.2
Important Note: The Google TTS Add-on can also work on Raspberry Pis starting with openHAB 2.4.0 Snapshot Build # 1446.
1.1 How does it work?
How does it work?
Your openHAB2 system will create 2 connections:
- To myopenHAB.org Cloud Service to allow remote (voice) control using Google Assistant
- To Google’s Cloud to send text and receive audio
2. Installation Guide
2.1 openHAB Cloud service
Full instructions on how to to connect your OH2 instance to myopenhab.org are available on https://www.openhab.org/addons/integrations/openhabcloud/
2.1.1 Install the Add-on from PaperUI -> Misc -> openHAB Cloud Connector
2.1.2 Create an account on myopenhab.org using your UUID & Secret
2.1.3 Create a demo Item and expose it to the myopenhab Cloud
cloud_demo.items
Switch Voice_Robot "Voice Testing" ["Switchable"]
2.1.4 Place it on your sitemap, toggle it ON/OFF to get a first state and the check https://myopenhab.org/items. It should appear with a Status
and a Last Update
2.1.5 Setup Step 1 is done! You have now successfully linked your local openHAB2 installation to the Cloud and can expose Items to external services.
2.2 Google Text-To-Speech Add-On
Full instructions on how to to connect your OH2 instance to Google TTS are available on https://www.openhab.org/addons/voice/googletts/
2.2.1 Install the Add-on from PaperUI -> Add-ons -> Voice -> Google Cloud Text-to-Speech
2.2.2 Perform the steps described on Obtaining Credentials and get your service account key in JSON format
2.2.3 Configure Google TTS Add-on under PaperUI -> Configuration -> Services -> Voice as follows:
2.2.4 Configure the Voice settings under PaperUI -> Configuration -> System -> Voice as follows:
2.2.5 Configure the Default Sink
to be Web Audio
under PaperUI -> Configuration -> System -> Audio
2.2.6 Setup Step 2 is done! Now you have linked your OH2 to Google and can use TTS. Test it using the following rule (toggle the test Switch from OFF to ON) and having PaperUI open on your browser.
voice_demo.rules
rule "Voice Testing Rule"
when
Item Voice_Robot changed from OFF to ON
then
say("Hello from openHAB!")
end
2.3 Google Home Mobile App
Full instructions on how to to connect your OH2 instance to Google Assistant are available on https://www.openhab.org/docs/ecosystem/google-assistant/
2.3.1 Install Google Home
mobile app from Play Store
2.3.2 Add a “Works with Google” device -> search for openHAB
-> login to myopenhab.org and allow OAuth2
i)
ii) iii)iv) v) vi)
2.3.3 Add smart home devices -> Select the Voice Testing
device and control it from Google Assistant !
2.3.4 Toggle the Voice Testing
Switch from OFF to ON using Google Assistant and hear the Hello from openHAB
message on your web browser (the rule will trigger)
2.4 HABPanel
<add content about HABPanel>
: Custom widgets, Web Audio, etc
3. Advanced Setup (Audio from rules, etc)
3.1 Google Home Timed Devices setup
<add content with complex rules examples>
4. FAQs
1. Why some of my Items do not appear on the myopenHAB.org Cloud platform? |
Make sure that: ii) The Items do not have the autoupdate option set to "false" (not "Veto an auto update" on Item settings) |
2. Why do I get "Couldn't update the setting. Check your connection" every time I try to add the openHAB Smart Home Service in the setup of the Google Home App? |
Make sure that: |
3. Do I need to own a Google Home Device for getting Google Home App to work? |
No. You can simply use the mobile Google Home App linked to openHAB via myopenHAB.org |
4, Which are the currently supported Tags with the Google Home Integration? |
["Lighting"] |
5. All my stuff are defined by using PaperUI.. how do I add Tags to my Items? |
Use the REST API to add/remove Tags from Managed Items. See here how: Add Tags Make sure that you have the "REST Documentation" Add-on installed (PaperUI->Add-ons->MISC) |
6. I added recently a new Item with the proper tag but it doesn't show up in Google Home App |
Use Google Home App and say/type: "Sync my devices" |
7. Where can I find more examples of Items with tags? |
Check the general Items Documentation & specific GA Items Configuration |
8. How can I identify my UUID & Secret for registration to myopenhab.org? |
Check the openHAB Cloud Documentation |
9. How can I change the TTS Voice and Audio Sink within my rules? |
Use: say("text","voice","device") Example: say("Hello","googletts:enGBWavenetA","webaudio") |
10. How can I see all available Google TTS voices? |
Use the openHAB
console and type: voice voices |
11. How can I get this to work with Alexa? |
You cannot. This tutorial is for Google Assistant, not Alexa. |
12. How can I enable DEBUG logs for this stuff? |
Use the openHAB console and type: log:set DEBUG org.openhab.io.openhabcloud log:set DEBUG org.openhab.voice.googletts |
More updates soon with much more info !
Please do not use this thread for troubleshooting purposes!
If you are having trouble setting up any of the above, please refer to the respective sections in the forum and search for existing solutions. If you cannot find one that solves your specific problem, create a new thread linking to this tutorial and adding as much info as possible about your setup!
Topic | Community Section |
General Help | https://community.openhab.org/c/setup-configuration-and-use/beginners |
myopenhab Cloud Service | https://community.openhab.org/c/apps-services/my-openhab |
Google Text-To-Speech Add-On | https://community.openhab.org/c/add-ons/text-to-speech |
HABPanel App | https://community.openhab.org/c/apps-services/habpanel |