I love our smart cameras but I am tired of waiting for rollouts of new features before I can use the camera. I would also like to store images and video automatically to my own cloud storage for later batch analysis with some home grown ML models.
In this tutorial I am going to walk you through how to connect your Nest Camera API and start issuing API calls for batch and real time streaming.
In future tutorials I will show you how to create a Big Data pipeline that sends data to AWS Rekognition to perform all kinds of cool analysis on your data.
Although Nest Camera has a much better API than Arlo and Ring cameras, connecting to the camera was a bit cumbersome.
Note: You will need notepad or text editor to copy and paste all the various keys, secrets, and API calls.
You need a Nest user account in order to setup your camera so this may be mundane step if you have had your camera for a while.
You will need to create a Nest Developer account that is separate from your nest camera account.
This step is a little confusing but you are basically creating a way to authorize your Developer Account to talk to your camera. If you are just creating a connection for your home camera some of the required fields may not make sense as they are designed for third party applications that will serve other users in production. You can just fill in arbitrary values for those. For the description you will need to write something like “allow application to control nest”.
After filling in the required info, scroll down and select Camera > Camera + Images read/write for full access.
Copy down your ClientID, Client Secret, Authorization URL as you will need them later.
In this step you are basically assuming the identity of the camera owner. In theory this could be anyone, anywhere with a nest device. You are going to authorize the developer(yourself ) to connect to your camers.
Copy the Authorization URL and paste into a new browser window. If you are signed into Google Home you will prompt you to allow your OAuth to connect to your personal nest account.
It should give you a PIN Code. Copy this down!
With your Pin Code, Client ID, and Client Secret you will replace the variables %YOUR_VARIABLE% in the url below with the correct values that you obtained in the previous step.
curl -X POST “https://api.home.nest.com/oauth2/access_token?client_id=%YOUR_CLIENT_ID%&code=%YOUR_PIN_CODE%&client_secret=%YOUR_CLIENT_SECRET%&grant_type=authorization_code"
Copy this command and then execute it on the command line
You should get back an access token that starts with a “c.”. This string(very long) is your Access Token and will be used for authorization for API calls.
VERY IMPORTANT: do not leave this unhashed anywhere beside a secure environment. Someone can access your camera with it!
Now that you have your token you can obtain the id’s for your camera. Execute this command after inserting your token.
curl -L https://developer-api.nest.com/devices/cameras\?auth\=%YOUR_ACCESS_TOKEN%
This will return a blob of JSON Data. Parse out the structure_id and device_id. You can simply read through the data in your terminal or you can cut and paste info into text editor and then search.
Now that you have your Token, and ID’s you fill in the nest API to get your live url for your camera.
This will return the live url for your camera. Paste it into your browser and Smile! You should see the real time stream of your device!
Congrats, now you are all set up to start issuing API calls to your Nest Camera!
Big Data Enthusiast and lover of all things distributed and scalable.
How many times a day do you hear the words “Big Data”? You probably hear it from the full gamut of people: math people, empirically-challenged people, technical people, marketing folks, engineers, your clients and every time you eavesdrop on a conversation in a coffee shop in a business district. Speaking over people’s heads is a … Continue reading Big Data in a NutshellRead More
The Gentlest Introduction to Apache Kafka While “Chaos Theory” says the universe trends to complexity, a good engineer should strive to tame that complexity by providing the simplest solution possible. But “simple” solutions can still be too complex for individuals whose job it is to provide usable information to end users and stake holders. … Continue reading Apache Kafka in a NutshellRead More
In our previous tutorial we connected our Particle Argon device to the internet, wired in an LED light and then flashed some code that makes it blink. Now we are going to going to add some functionality to be able to control it over the internet. Step 1: Setup your hardware If you have not setup … Continue reading IoT Tutorial Part II : Control LED over the Net with Simple APIRead More