Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Add support for sending commands to Google Assistant #10

Closed
Trilis29 opened this issue Oct 1, 2022 · 19 comments
Closed

Add support for sending commands to Google Assistant #10

Trilis29 opened this issue Oct 1, 2022 · 19 comments
Labels
enhancement New feature or request

Comments

@Trilis29
Copy link

Trilis29 commented Oct 1, 2022

Could you allow to send commands instead of broadcast. So I could turn on some routines or send commands to assistant?

@maxi1134
Copy link

maxi1134 commented Oct 2, 2022

This would be very appreciated!

@tjkcc
Copy link

tjkcc commented Oct 12, 2022

+1

@Trilis29
Copy link
Author

Mainly the reason would be to use broadcast command from google routines, so after automation normal voice could say "Dishwasher finished". Without all this "broadcasting ...."

@flecmart
Copy link

flecmart commented Oct 20, 2022

This is a thing I would also appreciate... As a way to trigger google home routines from home assistant 👍

Maybe I can also contribute a PR if I find some time... from researching a bit in previous projects I think commands can just be send to by omitting the Broadcast in

config.conversation.textQuery = `Broadcast ${message}`;

So there could be 2 endpoints one for broadcasts and one for generic text commands.

@tjkcc
Copy link

tjkcc commented Oct 20, 2022

This is a thing I would also appreciate... As a way to trigger google home routines from home assistant 👍

Maybe I can also contribute a PR if I find some time... from researching a bit in previous projects I think commands can just be send to by omitting the Broadcast in

config.conversation.textQuery = `Broadcast ${message}`;

So there could be 2 endpoints one for broadcasts and one for generic text commands.

There are other solutions for sending commands instead of broadcasts from HA to Google, but keep in mind that you won't be able to trigger the built-in Home/Away routines. Doesn't work. The rest of the routines you can.

@Trilis29
Copy link
Author

Trilis29 commented Nov 8, 2022

This is a thing I would also appreciate... As a way to trigger google home routines from home assistant 👍
Maybe I can also contribute a PR if I find some time... from researching a bit in previous projects I think commands can just be send to by omitting the Broadcast in

config.conversation.textQuery = `Broadcast ${message}`;

So there could be 2 endpoints one for broadcasts and one for generic text commands.

There are other solutions for sending commands instead of broadcasts from HA to Google, but keep in mind that you won't be able to trigger the built-in Home/Away routines. Doesn't work. The rest of the routines you can.

What ways do you suggest?
My intension is to make routine for example: When I say dishwasher finished, announce to household "Take fkcin dishes out"

So I can have great nice google assistant voice instead of google translate robotic tts.

Home Assistant would trigger command or routine and that would be perfect.

@flecmart
Copy link

flecmart commented Nov 8, 2022

This is a thing I would also appreciate... As a way to trigger google home routines from home assistant 👍
Maybe I can also contribute a PR if I find some time... from researching a bit in previous projects I think commands can just be send to by omitting the Broadcast in

config.conversation.textQuery = `Broadcast ${message}`;

So there could be 2 endpoints one for broadcasts and one for generic text commands.

There are other solutions for sending commands instead of broadcasts from HA to Google, but keep in mind that you won't be able to trigger the built-in Home/Away routines. Doesn't work. The rest of the routines you can.

What ways do you suggest? My intension is to make routine for example: When I say dishwasher finished, announce to household "Take fkcin dishes out"

So I can have great nice google assistant voice instead of google translate robotic tts.

Home Assistant would trigger command or routine and that would be perfect.

yes I would like to use it in a similar way. I already forked the repo and implemented it but I could not test it unfortunately because I am not able to complete the auth workflow... I opened an issue #11 for this... all in all integrating this was frustrating so I stopped for now.

@ismarslomic
Copy link
Owner

Thanks for opening this feature request, but this topic has already been answered in #2. I don't want to increase the complexity of the solution, as it is already challenging to do the debugging with broadcast alone (ref #11, #5 and #9). Closing the issue.

@ismarslomic ismarslomic added enhancement New feature or request question Further information is requested wontfix This will not be worked on labels Dec 6, 2022
@codahq
Copy link

