Nanit Baby Monitor Integration

Log says that you haven’t passed the NANIT_EMAIL variable. Please use the -e [email protected] as suggested by @jaburges. Read the command carefully and watch for typos. Post the exact command here if you still encounter issues.

The 2 step verification could indeed cause issues, but it would not result in the log that you are seeing. I haven’t tested the app with 2 step verification though. It is likely it would require adjustments.

Literally just copying the command from gitlab

docker run --rm \
  -e [email protected] \
  -e NANIT_PASSWORD=XXXXXXXXXXXXX \
  -p 8080:8080 \
  registry.gitlab.com/adam.stanek/nanit:v0-3

and replacing email (gmail address) and password (alphanumeric, no special characters). even updated my nanit email address to remove a period I had in it.

Hmm… That is strange indeed. If there would be any special characters (like *{}[]) it would help to use quotes around the value, but if it is just alphanum, there shouldn’t be an issue.

I am bit confused about the error messages you have posted. They should be mutually exclusive. If the NANIT_EMAIL is not passed, the application shouldn’t even start. If it says 401 error, it means that the credentials are there, but they are not accepted by Nanit servers (most likely due the enabled 2 FA auth.).

I disabled 2 step verification and used quotes around both the email and the password and it worked! I was able to load the stream in safari (I have 2 daughters, both cameras showed up). Plans to add support for 2 step?

Now a little confused on how to get it hooked up in Homebridge.

I added the ffmpeg plugin…how do I restream to RTMP and what are the desired settings in ffmpeg for HB? Also wondering if it will automatically set up 2 video feeds in the Home app or I need to set up 2 camera instances in ffmpeg?

GOT IT
In case anyone else is in the same boat, here’s my setup:
I’m running Homebridge on a Raspberry Pi 4. As Docker can’t run directly on the Pi, I’m running it on my iMac. Once the container is up and running, I can load the stream(s) of the cameras at http://127.0.0.1:8080. By right-clicking each camera feed in Safari, I’m able to copy the video URL (m3u8 stream) which opens in VLC no problem. The trick to getting it to stream in Homebridge FFMpeg is to add “-i hls+” before the url. So my URL is

“-i hls+http://local.iMac.IP.address:8080/video/uniqueCameraFeedID.m3u8”

Repeat for each Nanit camera you have and the Home app will display all.

Thanks so much @velky.bloud for all your work!

I want to learn how to cross-compile docker images for Pi. I can try to setup some build pipeline if you are willing to test it. I am not running any Raspberries at the moment so I have no way of testing that myself.

Would love to! That would eliminate my iMac from the equation and I can just rely on the Pi for serving the Nanit video feeds.

1 Like

I’m really interested in getting this working in HA with the sensors. I’d love to be able to pull the temp and other stats for automation purposes. The Nanit cameras I have are the only smart devices I’ve not out in HA. One thing I do have to ask though, as it stands, do you have to run a docker container for each camera? I have two.

I’m running 1 container. With the ffmpeg homebridge plugin, I set up 2 cameras. Hope that helps!

It should be able to handle multiple cameras. You don’t need to run it twice. But I have only 1 camera so I didn’t really test it for that.

As for the sensors, it will probably take a while until I will have time to add the sensors read out. Majority of the stuff is already done, but I still need to implement the MQTT part.

Let me know if you want to test running the container on a Pi.

And if I can somehow convince you to port to a native Homebridge plug-in! :slight_smile:

Yeah, I will get back to that :slight_smile: I have already tried to setup the CI for it, but stumbled upon some of its limits.

Regarding the HB plugin, honestly, it would be much easier for me, because I am a TypeScript developer. But the whole purpose of the project was for me to learn a new language, thus Go :slight_smile:

I am trying to make it independent as much as possible. Yes, I want it to be easily integrated with both HA and HB, but I am thinking about dropping them in the future (for myself, not the support within the project). They serve me well for now, but I always wanted to create some awesome dashboard for my home within wall-mounted tablet. The solutions I have seen so far in HA are not really cutting it for me. I only interface my home through homekit integration. But there is so much potential awaiting for me to unlock :wink:

I have managed to build some ARM ready images. Hopefully they will work OOB on Pi. Please have a look: https://gitlab.com/adam.stanek/nanit/-/issues/2

1 Like

Works great on my config:

pi@pi:~/tmp/nanit $ uname -a
Linux pi 5.4.72-v7+ #1356 SMP Thu Oct 22 13:56:54 BST 2020 armv7l GNU/Linux
pi@pi:~/tmp/nanit $ docker --version
Docker version 19.03.13, build 4484c46
1 Like

Thanks @velky.bloud, works great on the Pi!

I know I’m on the HA site, but if you ever have spare time to prep a native HB Nanit plugin, I know I’m not the only one who would be grateful for a docker-less setup :slight_smile:
Here are a handful of others:


1 Like

Add me to that! Last time i tried to explore Docker my brain exploded. Meaning dockerless configuration for Hass

Really appreciate everyones work here. This is a really really game changing solution for me. Not trying to nitpick at all, but here is what I am encountering…

I have twins, so two cameras. I was able to get the HLS stream working and both cams into HB via @yweiss excellent work. The only issue I have is, as @velky.bloud mentioned, there is a 5 sec or so delay. This is certainly good enough, though if I am going to get my wife to truly use this solution i’ll need to get it closer to real time.

So I was able to use docker to restream to a local RTMP server but it only serves one video feed. @yweiss HB solution serves the streams in a web browser on top of each other and lets you click on the individual web streams with different camera id’s. The local server option as currently written authorizes both streams but only provides one stream, and I think pushes the first camera authorized into that local stream.

I am not an engineer or anything close, so i dont know how to create a command to differentiate the two cameras and split them into different streams. Or am i missing a way to see both streams in one feed? Any thoughts?

Here is what i wrote, which ran fine:

docker run --rm \
  -e [email protected] \
  -e NANIT_PASSWORD=YYYYY \
  -e NANIT_REMOTE_STREAM_ENABLED=false \
  -e NANIT_HTTP_ENABLED=false \
  -e NANIT_LOCAL_STREAM_ENABLED=true \
  -e NANIT_LOCAL_STREAM_PUSH_TARGET=rtmp://myip:1935/live \
  registry.gitlab.com/adam.stanek/nanit:v0-4

And here is what executed:

INF Authorized token=31fb****************************************216e
INF Connecting to websocket url=wss://api.nanit.com/focus/cameras/CAMONEID/user_connect
INF Connecting to websocket url=wss://api.nanit.com/focus/cameras/CAMTWOID/user_connect
INF Connected to websocket url=wss://api.nanit.com/focus/cameras/CAMTWOID/user_connect
INF Connected to websocket url=wss://api.nanit.com/focus/cameras/CAMONEID/user_connect
INF Requesting local streaming target=rtmp://MYIP:1935/live
INF Requesting local streaming target=rtmp://MYIP:1935/live

Again, cant tell you all how helpful this is.

Yes, it makes sense. I only have one cam, so I haven’t really tested that. It is easy to fix though. I will try to include the fix in the upcoming release.

The sensors readout is currently included in the dev branch. You can try it out.

Guys, I am really surprised by your attitude towards docker. Sorry, I have no intention distribute the project by other means or writing a native HB plugin. It is easy to build the binaries for your platform if you want to stick to docker-less setup, but I would strongly advice against that.

Now follows little bit of sleepless rant, but otherwise kindly meant advice (feel free to ignore):

Containerized applications are currently a standard way of delivering service-like applications. Like it or not, it is where the industry has been going for several years. I know that the initial barrier might seem off-putting, but it is really not that bad. More importantly you will learn it once and then you are going to apply it the same way for thousands of other services without having to care about their own setup quirks and dependencies. There is a huge number of approachable resources. Christmas time is ideal to learn something new.

I would also strongly recommend to run your HB/HASS containarized. I am still merely starting out with them, but the more I am getting to know them the more I am convinced I don’t want them anywhere near my other stuff. HB achieves that ease of use by blindly downloading and executing the code from internet without any verification what so ever. That code is usually hacked together by enthusiasts with more concern to have it working somehow than making it secure. Without docker, this is going to be run as a common user of your system (or root at worst) unless you have put some security means in place. Docker, however imperfect it might be, at least puts some barriers around it.

Now if I circle back to my project, I tried to do my best to write it as a production ready application. But if, by any chance, I made a mistake somewhere, the worst thing that can happen is that somebody can gain access to the camera. If there is a mistake in 1 package of the undockerized HB (or any of its thousands of dependencies), somebody can probably gain access to your whole system.

I don’t know your setup, but chances are that if you are self-hosting home automation solution, you are probably self hosting other stuff too. However it might not be comparable to the production deployments, the data in home setups might be even more precious. Taking into account for example all the family photos which goes 20 years back…

Anyway, just wanted to share some thoughts. I only touched the security concerns, but docker has much more pros (and cons of course).

Hope it finds you well.

2 Likes