Table of Content
However the Flask server can only be accessed locally. Though you can control your switch locally, you can’t do it outside your LAN. Follow this guide to get your Pi running and then enable SSH. Add the response which we need to hear after saying the command to Google Home. If needed set this intent as the end of the conversation. These are the commands that users speak when they try to access a specific task from Google Home.
Then enter the same parameter name in the actions section. Voice controlled assistants have quickly become commonplace. Many homes have an Alexa or Google Home controlling everything from lighting to media, and even timekeeping. Sudo service mini-httpd restart Now you have a web server. Put the Pi IP address into a Raspberry Pi to test it. The phrases can contain parameters to be sent to the Pi too.
Get the Medium app
These options are under Preference/Raspberry Pi Configuration, then go to Interfaces and checkmark the SSH and VNC options. In addition to the push to talk feature, you can also trigger the Google assistant by saying Ok Google. For this you have to enter an invalid device id for it to work. Incorrect device id can be anything like aaaa , abcd.

I've been using that port which was also made for port forwarding so i dont know if it could be that or do i have to use a specific port. I used your google home and raspberry pi communication to write a program that controls the drone via the google home. The main step is to build an Node + Express server that is able to handle POST requests. Any request sent to your ngrok or pagekite URL should hopefully get tunnelled/forwarded to your flask server.
Step 2: Prepare SD Card With the Latest Raspbian OS (Stretch)
Because Google Home connects to webhooks which are on the accessible over the internet. Instead of that headache, we can use dataplicity services to place our raspberry pi on the internet with ease. Replace "raspberry-pi-ip-address" with your Pi's ip address, and don't forget the colon before the path. If you downloaded the JSON file to another location modify your local path to reflect this. Enter your password when prompted, and the file will copy to the Pi's home directory. Switch the christmas lights on” and the Google Home speaker should send the command to ifttt.

It all boils down to a command called switch which I use in my script. This all started back in the summer, while I was attending a programming bootcamp. When I managed to pick up a Raspberry Pi Zero, I wanted to take on an ambitious project. I gutted a power strip and replaced the switches with relays, and then created a React.js view for its frontend.
Install Google Assistant SDK
Go to the Dataplicity website and create your account and follow the instructions to add the raspberry pi to the dashboard. Now the GPIO pin is set to output and initializes in a low state. You can run your modified script passing your model-id number as an argument. Both ways begin in the terminal, to check the sound settings. Use the commands arecord -l and aplay -l to list available devices.
You've got quite a journey ahead of you to get this project working, but don't get discouraged! There's a lot you'll know on the other side of this project that will be useful in future projects you want to take on. So, to make this guide as user-friendly as possible, I'm going to include some links that you power-users might find excessive. Moreover you need to activate the OAuth server only once for account linking & than you can close it.
Another is to have your device connect to a server and listen for command changes, and then execute those changes. The Google Home has no way to directly control other devices on the same network or through other wireless protocols. Everything goes through an Internet-based service and expects to communicate with devices via a server-based proxy. How that server communicates with the device is up to the developer. Could you not create an application similar to the google home app to connect to it?
As usual, I like to hope this has been useful but don’t really want anyone to follow it to the letter. I don’t mind if anyone does, but I’d rather provide a bit of inspiration people to create something of their own. Sudo apt-get install mini-httpd sudo nano /etc/default/mini-httpd Now set set the START parameter in there to 1.
If you have USB 2.0 microphone then steps followed are same to check the microphone. Here we have used Webcam for USB microcphone. I got the server to say that its listening to port xxxx but when I try to use it in the browser it says connection refused. So, there are lots of guides on getting started with relays on the Rasberry Pi. I mostly used Youtube tutorials like this one to get started.
Now that you have a Google Assistant device, try some of the best Google Home commands---we've looked at some great Google Home mini games. Back in the Action Console, select Device registration from the left panel. Under Product create an easy to remember name for your device. The manufacturer name isn't important , and select Auto for the device type. The image above shows the USB webcam as card 1 and device 0. Take note of the card and device numbers for both microphone and speaker output.
A relay is an electromagnetic switch operated by a relatively small electric current that can turn on or off a much larger electric current. This is why you’ll hear a clicking sound when the relay is triggered. You'll be prompted to enable the device on your Google account. Copy the authorization code which follows, and paste it back into your terminal window. The way I opted for in the end was to use If This Then That. For anyone who’s not heard of it, it’s a web site that allows you to setup little jobs that get triggered by things.

Sudo chmod a+x switch The script can be tested by typing the url into a browser and checking that the Pi turns the right socket on or off. If not, you can add echo commands around in the script and try to figure out why not, the text gets fed back to the browser for you to investigate. In this file, you have to copy the contents of the credentials file that we downloaded. Open the .json file in your favourite text editor and press ctrl + A then ctrl + C to copy the contents.
Bonus: Voice Activated GPIO
You’ll also need to route web traffic from a fixed URL to your Pi. This can be on a non-standard port but don’t assume that’s any form of security. It’s probably best to avoid anything on there that could be useful to the bad guys or expensive to you. If your ISP doesn’t give you a static IP address, you may need to use a Dynamic DNS provider.

No comments:
Post a Comment