Nanit Baby Monitor Integration

i use node-red for my automations (there is a docker palette) - then just use a delay node (with send every hour to trigger)

@jaburges I didnā€™t realize nodered had a docker integration. Thatā€™s a game changer. I appreciate your guidance!

hi! any chance you could share your Node Red flow for restarting the docker container? I find i have to restart the nanit container once every hour or so manually and it would be great to automate this

[{"id":"ad39f89f.c3e3e8","type":"docker-container-actions","z":"649a53f0.e7366c","name":"Restart Nanit","config":"53cf1420.83fa9c","container":"nanit","action":"restart","options":"","x":1714,"y":222,"wires":[[]]},{"id":"3dd4cb7f.b91104","type":"inject","z":"649a53f0.e7366c","name":"every 30 mins","props":[{"p":"payload"}],"repeat":"1800","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":1514.0000457763672,"y":223.0000057220459,"wires":[["ad39f89f.c3e3e8"]]},{"id":"53cf1420.83fa9c","type":"docker-configuration","host":"10.10.10.10","port":"2375"}]

thanks for sharing this! however, i substituted my docker IP, port and container name but keep getting the following error in the debug node:

hereā€™s what my settings look like:

EDIT: I also realised that the port should be 2375 to point to docker.sock but this didnā€™t work either :frowning:

have you allowed access to the docker.sock remotely?
from memory there is an extra line of code you need to add on the host machine. I can find it if you havent already done that

Ahh thatā€™s probably what Iā€™m missing! No idea what it could be. Would appreciate the assist if you could let me know :blush:

sorry, bud. any chance for that line of code? I canā€™t seem to figure it out

edit: /lib/systemd/system/docker.service

ExecStart=/usr/bin/docker daemon -H fd:// -H tcp://0.0.0.0:
sudo systemctl daemon-reload
sudo systemctl restart docker.service
1 Like

thanks! but i actually just ended up using the BigSSH node to just issue a restart docker command over SSH every 30 mins. works like a charm.

Hey everyone, I am so stoked to see this working for yall. I confirmed I am able to stream the cameras through VLC but when I click on the cameras in HomeKit they spin and then say failed to load.

Any ideas? I feel like I am so close!

Ok, so hereā€™s something to keep in mind. Looks like my trick to restart the container once every 30 mins using SSH has resulted in being locked out of the API. Am getting a ā€œconnections above limit errorā€

Anyone know if thereā€™s anything to be done here or am I shit out of luck?


02 Aug 21 05:28 UTC ERR Unable to establish websocket connection error="websocket: bad handshake" url=wss://api.nanit.com/focus/cameras//user_connect

02 Aug 21 05:28 UTC INF Connected to websocket url=wss://api.nanit.com/focus/cameras/xxxxx/user_connect

02 Aug 21 05:28 UTC INF Requesting local streaming target=rtmp://192.168.1.241:1935/local/xxxxx

02 Aug 21 05:28 UTC WRN Failed to request local streaming, awaiting stream health check error="Forbidden: Number of Mobile App connections above limit, declining connection"

02 Aug 21 05:29 UTC INF Authorizing using user credentials [email protected] password=***********

02 Aug 21 05:29 UTC INF Authorized token=fce1****************************************3dc3

02 Aug 21 05:29 UTC ERR Unable to establish websocket connection error="websocket: bad handshake" url=wss://api.nanit.com/focus/cameras//user_connect

Just reduce the frequency that you restart and you should be fine. I have mine restarting every 4 hours (with 2 cameras) and Iā€™ve never run into this issue. You probably just hit a daily or monthly limit.

1 Like

Ah ok. Must be a monthly limit because I waited 48hrs with the container offline and Iā€™m still getting the same error when trying to spin it up. Hopefully it isnā€™t a permanent ban!

Anyone have a walk through or how to get started here?

1 Like

Was it a monthly, I have the exact same problem now :(. Used to work great

Still receiving:
"Forbidden: Number of Mobile App connections above limit, declining connection"
Even after a couple of restarts or stopping the docker for a couple of daysā€¦

How is this suddenly an issue, and am I the only one here?
Please help :D.

p.s: The app is working fine on more than 3 devices, but even when those are closed. It still doesnā€™t work.

Iā€™ve been working on this for hours now and I feel like Iā€™m getting so close but need some help. My Nanit sensors still just say ā€œunknownā€ instead of the actual temperature and humidity readings. Docker logs look good, MQTT logs look good, but Iā€™m missing something. Can anyone help?

Docker:

INF Successfully connected to MQTT broker broker_url=tcp://192.168.1.140:1883
INF Connected to websocket url=wss://api.nanit.com/focus/cameras/N301BKN2118R2V/user_connect
DBG Baby state updated baby_uid=d1ea4bba is_websocket_alive=true
DBG Sending message data="type:REQUEST request:{id:1 type:GET_SENSOR_DATA getSensorData:{all:true}}"
INF Requesting local streaming target=rtmp://192.168.1.191:1935/local/d1ea4bba
DBG Sending message data="type:REQUEST request:{id:2 type:PUT_STREAMING streaming:{id:MOBILE status:STARTED rtmpUrl:\"rtmp://192.168.1.191:1935/local/d1ea4bba\" attempts:1}}"
DBG Received message data="type:RESPONSE response:{requestId:1 requestType:GET_SENSOR_DATA statusCode:200 sensorData:{sensorType:TEMPERATURE isAlert:false timestamp:11627 valueMilli:18041 value:18} sensorData:{sensorType:HUMIDITY isAlert:false timestamp:11627 valueMilli:47298 value:47} sensorData:{sensorType:LIGHT isAlert:false timestamp:11627 valueMilli:357000 value:357} sensorData:{sensorType:NIGHT isAlert:true timestamp:11627 value:0}}"

MQTT HomeAssistant Add-On:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] mosquitto.sh: executing... 
[11:59:36] INFO: Setting up user mqttuser
[11:59:36] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[11:59:37] INFO: Starting NGINX for authentication handling...
[11:59:38] INFO: Starting mosquitto MQTT broker...
1636739978: mosquitto version 1.6.12 starting
1636739978: |-- *** auth-plug: startup
[11:59:38] INFO: Successfully send discovery information to Home Assistant.
[11:59:39] INFO: Successfully send service information to the Supervisor.
1636739978: Config loaded from /etc/mosquitto/mosquitto.conf.
1636739978: Loading plugin: /usr/share/mosquitto/auth-plug.so
1636739978:  ā”œā”€ā”€ Username/password checking enabled.
1636739978:  ā”œā”€ā”€ TLS-PSK checking enabled.
1636739978:  ā””ā”€ā”€ Extended authentication not enabled.
1636739978: Opening ipv4 listen socket on port 1883.
1636739978: Opening ipv6 listen socket on port 1883.
1636739978: Opening websockets listen socket on port 1884.
1636739978: Warning: Mosquitto should not be run as root/administrator.
1636739978: mosquitto version 1.6.12 running
1636740112: New client connected from 192.168.1.191 as Nanit (p2, c0, k30, u'mqttuser').

Hi All,

Iā€™ve tried to read the docs and the thread but Iā€™m a bit confused about using this on tvOS via AirPlay. Is that possible from this docker image? Or do I need an additional docker image to achieve this? Any recommendations if thatā€™s the case? I have RTMP streaming working, just hope to have this on Apple TV.

Thanks so much for the effort on this! Super useful.

Cheers!

1 Like

Hello all,

Iā€™ve tried to make good sense of this but Iā€™m really struggling, is there any walkthrough for a beginner? This is the main reason I am running HA.

2 Likes