![]() ![]() It’s probably best to avoid things like “play” and “music” since the Music app will want to respond to these.Īfter creating one, be sure to tap it from the main screen Shortucts to run it once. I named mine “Sonos - Chill” (it will ignore the - when listening). ![]() Be sure you include Bearer and a space before pasting your access token.īe sure to name it something that makes sense so you can call it from Siri. Add a Header named Authorization and set its value to Bearer YOUR_ACCESS_TOKEN_HERE only using the access token you created earlier. This will work best if it is available via the Internet and not just your local network. Replace the host with wherever your Home Assistant installation is accessible. Use the script.turn_on service.Īdd a URL action and enter something like this: Update: Instead of using the URL approach mentioned below, you can use the Call Service action from the Home Assistant iOS app instead of creating URLs. Now that we can use Home Assistant to do all of this Sonos magic, it would be great if we could just yell at our phone and have Siri trigger it.įirst, open Shortcuts and hit the plus to create a new shortcut. Be sure to save it somewhere since we’ll need to reference it later. Scroll to the bottom and create a new Long-Lived Access Token. In the very bottom left of Home Assistant, click your avatar. The last things we’ll need to setup in Home Assistant is a way to enable calls outside of Home Assistant. If you want to play something from Apple Music (or any other source), simply add it to My Sonos (or Sonos Favorite) in the Sonos app. This will return a source_list among other interesting properties. For example, I used media_player.master_bedroom. To see the names that Home Assistant sees, head to Developer Tools > States and enter a Sonos entity into the entity box. For Sonos, this is just your My Sonos (aka Sonos Favorites). The media_lect_source needs to choose a source from the media player’s source list. You can see we use the script.turn_on service to call the script we created in the previous step. # Play the Chill playlist sonos_chill : sequence : # First, group everything - service : script.turn_on entity_id : script.sonos_group_all # Start playing the Chill playlist - service : media_lect_source entity_id : group.sonos data : source : Chill # Turn on shuffle - service : media_player.shuffle_set entity_id : group.sonos data : shuffle : true Let’s do something more interesting though. A script is just a sequence of actions you want to perform, so you can see we call two in a row to set things up. You can see in its documentation what services are available and what parameters they take. In the above example, we are using some media_player services. Adding new integrations will often add more services if it’s a new kind of device. In Home Assistant, head to Developer Tools > Services and you can explore what’s out there. You can think of these as API calls that take some set of parameters. (This one is # the newest model so it probably has the best CPU if that matters at all.) - service : sonos.join data : master : media_player.master_bedroom entity_id : - group.sonosĮasy enough! Home Assistant uses services to control things in scripts. service : media_player.volume_set data : entity_id : media_player.living_room volume_level : 0.15 # Now join all of the speakers to the Master Bedroom speaker. Since this is the TV, it # frequently gets turned up much higher and music at this volume is too loud. Script : # Script to group all Sonos speakers sonos_group_all : sequence : # First, set the volume of the Living Room to 15%. In your configuration, add the following (using your own entity names): I have a group called group.sonos that is all of my Sonos media_player entities. ![]() Home Assitant Configurationįirst, we’ll need to setup some things in Home Assistant. In this example, let’s setup a shortcut to group all of our Sonos speakers and shuffle a particular playlist. Since things you add here are accessible from Siri, you can create shortcuts for things you want to do and then ask Siri to do them for you. The key to using Siri to control things in Home Assistant that aren’t supported in HomeKit is the Shortcuts app. Apparently you can do this with Alexa, but I want to use Siri.) Approach (I specifically want to play Apple Music on Sonos via Siri. For now, I just want to go over controlling Sonos with Siri. I plan to do a getting started with Home Assistant post at some point. So HomeKit is just controlling Home Assistant which is controlling the real devices. I connect everything directly to Home Assistant and then add Home Assistant to HomeKit (Apple’s Home app). It’s a really fantastic way to connect everything in your house into one place and then control it however you want. Lately, I’ve really been getting into Home Assistant. Home Assistant, Sonos, and Siri - Sam Soffes Sam Soffes Home Assistant, Sonos, and Siri
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |