Difference between revisions of "Sonos Integration"

From Hubitat Documentation
Jump to: navigation, search
(Created Sonos Integration doc)
 
(correct typos and revise image)
Line 1: Line 1:
 
Connecting your Hubitat Elevation<sup>®</sup> to your Sonos device is an easy way to add audio and text to speech voice notifications to your home automations. Using the Hubitat Sonos Integration, you can control the volume and playback functions of your Sonos speakers, plus send voice notifications using the built-in Text to Speech (TTS) capabilities of your Hubitat Elevation<sup>®</sup> hub.
 
Connecting your Hubitat Elevation<sup>®</sup> to your Sonos device is an easy way to add audio and text to speech voice notifications to your home automations. Using the Hubitat Sonos Integration, you can control the volume and playback functions of your Sonos speakers, plus send voice notifications using the built-in Text to Speech (TTS) capabilities of your Hubitat Elevation<sup>®</sup> hub.
  
=== Installing the Hubitat Sonos Integration ===
+
===Installing the Hubitat Sonos Integration===
  
# From the Hubitat Web Interface select '''Apps'''.[[File:Install Built-In App 2.0.png|none|thumb|600x600px]]
+
#From the Hubitat Web Interface select '''Apps'''.[[File:Install Built-In App 2.0.png|none|thumb|600x600px]]
# Choose Sonos Integration from the list of Built-In Apps.[[File:Install Sonos Integration.png|none|thumb|600x600px]]
+
#Choose Sonos Integration from the list of Built-In Apps.[[File:Install Sonos Integration.png|none|thumb|600x600px]]
# Wait for your Hubitat Elevation<sup>®</sup> hub to search for Sonos devices. This can take 5 minutes or more, but typically Sonos devices are found with 30 seconds of installing the Sonos Integration app.[[File:Sonos Integration - Search begins.png|none|thumb|600x600px]]
+
#Wait for your Hubitat Elevation<sup>®</sup> hub to search for Sonos devices. This can take 5 minutes or more, but typically Sonos devices are found with 30 seconds from installation the Sonos Integration app.[[File:Sonos Integration - Search begins.png|none|thumb|600x600px]]
# Once your Sonos device is found, press the '''Next''' button.[[File:Sonos Integration Discovery.png|none|thumb|600x600px]]
+
#Once your Sonos device is found, press the '''Next''' button.[[File:Sonos Integration Discovery.png|none|thumb|600x600px]]
# Make your selection by checking the box next to the name of the found device you want to use. To add additional devices not discovered during the Sonos Integration installation, press the '''Continue Search''' button.[[File:Sonos Integration set found.png|none|thumb|600x600px]]
+
#Make your selection by checking the box next to the name of the found device you want to use. To add additional devices not discovered during the Sonos Integration installation, press the '''Continue Search''' button.[[File:Sonos Integration set found.png|none|thumb|600x600px]]
# Press the '''Done''' button to finish.[[File:Sonos Integration complete.png|none|thumb|600x600px]]
+
#Press the '''Done''' button to finish.[[File:Sonos Integration complete.png|none|thumb|600x600px]]
  
=== Test your Sonos Integration ===
+
===Test your Sonos Integration===
  
# From the list of devices, find the name of your Sonos device you are testing. From the example above, it will be named '''Dining Room Sonos'''.
+
#In the list of [[Devices]], find the name of your Sonos device you are testing. In the example above, it is named '''Dining Room Sonos'''.
# Scroll down and find the '''Speak''' command.  
+
#Scroll down and find the '''Speak''' command.  
#* '''NOTE''': There will be some duplicate commands shown, since the same command is part of two separate capabilities of the integration. You will notice for example, one of the '''Speak''' commands also has a field for ''Volume level'', while the other only has a single field for testing the TTS message you want to hear from the Sonos device.
+
#*'''NOTE''': There will be some duplicate commands shown, since the same command is part of two separate capabilities of the integration. You will notice for example, one of the '''Speak''' commands also has a field for ''Volume level'', while the other only has a single field for testing the TTS message you want to hear from the Sonos device.
# Type your test word or phrase into the ''Text'' box below the '''Speak''' command and press the '''Speak''' button. You should hear your word or phrase from your Sonos device.[[File:Test Sonos Integration driver.png|none|thumb|600x600px]]
+
#Type your test word or phrase into the ''Text'' box below the '''Speak''' command and press the '''Speak''' button. You should hear your word or phrase from your Sonos device.[[File:Test Sonos Integration driver.png|none|thumb|600x600px]]
  
