06-18-2023 11:37 PM
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!
06-19-2023 11:01 AM - edited 06-19-2023 11:17 AM
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.
06-19-2023 08:48 PM
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.
06-20-2023 05:35 AM
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.
06-26-2023 06:34 AM
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
06-26-2023 08:35 AM
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:
Best,
Peter
07-09-2023 12:45 PM
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