Nanit Baby Monitor Integration

Anyway to integrate the Nanit baby monitor?

https://www.nanit.com

Their stupid app will not even support landscape so when I cast it to an android TV it just sits in portrait mode lol

Anybody have any clue how to get this going?

You ever figure it out - I really don’t like Nanit wish I would have just done something simpler

Nope notha!

I’ve MITM’d the app and the API seems very formal and straight forward. I don’t have time to figure it all out but can provide my findings if someone is willing and able to code the python.

1 Like

I am interested in trying

1 Like

I was just thinking about snooping the traffic to see how complicated it looked. Can I get a copy of the data you scraped?

Did anyone received an update on this ? Just being curious :slight_smile: as a dad to be.

Notha :frowning:

I’ll give it a crack if you can put the data somewhere?

Sorry for not responding sooner… some basic python code to invoke thier API and dump some data below… I couldn’t get past this.

I tried MITMing video streams and some of the controls like light on/off… couldnt figure out the websocket stuff…

Blockquote
import requests
import _thread
import time
import sys
import json
import pprint
loginUrl = “https://api.nanit.com/login
babiesUrl = “https://api.nanit.com/babies
s = requests.Session()
headers = {
‘x-tc-transform’: ‘tti-app’,
‘Content-Type’: ‘application/json’,
‘x-tc-transformVersion’: ‘0.2’,
‘Accept’: ‘/
}
data = {‘email’: ‘***@domain.com’, ‘password’: ‘secret_password’}
r = s.post(loginUrl, headers=headers, json=data)
loginResults = json.loads(r.content.decode(‘utf-8’))
authToken = loginResults[‘access_token’]
headers[‘authorization’] = "token " + authToken
b = s.get(babiesUrl, headers=headers)
babiesResults = json.loads(b.content.decode(‘utf-8’))
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(babiesResults)

2 Likes

ok following up i’m able to retrieve the Camera UUID

POST
Headers
‘x-tc-transform’: ‘tti-app’,
‘Content-Type’: ‘application/json’,
‘x-tc-transformVersion’: ‘0.2’
Body:

{ 
  "email" :"[email protected]",
  "password" :"password"
}

Grab access_token

GET
https://api.nanit.com/babies

Headers:
‘x-tc-transform’: ‘tti-app’,
‘Content-Type’: ‘application/json’,
‘x-tc-transformVersion’: ‘0.2’
‘Authorization’: ‘Token <your_access_token>’

Grab camera_uuid

GET
https://api.nanit.com/focus/cameras/<camera_uuid>/connection_status
headers:
‘x-tc-transform’: ‘tti-app’,
‘Content-Type’: ‘application/json’,
‘x-tc-transformVersion’: ‘0.2’
‘Authorization’: ‘Token <your_access_token>’

Also I get a redirect URL when using the same headers and GET to
https://api.nanit.com/focus

2 Likes

ok, so
GET
(above headers)
https://api.nanit.com/babies/<baby_id>/events
returns a bunch of events in json format

baby_id can be obtained from /babies above

Great work on this. I’m in the market for a baby monitor and being able to integrate with HA is on my list of “would likes”. I’ll likely end up purchasing the Nanit, not just because it seems to be the best option on the market at the moment, but because it does look like (with some work) an integration is possible.

Having used it for about 4 months (I used to have the cocoon cam but thankfully returned it before they went belly up). You do need the bands or the sleep sack to track breathing - the cocoon didnt need anything.
I’m at about the edge of my technical capabilities, so if anyone can turn the above info into some python we should be in a good place

It’s either the Nanit or the Miku for me at the moment. On paper, the Miku wins as there’s no wareable required, however everyone seems to rate the Nanit over the Miku.

I’m still a few weeks away from a purchase, but I’ll gladly help out with this when I can. I’m a Developer, just not a python one, but I’ve been meaning to learn for a while now.

Have you seen anything in the API that might look like a camera stream?

congrats!
First one?
Re camera - yes in the events.json that is returned from the
https://api.nanit.com/babies/<baby_id>/events

there is a long list of event IDs, types of events (motion/sound) and also clip urls although not tried loading them yet.

I’m doing this all manually through a REST API chrome extension (I should probably use Postman or something)

the base url for the video seems to be:
https://nanit-raw-videos.s3.amazonaws.com/<baby_id>/[year]/[month]/[day]/[hour]/[some number].mp4

then a long X-Amz-Security-Token which is the same
some info about the token
then some signature info which is different
(but i’m assuming not an issue as its all JSON so can be parsed easily to look at last events, or motion events only etc)
not sure if you could watch the json for new events and then create 2 binary_sensors
1 for motion
1 for sound
and then it would be cool to send the clip URL as a mobile notification alert :slight_smile:

not got a live feed url yet though.

Yeah, first one. He was a few weeks early so he’s still in hospital at the moment, but he’s making excellent progress. Hopefully it won’t be too long until he can come home.

It sounds like you’ve done most of the heavy lifting on this from a discovery point of view. I highly recommend postman. I use it on the daily and it’s such a timesaver.

I shall speak to my partner about this later and suggest we make a purchase sooner rather than later, that will at least give me some time to get my head around the API before I struggle to remember what sleep used to be like.

1 Like

For some reason when I try and hit the events endpoint I get a 401 despite the other endpoints working fine.

Anyone discover the insights url?

hey awesome news :slight_smile:
we bought the crib and set up all the stuff, of course being our first too didn’t realize he doesn’t sleep in the crib until 6 months plus lol (slept in a bassinet in our room until then) so you still have some time when you get home.

1 Like