endoplasmic / google-assistant

A node.js implementation of the Google Assistant SDK
MIT License
284 stars 75 forks source link

Google Home integration (v1alpha2) #30

Closed jpoeppelman1 closed 6 years ago

jpoeppelman1 commented 6 years ago

Hi, thanks for building this great module as I use it for home automation. I was wondering if there is any plan to update this package to v1alpha2 in order to send commands to google devices such as Google Home. "Hey Google, play Jazz on [Device Name]". Thank you!

endoplasmic commented 6 years ago

I took a peek at this last night for about an hour. It's not toooo bad, but they did change some stuff (requiring language code, device id, etc.), so it might be a good weekend project for me to see if I can't get this going.

endoplasmic commented 6 years ago

image

Making progress! Also love that we get the speech output as text! (the emoticons are a super nice touch as well)

jpoeppelman1 commented 6 years ago

Freaking awesome! Did you get it to talk to a google home device on your home LAN? :)

On Fri, Jan 5, 2018 at 11:49 PM, Scott notifications@github.com wrote:

[image: image] https://user-images.githubusercontent.com/118301/34636586-bfc22b54-f259-11e7-8d46-d44cbc595342.png

Making progress! Also love that we get the speech output! (the emoticons are a super nice touch as well)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/endoplasmic/google-assistant/issues/30#issuecomment-355723134, or mute the thread https://github.com/notifications/unsubscribe-auth/Ahcfwtm-SvyeV33LnsOpL2O1nFVIG5inks5tHvtxgaJpZM4RRzqT .

endoplasmic commented 6 years ago

That part is a little trickier because it requires that I register it as a device (I think). https://developers.google.com/assistant/sdk/reference/rpc/google.assistant.embedded.v1alpha2#deviceconfig

So for example when I say "Set a timer for 5 minutes" it responds with " Sure, 5 minutes. starting now." then right after that "Sorry I'm not sure how to help with that".

I'm not sure if they are related, but I'm also not sure what you mean by talk to another google home device on the LAN. What would be an example of doing that?

jpoeppelman1 commented 6 years ago

Yep, read that about registering a device. I'm not sure how that works to be honest.. This is mostly for home automation. I have a node.js home server that sends messages (mp3 URLs) to all of my google home devices via a speaker group. Basically, I want to extend with easier control using assistant.

On an android phone, I can say "Hey google, set the volume to 50% on downstairs speakers" and it works. I want to be able to do the same using Node.js library instead of going through the cast framework (castv2-client). I do this today and it works, but it a little cumbersome, would be way cooler to have my Samsung SmartThings routine app tell google assistant to "play JImmy Buffett on Pandora on downstairs speakers".

Cheers! :)

James

On Sat, Jan 6, 2018 at 12:34 AM, Scott notifications@github.com wrote:

That part is a little trickier because it requires that I register it as a device (I think). https://developers.google.com/ assistant/sdk/reference/rpc/google.assistant.embedded. v1alpha2#deviceconfig

So for example when I say "Set a timer for 5 minutes" it responds with " Sure, 5 minutes. starting now." then right after that "Sorry I'm not sure how to help with that".

I'm not sure if they are related, but I'm also not sure what you mean by talk to another google home device on the LAN. What would be an example of doing that?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/endoplasmic/google-assistant/issues/30#issuecomment-355724944, or mute the thread https://github.com/notifications/unsubscribe-auth/AhcfwqivfgwW5wUuVDq5CLBa-aUXgHMGks5tHwYBgaJpZM4RRzqT .

endoplasmic commented 6 years ago

Ok that's a great example. I also run all my chrome cast speakers with the assistant.

I've branched master to a v1alpha2 branch if you wanted to follow progress / play with it: https://github.com/endoplasmic/google-assistant/tree/v1alpha2

endoplasmic commented 6 years ago

So I've done a bit of digging and it doesn't look like we can target devices on the network yet. I'm guessing they are doing the device trait stuff to pave the way for more: https://developers.google.com/assistant/sdk/reference/traits/

I'll clean things up so that it does support text input and device actions (if you want to define a device that will run this code)

ItsWendell commented 6 years ago

@endoplasmic Nice work on working on v1alpha2, I'll be tracking your process, curious to see how you'd implement some of these features! I've been working on the same thing within the other Google Assistant Node Library because I couldn't get this one to work in the past.

Check it out, might be useful for you; https://github.com/WMisiedjan/google-assistant-node/tree/feature/v1alpha2

endoplasmic commented 6 years ago

Alright guys, v1alpha2 stuff is done!

There are some minor tweaks to the config object, and the API for the conversation events is slightly different, but for the most part, things should work as they did before except with more stuff!

Check out the README for more info and let me know if you have any questions.