=== Using the Hubitat Notifications app for Text to Speech (TTS) messages ===
+
===Using the Hubitat Notifications app for Text to Speech (TTS) messages===
The Notifications app can be used to send TTS messages to your Sonos device. This is the simples way to play TTS announcements on your Sonos. For detail on how to used the Notifications app, please see the [[Notifications]] document.
+
The Notifications app can be used to send TTS messages to your Sonos device. This is the simplest way to play TTS announcements on your Sonos. For detail on how to use the Notifications app, please see the [[Notifications]] document.
  
=== Controlling your Sonos Integration with Rule Machine<sup>®</sup> ===
+
===Controlling your Sonos Integration with Rule Machine<sup>®</sup>===
There are several ways to control your Sonos device with Rule Machine<sup>®</sup> and send Text to Speech (TTS) messages. While it's possible to simply use the Notifications app to play TTS messages on your Sonos device, it is helpful to understand how to build Rule Machine<sup>®</sup> rules, since you can combine multiple actions, control multiple devices, and trigger all actions within a single rule by way of one or multiple triggers. This is substantially more powerful than a single TTS Notification and will help you Elevate your home automation to levels. For our basic example however, the Sonos device will simply emit the TTS message at volume 50, anytime the front door contact sensor is opened.   
+
There are several ways to control your Sonos device with Rule Machine<sup>®</sup> and send Text to Speech (TTS) messages. While it's possible to simply use the Notifications app to play TTS messages on your Sonos device, it is helpful to understand how to build Rule Machine<sup>®</sup> rules, since you can combine multiple actions, control multiple devices, and trigger all actions within a single rule by way of one or multiple triggers. This is substantially more powerful than a single TTS Notification and will help you Elevate your home automation to new levels. For our basic example below however, the Sonos device will simply play the TTS message at volume 50, anytime the front door contact sensor is opened.   
  
# If you have not already done so, install '''Rule-4.0''' with the same method used to install the Sonos Integration at the beginning of this document.
+
#If you have not already done so, install '''Rule-4.0''' with the same method used to install the Sonos Integration at the beginning of this document.
# From the Apps page of the Hubitat Web Interface, select '''Rule Machine'''
+
#From the Apps page of the Hubitat Web Interface, select '''Rule Machine'''
# Give your rule a name. For this simple example, we will announce via TTS "Front Door" anytime the front door contact sensor is open, so it makes sense to name our example rule "Announce Front Door".[[File:RM4 TTS speech example.png|none|thumb|600x600px]]
+
#Give your rule a name. For this simple example, we will announce the via TTS, the message "Front Door" anytime the front door contact sensor is open, so it therefore makes sense to name our example rule "Announce Front Door".[[File:RM4 TTS speech example.png|none|thumb|600x600px]]
# For our example rule, we need to specify something to trigger the actions of the rule. We want the rule actions run when the front door is opened, so the trigger device we will select will be our Front Door contact sensor.[[File:RM4 select trigger - TTS example.png|none|thumb|600x600px]][[File:RM4 TTS example - contact as trigger.png|none|thumb|600x600px]][[File:RM4 TTS example Front Door contact.png|none|thumb|600x600px]]
+
#For our example rule, we need to specify something to trigger the actions of the rule. We want the rule actions run when the front door is opened, so the trigger device we will select will be our Front Door contact sensor.[[File:RM4 select trigger - TTS example.png|none|thumb|600x600px]][[File:RM4 TTS example - contact as trigger.png|none|thumb|600x600px]][[File:RM4 TTS example Front Door contact.png|none|thumb|600x600px]]
# You can of course have multiple triggers in Rule Machine<sup>®</sup>, but for our simple example we only want to use a single trigger. Therefor you should press the button '''Done with Trigger Events'''.[[File:RM4 TTS example Finish trigger event.png|none|thumb|600x600px]]
+
#You can of course have multiple triggers in Rule Machine<sup>®</sup>, but for our simple example we only want to use a single trigger. Press the button '''Done with Trigger Events'''.[[File:RM4 TTS example Finish trigger event.png|none|thumb|600x600px]]
# We will not specify the Action for our example rule to Speak a message on our Sonos device. Press the '''Select Actions to Run''' button.[[File:RM 4 TTS example Select Action.png|none|thumb|600x600px]]
+
#We will now specify the '''Action''' for our example rule to Speak a message on our Sonos device. Press the '''Select Actions to Run''' button.[[File:RM 4 TTS example Select Action.png|none|thumb|600x600px]]
# From the drop-down menu, choose the Action '''Send, Speak or Log a Message, Send HTTP Request''' and then choose '''Send or Speak a Message'''.[[File:RM 4 TTS example choose action category.png|none|thumb|600x600px]][[File:RM 4 TTS example choose action.png|none|thumb|600x600px]]
+
#From the drop-down menu, choose the Action '''Send, Speak or Log a Message, Send HTTP Request''' and then choose '''Send or Speak a Message'''.[[File:RM 4 TTS example choose action category.png|none|thumb|600x600px]][[File:RM 4 TTS example choose action.png|none|thumb|600x600px]]
# For our example rule, we want our announcement to be "Front Door", so type this into the '''Message to Send''' field, then scroll down and activate the option '''Speak this message'''. For a Sonos device, there are two places where you can select the device to use. If you choose '''On this speech device''', the TTS message will be spoken at the current volume level of the speaker. For our example, we will choose '''On this music device''', since it will allow us to also specify the volume at the same time.
+
#For our example rule, we want our announcement to be "Front Door", so type this into the '''Message to Send''' field, then scroll down and activate the option '''Speak this message'''. For a Sonos device, there are two places where you can select the device to use. If you choose '''On this speech device''', the TTS message will be spoken at the current volume level of the speaker. For our example, we will choose '''On this music device''', since it will allow us to also specify the volume at the same time.
#* [[File:RM 4 TTS Example setup speech.png|none|thumb|1102x1102px]]
+
#*[[File:RM 4 TTS Example setup speech.png|none|thumb|1102x1102px]]
# Press '''Done with this action''', and since we will only be adding a single action for our trigger (the Front Door contact sensor), you should now select '''Done with Actions'''.[[File:RM4 TTS example finalize action.png|none|thumb|640x640px]]
+
#Press '''Done with this action''', and since we will only be adding a single action from our trigger device (the Front Door contact sensor), you should now select '''Done with Actions'''.[[File:RM4 TTS example finalize action.png|none|thumb|640x640px]]
# Press '''Done''' to finish and test your rule by activating the trigger device.[[File:RM4 TTS example finish rule.png|none|thumb|835x835px]]
+
#Press '''Done''' to finish and test your rule by activating the trigger device.[[File:RM4 TTS example finish rule.png|none|thumb|835x835px]]
# Using these methods, you can also choose Rule Machine<sup>®</sup> Actions called Custom Commands, which will allow you to specify actions such as '''Pause''', '''nextTrack''', '''previousTrack''', '''Mute''', etc. These can be independent actions, or they can follow, or proceed the TTS action.[[File:RM4 Sonos example of custom commands.png|none|thumb|996x996px]]
+
#As you become more familiar with building rules, you can explore using Rule Machine<sup>®</sup> Actions called Custom Commands. These allow you to specify actions such as '''Pause''', '''nextTrack''', '''previousTrack''', '''Mute''', etc. These may be independent actions, or they can follow, or proceed the TTS action.[[File:RM4 Sonos example of custom commands 2.png|none|thumb|960x960px]]
  
As you can see from the above examples, the power of Rule Machine<sup>®</sup> can be leveraged to specify criteria that must be met before a rule action is run. In the example rule, the TTS message will be at a specified volume level. Once you are more familiar with building Rule Machine<sup>®</sup> rules and '''[https://docs.hubitat.com/index.php?title=Rule-4.0#Rule-4.0_Conditional_Actions_and_Logical_Expressions Conditional Actions]''' , TTS announcements at different volumes, occurring at different times of the day, only in specified modes, etc., becomes very simple to achieve.
+
As you can see from the above examples, the power of Rule Machine<sup>®</sup> can be leveraged to specify criteria that must be met before a rule action is run. In the example rule, the TTS message will be at a specified volume level. Once you are more familiar with building Rule Machine<sup>®</sup> rules and '''[https://docs.hubitat.com/index.php?title=Rule-4.0#Rule-4.0_Conditional_Actions_and_Logical_Expressions Conditional Actions]''' , TTS announcements at different volumes, occurring at different times of the day, only in specified [[Modes]], etc., becomes very simple to achieve.

Revision as of 22:41, 24 September 2020

Connecting your Hubitat Elevation® to your Sonos device is an easy way to add audio and text to speech voice notifications to your home automations. Using the Hubitat Sonos Integration, you can control the volume and playback functions of your Sonos speakers, plus send voice notifications using the built-in Text to Speech (TTS) capabilities of your Hubitat Elevation® hub.

Installing the Hubitat Sonos Integration

  1. From the Hubitat Web Interface select Apps.
    Install Built-In App 2.0.png
  2. Choose Sonos Integration from the list of Built-In Apps.
    Install Sonos Integration.png
  3. Wait for your Hubitat Elevation® hub to search for Sonos devices. This can take 5 minutes or more, but typically Sonos devices are found with 30 seconds from installation the Sonos Integration app.
    Sonos Integration - Search begins.png
  4. Once your Sonos device is found, press the Next button.
    Sonos Integration Discovery.png
  5. Make your selection by checking the box next to the name of the found device you want to use. To add additional devices not discovered during the Sonos Integration installation, press the Continue Search button.
    Sonos Integration set found.png
  6. Press the Done button to finish.
    Sonos Integration complete.png

Test your Sonos Integration

  1. In the list of Devices, find the name of your Sonos device you are testing. In the example above, it is named Dining Room Sonos.
  2. Scroll down and find the Speak command.
    • NOTE: There will be some duplicate commands shown, since the same command is part of two separate capabilities of the integration. You will notice for example, one of the Speak commands also has a field for Volume level, while the other only has a single field for testing the TTS message you want to hear from the Sonos device.
  3. Type your test word or phrase into the Text box below the Speak command and press the Speak button. You should hear your word or phrase from your Sonos device.
    Test Sonos Integration driver.png

Using the Hubitat Notifications app for Text to Speech (TTS) messages

The Notifications app can be used to send TTS messages to your Sonos device. This is the simplest way to play TTS announcements on your Sonos. For detail on how to use the Notifications app, please see the Notifications document.

Controlling your Sonos Integration with Rule Machine®

There are several ways to control your Sonos device with Rule Machine® and send Text to Speech (TTS) messages. While it's possible to simply use the Notifications app to play TTS messages on your Sonos device, it is helpful to understand how to build Rule Machine® rules, since you can combine multiple actions, control multiple devices, and trigger all actions within a single rule by way of one or multiple triggers. This is substantially more powerful than a single TTS Notification and will help you Elevate your home automation to new levels. For our basic example below however, the Sonos device will simply play the TTS message at volume 50, anytime the front door contact sensor is opened.

  1. If you have not already done so, install Rule-4.0 with the same method used to install the Sonos Integration at the beginning of this document.
  2. From the Apps page of the Hubitat Web Interface, select Rule Machine
  3. Give your rule a name. For this simple example, we will announce the via TTS, the message "Front Door" anytime the front door contact sensor is open, so it therefore makes sense to name our example rule "Announce Front Door".
    RM4 TTS speech example.png
  4. For our example rule, we need to specify something to trigger the actions of the rule. We want the rule actions run when the front door is opened, so the trigger device we will select will be our Front Door contact sensor.
    RM4 select trigger - TTS example.png
    RM4 TTS example - contact as trigger.png
    RM4 TTS example Front Door contact.png
  5. You can of course have multiple triggers in Rule Machine®, but for our simple example we only want to use a single trigger. Press the button Done with Trigger Events.
    RM4 TTS example Finish trigger event.png
  6. We will now specify the Action for our example rule to Speak a message on our Sonos device. Press the Select Actions to Run button.
    RM 4 TTS example Select Action.png
  7. From the drop-down menu, choose the Action Send, Speak or Log a Message, Send HTTP Request and then choose Send or Speak a Message.
    RM 4 TTS example choose action category.png
    RM 4 TTS example choose action.png
  8. For our example rule, we want our announcement to be "Front Door", so type this into the Message to Send field, then scroll down and activate the option Speak this message. For a Sonos device, there are two places where you can select the device to use. If you choose On this speech device, the TTS message will be spoken at the current volume level of the speaker. For our example, we will choose On this music device, since it will allow us to also specify the volume at the same time.
    • RM 4 TTS Example setup speech.png
  9. Press Done with this action, and since we will only be adding a single action from our trigger device (the Front Door contact sensor), you should now select Done with Actions.
    RM4 TTS example finalize action.png
  10. Press Done to finish and test your rule by activating the trigger device.
    RM4 TTS example finish rule.png
  11. As you become more familiar with building rules, you can explore using Rule Machine® Actions called Custom Commands. These allow you to specify actions such as Pause, nextTrack, previousTrack, Mute, etc. These may be independent actions, or they can follow, or proceed the TTS action.
    RM4 Sonos example of custom commands 2.png

As you can see from the above examples, the power of Rule Machine® can be leveraged to specify criteria that must be met before a rule action is run. In the example rule, the TTS message will be at a specified volume level. Once you are more familiar with building Rule Machine® rules and Conditional Actions , TTS announcements at different volumes, occurring at different times of the day, only in specified Modes, etc., becomes very simple to achieve.