cancel
Showing results for 
Search instead for 
Did you mean: 
Replies are disabled for this topic. Start a new one or visit our Help Center.

Script Editor: Adding speakers to the current music playback

aredos
Community Member

Hi!

Thanks for adding the new automation script editor, I think this will be a great way to create more advanced automations.

I would like to add speakers to the current music playback based on motion detection in the respective rooms - is this currently already possible? If not, can you add this feature?

Thanks in advance!

6 REPLIES 6

Cathal_S
Bronze
Bronze

Hi aredos,

Yes this would be possible if you have motion sensors that are supported.

I don't have supported motion sensors but I do have some that currently turn lights on/of and my lights are supported so I tested this to activate when (my unsupported motion sensor) switched on my kitchen light.

The code I tested and worked is shown below.

 

 

 

 

metadata:
  name: Media move 
  description: Test moving media when event happens 

automations:
 
  starters:
    - type: device.state.OnOff
      state: on
      # [available operators: is, isNot]
      is: true
      device: Kitchen Light - Kitchen


  condition:
    type: device.state.Volume 
    state: currentVolume
    device: Living Room speaker - Living Room
    greaterThan: 0

  actions:
    - type: assistant.command.OkGoogle
      devices: Living Room speaker - Living Room
      okGoogle: Move the music to kitchen speaker

 

 

 

Edit: I was hoping to use this condition....

 

  condition:
    type: device.state.MediaState
    state: playbackState
    is: PLAYING
    device: 

 

But I could only see my Chromecast with Google TV devices available and not any of my speakers or displays.

 

 

 

Regards,
Cathal

aredos
Community Member

Hi Cathal,

the "Move the music to kitchen speaker" is not working for me. Do you know why? I also think that this would create inconsistencies where sometimes it would do the wrong action. For me it sometimes just brings up google search results about the search term and sometimes starts a completely new spotify session on the kitchen speaker.

There's a dedicated feature which allows for music transfer and it would be good to have it as a dedicated action, otherwise it will work inconsistently which would be frustrating and unusable.

Hi again,

The code I showed was only meant as an example of what worked for my testing.

It would need to be changed and expanded on for your devices and motion sensors.

I've been trying to find out what supported actions and commands are available for Google speakers and displays but haven't found that yet?

https://developers.home.google.com/automations/supported-devices 

I'm just a normal user myself that has only had access to the script editor for a few days and still learning what can currently be done. Please share your suggestions and ideas on the forum post linked below.

https://www.googlenestcommunity.com/t5/Home-Automation/Script-Editor-Share-your-ideas-and-vote-on-ot... 

 

 

Regards,
Cathal

Muddi
Community Specialist
Community Specialist

Hey aredos,

 

I hope we were able to answer your question with the info provided by @Cathal_S. If you have additional questions, feel free to respond to this thread and we'd be happy to further assist you.
 

Cheers,

Muddi

aredos
Community Member

Hi Muddi,

this automation does not work for me, sorry. It would still be an open feature request.

I added it as an idea to the ideas thread:

https://www.googlenestcommunity.com/t5/Home-Automation/Script-Editor-Share-your-ideas-and-vote-on-ot...

Best,

Peter

Muddi
Community Specialist
Community Specialist

Hi there,

 

Sorry for the delays. We appreciate sharing your ideas and requested features. You can always send feedback on your devices by following the steps on our help center.

 

Let us know if you have further questions or concerns; otherwise, I'll lock the thread after 24 hours.

 

Cheers,

Muddi