codahq commented Dec 7, 2022

@ismarslomic you should consider re-opening this. you have said in the HA community forums and in issues in github you can't broadcast to individual devices but you can. in greg's original solution (assistant relay) if you set broadcast to false and converse to false (so that a command would be sent) so that you passed something like this:

{"user":"{{yourvaliduser}}","command":"broadcast to office hello, this is a test message."}

it will send to just the speaker(s) in the room "office". This was functionality Google introduced a year or two ago. However, it only works when the message is sent as a command.

This works so reliably that on another home automation platform I could create virtual individual speakers and then make a virtual speaker send the command "broadcast to {{the_provided_speaker_room_name}} {{original_message}}". I have been broadcasting to individual speakers for almost a year.

I have finally cutover the rest of my devices to HA though so I can no longer use the solution from the other home automation platform. I am hoping you can allow this functionality here so I can continue to broadcast to individual speakers now that I've moved over completely to HA.

@ismarslomic
Copy link
Owner

Interesting, I was not aware of that you need to send the broadcast as a command to get it work with specific speaker. Thanks for the heads up.

I can give it a shot and see how it works!

@ismarslomic
Copy link
Owner

I have added a way to opt out the prefix of broadcast in the message, so you can basically send whatever you want to Google Assistant. I tested it quickly at home and I where able to switch off/on my lights, but I haven't done any extensive tests of other Assistant use cases.

I did also manage to send broadcast to living room, Hello world message, and it played the message Hello world on my speaker, but I only got one speaker at home, so I where not able to test if this really works when having more then one speaker.

Can anyone with multiple speakers test the command and directing to specific speaker feature?

Use following image: ismarslomic/google-assistant-broadcast:main and add APPEND_BROADCAST_TO_MESSAGE=false to env variables in your docker run command / docker-compose file.

See also updated README doc

@ismarslomic ismarslomic removed question Further information is requested wontfix This will not be worked on labels Dec 7, 2022
@ismarslomic ismarslomic changed the title Command instead of broadcast? Add support for sending commands to Google Assistant Dec 7, 2022
@maxi1134
Copy link

maxi1134 commented Dec 7, 2022

Just updated, Commands and single-speaker broadcast work for me.

@Trilis29
Copy link
Author

Trilis29 commented Dec 7, 2022

Commands works, but does it work for routines for you? I have tried to enable routine with command not working

@ismarslomic
Copy link
Owner

ismarslomic commented Dec 7, 2022

Just updated, Commands and single-speaker broadcast work for me.

Nice! For me it worked sending message to specific speaker when writing in english, but not in Norwegian. I think I did read somewhere that broadcasting to specific speaker was not supported in all languages

@ismarslomic
Copy link
Owner

Commands works, but does it work for routines for you? I have tried to enable routine with command not working

I haven't tested, as I only use HA for automation. I think Assistant routines has poor user experience and don't see any benefit using it when I got HA

@Trilis29
Copy link
Author

Trilis29 commented Dec 7, 2022

I need routines just for only 1 purpose. Announce message.
For example making routine: when I say dishwasher done > announce: “Dishwasher has finished, please take out the dishes”

Then you won’t hear any intro like Broadcasting… just straight non robotic words. This would be best feature to integrate response on speakers in automations.

@maxi1134
Copy link

maxi1134 commented Dec 7, 2022

As far as I understand there is a few things that the command APi on google cannot do.

Amongst those; Routines and starting music.

I will try to find a source later!

@ismarslomic
Copy link
Owner

ismarslomic commented Dec 7, 2022

I see, well. I'm not sure why routine commands doesn't work as I dont use Google Assistant for those use cases (thus reason why I wanted to keep this solution as narrowed and simple as possible). But feel free to explore it and see if you can manage to get it work.

Personally, I would place a Flic button just beside the dishwasher and press it manually, so it triggers an HA automation (via webhook), which uses this broadcast solution to make an announcement.

Closing this issue as support for commands has been provided.

@Trilis29
Copy link
Author

Trilis29 commented Dec 8, 2022

I have that solution, but I really hate this "Broadcast incoming...." I would like ONLY the phrase Dishwasher finished

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants