Nanit Baby Monitor Integration

I got most of this working but the camera card still not showing anthing.
The secrets.yaml contains the correct url with the token and I can use the url with rtmpdump and vlc but the card does not show anything and I get the following error:

ERROR (stream_worker) [homeassistant.components.stream.stream.camera.jack] Error from stream worker: Error opening stream (ERRORTYPE_5, I/O error) rtmps://media-secured.nanit.com/nanit/xxxxxxx.YYYYYYYYYYYYYYYYYYYYY

Any suggestion? I am not sure if I have to install or configure something else in home assistant to have the camera (ffmpeg) to work.

Thanks in advance.

Never mind meā€¦ stupidly, I didnā€™t have the ffmpeg integration enabled in my configuration.yaml :smiley:

good catch, i fixed that

@zone99 THANK YOU!!

This was super simple to follow and setup from scratch. I didnā€™t have Scrypted before, and now itā€™s feeding the Nanit RTSP stream into HomeAssistant and through to HomeKit as well. This is so awesome.

Thanks!!

I am very new at this and I was trying the scrypted route today but I am stuck in one of the very first steps

  • Open this plugin directory in VS Code
  • In a terminal cd into this project directory

Where it says open this plugin directory was there supposed to be a link there?

For anyone interested in this, I finally had some time to set up a MITM proxy and look at some of the traffic here. It looks like to turn the camera on and off, the app actually starts and stops the remote video stream. If stopped, there are a couple of other API requests and the camera turns off. When restarted, the camera turns on. I donā€™t have the camera itself going through the MITM proxy, so I donā€™t know what happens on its side when that stream stops, but Iā€™ll work on that next.

1 Like

I am getting this error even after login in with the npx

TypeError: Cannot read properties of undefined (reading ā€˜usernameā€™)
at getLogin (C:\Users\The Surge\Git\scrypted-nanit\node_modules@scrypted\sdk\bin\index.js:35:25)
at C:\Users\The Surge\Git\scrypted-nanit\node_modules@scrypted\sdk\bin\index.js:86:20
at new Promise ()
at exports.deploy (C:\Users\The Surge\Git\scrypted-nanit\node_modules@scrypted\sdk\bin\index.js:57:12)
at Object. (C:\Users\The Surge\Git\scrypted-nanit\node_modules@scrypted\sdk\bin\scrypted-deploy.js:16:10)
at Module._compile (node:internal/modules/cjs/loader:1226:14)
at Module._extensionsā€¦js (node:internal/modules/cjs/loader:1280:10)
at Module.load (node:internal/modules/cjs/loader:1089:32)
at Module._load (node:internal/modules/cjs/loader:930:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Authorization required. Please log in with the following:
npx scrypted login [ip]

Is this published such that I can install it from within an existing HAOS > Scrypted (as an add on) workflow? Iā€™m guessing not, since I donā€™t see it listedā€¦ perhaps this super cool idea isnā€™t ready for that level of prime time, though?! Super cool work, nonetheless!

Yes, thereā€™s an HA add on available via the scrypted repo.

I have this working, but thereā€™s no video preview in HA or scrypted. Is this due to the battery mode?

Ignore this, itā€™s just started working.

Thank you so much for your efforts on this.

Oh nice! Can you maybe screenshot what youā€™re referring to? Iā€™m unable to find Scrypted-Nanit here (as you can see filtering for the substring ā€œnanā€ shows no results; Iā€™ve also just read the whole list and thereā€™s no nanit, no Zone999, or anything else even similar, actually):

You still need to follow the other steps.

Youā€™ll need VS Code, node and npm installed. Youā€™ll also need to create a nanit user in scrypted (with admin).

Once youā€™ve installed those three items, download/clone the repo, open that downloaded folder in VSCode and type the commands into the terminal. You will need to run the authentication command mentioned. Use the creds from your new nanit user you created earlier in scrypted.

Sorry all. I was away having the baby that I need this integration for. Haha.

The preview not working is one of the TODOs I have. It works after you open the video for a bit, but then a few hours later it wonā€™t anymore.

2 Likes

Not sure whatā€™s going on. If the login worked you wouldnā€™t see this. Have you checked scripted forums? Feel free to pm me and Iā€™ll do my best to help!

Itā€™s not an official add on. You have to build and install it manually.

Ah, ok- also congratulations!!

Took inspiration from this to implement a simple schedule to update permissions.
E.g. give a nanny access only Mon-Fri from 9 to 5

Since nanit has not implemented the following

Using loging and headers mentioned above you can enable/disable users with

Method PUT

URL https://api.nanit.com/babies/(babyID)/users/(userID)/permissions/enable
Or
https://api.nanit.com/babies/(babyID)/users/(userID)/permissions/disable

No Body

You can update individual permissions with

Method PUT
URL https://api.nanit.com/babies/(babyID)/users/(userID)/permissions
 Body
 '{
	"allowed": {
		"control_nature_sounds": true,
		"control_nightlight": true,
		"edit_baby_tips_settings": false,
		"edit_insights": false,
		"edit_settings": false,
		"edit_subscription": false,
		"invite_edit_users": false,
		"membook": true,
		"receive_notifications": true,
		"see_hear_moment_videos": true,
		"share": false,
		"smart_sheets": false,
		"sound_on_stream": false,
		"sting_monitoring": false,
		"two_way_audio": true,
		"update_firmware": false,
		"view_summaries": true
	}
}'

Thanks for this! It works great. After cobbling together my own hacked together solution earlier this year that was quite janky (slow to load stream using ffmpeg, issues refreshing token occasionally)- I was able to install this remotely to my HA OS and replace my implementation completely. I have been using it for a couple days and it is solid.

The only note I would add to the readme (perhaps Iā€™ll put in a PR to help newcomers) would be to ensure both ffmpeg and Rebroadcast Plugin are installed into Scrypted. It doesnā€™t seem to be mentioned anywhere they are needed, and I ended up with a black screen when trying to view the stream.

Good call on the ffmpeg plugin being required. I had installed the Rebroadcast plugin but had missed that one.

Iā€™d love to be able to grab the MQTT-offered values from the previous integration for things like humidity, temperature and ā€œis nightā€. Has anyone found another way of obtaining these?