Nanit Baby Monitor Integration

I had a typo in my IP address. Thanks. Just wondering is the latest tag in the registry should point to your latest release (ie. 0.7) or are you pushing intermediary releases for testing? I’m creating an Unraid docker template and just wondering if using latest would be safe.

The latest tag is alias for latest stable release. I use dev tag for testing releases.

You can use latest, but for production setup it is considered best practice to us concrete version tags. Breaking changes can happen between releases (ie. renaming configuration options, dropping the HLS stream, etc.). With version tags, you can be sure that the application will always work with the configuration you used. With latest it might require adjustment from time to time.

nice updates @velky.bloud !!

Can you confirm what the NANIT_RTMP_ADDR variable is for now if there is an integrated RTMP server and port 1935 is mapped?

EDIT: I’m also definitely missing something, but I cant load the variables from the .env file.
it looks (based on the logs the default location is /app/
if I map that, it means I have to have copied the contents of the docker app folder to my host FIRST (as there are a bunch of files needed for running the app, and thus the container fails).
The only way i’ve found to do it is to map /app/data then copy the .env to /app
I can’t change the variable in the .env as its not loaded, so will need to add the environment variable to the docker run command to then get the right location.

I think the .env default location is meant to be /data not /app ?

NANIT_RTMP_ADDR should contain the IP and port on which the cam can reach the application. The streaming is initiated from the camera side, so this is the address it is going to use.

You don’t need to use the .env file. It is primarily meant to be used for development so that you don’t have to pass all that info all the time. On consumer side it is expected you configure the application by passing the environment variables to the container when you create it or in docker-compose for more permanent setup. See https://gitlab.com/adam.stanek/nanit/-/blob/master/docs/docker-compose.md it might give you a hint how to setup that stuff properly.

If you insist on using the .env you would have to mount it as a volume to /app/.env. But it is really not the best way to pass the configuration.

ok good to know - its not actually possible to map -v /my/host/folder:/app as that folder is not empty in the container.
I’ve used the docker variables for now

keep up the good work buddy! this is literally life changing!
I’ve nearly completed my magnetic tablet wall mount with wireless charging. When we settle in for TV time i can grab it off the wall, control the house and keep an eye on the little one!

You can actually create a bind mount to a specific file
ie.
-v /my/host/folder/.env:/app/.env

oh - i wasn’t aware of that, thank you @binarymelon

Ok - I feel like an idiot. I have bene using HA for about 4 months now (and love it). I have it installed on a raspberry Pi 4. I am also about to become a father in about a month and would like to get the Nanit up and figured I could get this to work (I have had success on all my other HA adventures - MQTT, Node Red, Z-Wave, Zigbee, etc).

I see “docker” come up all the time on conversation such as this and for the most part I have not really had to worry about it as I can usually find a guide to install on my raspberry Pi.

Is Docker just the OS (a form of linux) running and the application is Hass.io? I.E. Do I have docker and not even know it?

If so do you have more of a “baby” (pun-some-what intended) step guide to get this up and running? I was able to run the node-red sequence to get my baby-uuid.

If I don’t have docker - what do I need to be doing to address that issue first?

1 Like

Docker is a service that you should install on your PI. It allows you to run and manage containerized applications (like this Nanit streamer app).

First you install docker on your PI. Follow for example https://phoenixnap.com/kb/docker-on-raspberry-pi or similar guide

Then create a docker-compose file somewhere on your PI following this: https://gitlab.com/adam.stanek/nanit/-/blob/master/docs/docker-compose.md

Then you configure your Home assistant as usual, some inspiration can be found here: https://gitlab.com/adam.stanek/nanit/-/blob/master/docs/home-assistant.md

For MQTT you should also have a look here: https://gitlab.com/adam.stanek/nanit/-/blob/master/docs/sensors.md

Thank you! Looks like I have some work to do!

I feel in a similar situation. Know very minimal about docker and looking for some advice(not sure if it’s just the same as your last post or different). I’m running home assistant on a virtual box Linux that I’ve setup. If I run your command of

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

Inside of my terminal in home assistant I’m able to successfully add a camera using the rtmp link and uid that works, but if I reboot the virtual box(not just home assistant which seems to not affect it when I reboot home assistant), the stream goes away until I run that command again. What must I do to have the stream load everytime I reboot the virtual box and also to get the mqtt commands actually being sent? I installed portainer in home assistant and saw that the integration is running until I reboot the virtual box.

Question - when the stream starts via version 7, it starts 6 seconds behind. When I load the RTMP stream, I can click and get up to a one-second delay without issues. Is there some way to configure the RTMP stream to have a buffer of X seconds based on preference?

Thanks!

I’d say your missing a line in there… Try this:

docker run --name=nanit_v7 \
  --restart=unless-stopped \
  -e [email protected] \
  -e NANIT_PASSWORD=XXXXXXXXXXXXXXX \
  -e NANIT_RTMP_ADDR=xxx.xxx.xxx.xxx:1935 \
  -p 1935:1935 \
  registry.gitlab.com/adam.stanek/nanit:v0-7

You currently have “–rm” which causes docker to automatically remove the container when it exits. I personally don’t find it necessary and prefer to set a name for the container.

Cheers!

Ok - Round 2 of BASIC questions…

So I am not doing docker on the raspberry pi. Instead I think it will be easier to get it up and running on my Ubuntu Server. However each step seems like a new mountain to me. I want to make sure I understand the flow here correctly.

Nanit Camera --> RTMP Server --> Home Assistant

To create the Nanit Camera --> RTMP Server I need to do the following:
1.) Install a RTMP server on Ubuntu (looking at some NGINX guides) - not sure how to set this up correctly
2.) Run the setup guide “Docker Compose” from the https://gitlab.com/adam.stanek/nanit to point the camera and tell it where to place the live stream on the RTMP server

To create the RTMP Server --> Home Assistant I need to do the following:
1.) Run the setup guide “Home Assistant” from the https://gitlab.com/adam.stanek/nanit to create the entities within home assistant that point to the RTMP server

What is the Homebridge used for? (I have home bridge up and running on my Ubuntu Server but I have never used it).
What is the Sensor guide used for?

Finally where does the TL;DR go??

docker run --rm
-e [email protected]
-e NANIT_PASSWORD=XXXXXXXXXXXXX
-e NANIT_RTMP_ADDR=xxx.xxx.xxx.xxx:1935
-p 1935:1935
registry.gitlab.com/adam.stanek/nanit:v0-7

All that data seems to be in the Docker Compose Quick Guide.

You don’t need NGINX anymore. The RTMP serve is now integrated.

Homebridge is off-topic too. You don’t need it. It is an alternative to Home assistant.

The TL;DR you are mentioning is basically what docker-compose does. It is one or another. The command from TL;DR is meant for a quick test run. Docker compose is meant for your permanent setup when you want it to be persistent between restarts, etc.

This is actually happening on the player side. Some players like to buffer for some time before they start to play the stream in order to provide better experience in case of connection interruption (ie. VLC does that). In case of baby monitoring it is pretty much the opposite of you want :frowning:

I use ffplay directly to work around that issue when playing the stream on my desktop, but I have no idea if there is some nobuffer option when it comes to home assistant.

You can test it out by ffplay -fflags nobuffer rtmp://xxx.xxx.xxx.xxx:1935/local/xxxx

There is one possible problem I know about and that is that the integrated server does not re-encode keyframes. It is honestly a very dumb solution. It can cause a bit delay when it comes to initiating stream because the player needs to wait for a keyframe to arrive, but it should never cause any delay during the actual play (once the keyframe arrives you are in sync with the source stream).

1 Like

I just upgraded to the latest version and it is working perfectly.

I have the camera set up in HA and I have set up automations to cast the feed to various TVs based on calls to Alexa. As I type this, I’m working at my desk with a PIP feed from the crib in the lower-left part of the screen. None of this would be available without @velky.bloud’s work. Thank you!

2 Likes

It’s Alive!! I got the Camera working, thank you so much for walking through my dumb questions.

I have docker running in Ubuntu (a local server I have running) then pointing the HA on the RP4 to it.

Now I just need to figure out why the MQTT sensors are not working. I have MQTT installed on the RP4 and working for other devices. The sensors appear as entities (with unknown values). I assume the MQTT commands are going from the Nanit to my Ubuntu Docker then to the RP4? Meaning I need to make sure the Ubuntu machine has MQTT up and running?

Side note for others incase it helps - the docker script was not a fan of a password that contained a “$” or a “+” symbol (not sure which one I change the password and those two symbols changed and it was happy.

You can escape those chars by doubling them up. For example, if your password is secret$123, enter secret$$123

So definitely above and beyond but any help would be fantastic!

I am using Rancher to control my docker environment but I need to setup rules for the necessary ports on how the app works. At present, I only know of port 1935. Based on the below, it looks like it has at least one new port that I wasn’t aware of:

As near as I can tell, the app is using other ports to connect with the camera itself which is on a different network. I can open the necessary ports but just need to know what is required. I opened 29544 and it’s still giving me the “No stream publisher registered yet” error.

Any thoughts on what I could be missing?

Thanks!