Just got this up and running, and it looks great. I wonder, does anyone know if it would be possible to split the audio from the video and provide it as a separate feed? My thought is that if I can do that, then I can push that stream to my Echo devices and use the camera as an audio-only baby monitor as well, rather than having to get an additional device.
@binarymelon did you get this running with unraid? iām getting invalid reference format there as well, not sure where i need to be adding my credentials and IP here. iām probably missing something obvious,
I have a template for it in here.
Camera was down this morning and tried restarting the container - getting 503 and the occasional 500 responses from the server. Docker status constantly Restarting (1). Anyone else having this issue?
14 Nov 22 13:14 UTC INF Authorized token=1edd****************************************7166
14 Nov 22 13:14 UTC INF Fetching babies list
14 Nov 22 13:14 UTC FTL Server responded with unexpected status code code=500
14 Nov 22 13:15 UTC FTL Server responded with unexpected status code code=503
Iām having the same issue.
Edit: It looks like my cameras are āLocal view onlyā in the app right now, so maybe thereās an outage at the moment.
Yeah false alarm, itās back
Just in time for my 2nd. Works ok in Homebridge. Iām running Pi 4 in 5GHz. Any way to make it better?
Speedtest results:
pi@raspberrypi:~ $ speedtest
Speedtest by Ookla
Server: Cox - San Diego - San Diego, CA (id: 16615)
ISP: Spectrum
Idle Latency: 20.07 ms (jitter: 0.97ms, low: 17.96ms, high: 21.20ms)
Download: 82.99 Mbps (data used: 119.9 MB)
498.41 ms (jitter: 78.64ms, low: 24.29ms, high: 1412.19ms)
Upload: 22.77 Mbps (data used: 11.7 MB)
19.38 ms (jitter: 4.68ms, low: 16.66ms, high: 57.13ms)
Packet Loss: 0.0%
Result URL: https://www.speedtest.net/result/c/b1534073-17bd-4374-809f-013d4ee710dc
UPD: What I noticed it starts real smooth and then degrades overtime gaining latency. It seems that restarting the container helps temporarily.
Itās possible to login with MFA as well. Do the normal post call to api.nanit.com/login
but make sure you have the header nanit-api-version: 1
This should return a response with mfa_token
and channel
and trigger the SMS code, take these values and make a post to /login
again with
{
mfa_token: TOKEN_FROM_INITAL_LOGIN
channel: sms
mfa_code: CODE_RECEIVED_IN_SMS
password: YOUR_PASSWPRD
email: YOUR_EMAIL
Poof, now you have your tokens.
I deployed this last night via Portainer on my Synology Nas, but Iāve disabled the video feed and Iām only using the MQTT feed for temp and humidity. It started flowing to my HA immediately and was working great, with both the temp and humidity messages flowing consistently every 1m.
Went to bed soon after and woke up this morning to find the temp sensor still receiving data, but humidity stopped publishing overnight.
Iāve restarted the container twice in the past 30 minutes and both times, temp and humidity both start publishing immediately, but humidity stops after 1-2 messages. I see the drop off in both MQTT Explorer and Mosquito itself.
Anyone else experiencing issues with the humidity sensor?
EDIT: Forgot to addā¦in case thereās a chance that new messages should only be published when Nanit detects a change in humidityā¦Iām watching the app as I type this and Iāve seen the humidity change multiple times between 30 - 34, but no new messages.
Update: It appears that the Humidity topic indeed goes dormant as long as the value doesnāt change (much). I just didnāt realize how consistent the humidity in our sonās room is during the day, when his humidifier is off and the whole house humidifier isnāt running because itās not quite that dry here on the east coast yet. Compare that to overnight, when his humidifier is on and the furnace fan is cycling on every several minutes (no heat, just preventing stale air). The register in his room just happens to blow directly on the Nanit, and so it really picks up that moist air in those moments. You can clearly see that on the graph, which is super interesting:
Red: naptime and overnight; Green: daytime
I also mistakenly thought it was swinging between 30-34 before, when actuallyā¦the Nanit app had simply frozen on my tablet
Does anyone have any insight on how to use refresh_token to refresh the access_token/obtain a new one based on the previous authentication?
Presumably you can, as you do not need to reauthentiate MFA when you are logged in to the app. My one gotcha with getting this to work for me is that because my account is so new it was never an option for me to not use SMS MFA. As such, I POST my login which returns the MFA code, POST another login with the MFA code and the code received in SMS and then then I get the access_token from that response which seems to expire fairly quickly (less than a day.)
For obvious reasons the SMS step is problematic for my HA integration I am working on. Presumably there is an API call for refreshing the token that I donāt see documented here yet.
Answering my own previous question here, thanks to some posters from years back mentioning that they managed to man-in-the-middle the API calls. I decided to learn how to MITM apps, and succeeded in intercepting the refresh token API call.
REQUEST
POST https://api.nanit.com/tokens/refresh
HEADERS:
nanit-api-version: 1
content-type: application/json
authorization: token {{access_token}}
BODY:
{
"refresh_token": "{{refresh_token}}"
}
RESPONSE
{
"access_token": "A new access token",
"refresh_token": "A new refresh token",
"token": "Same as access_token"
}
Using this, after you provide the initial tokens you should now be able to script in refreshing the token so that you do not need an SMS code again. Either proactively every 60 minutes (observed refresh interval by the app) or when it expires (e.g. you receive a āmessageā: ānot authorizedā response from the API) you can make a refresh call to the API and get new tokens.
Has anyone figured out how to post to the API in order to get a token?
I am doing a POST request with my email/password to https://api.nanit.com/login
making sure I pass nanit-api-version:1
on my headers
The only message I get is the following and status is a 401:
{
"message": "Your API version does not support MFA login"
}
I used Postman since Iām already familiar with it, but you should be able to use any tool you want that does HTTP requests. I suspect you are putting nanit-api-version alongside your email/password in the POST params as opposed to in the headers. Postman has two separate tabs for them.
Hereās the full process for getting MFA working if you havenāt see it and you stumble on this thread: Add support for refresh tokens (!2) Ā· Merge requests Ā· Adam StanÄk / Nanit Ā· GitLab. I managed to get it working this afternoon. I think you have to use the dev branch of the docker image, thatās what I did.
So glad I read through this thread, wish I did it a year ago. For the second one Iām moving over to Eufy, to each their own I guess but the Eufy camera supports RTSP out of the box, and quite frankly the subscription fee for the nanit is insulting.
Hi all
Getting error=āwebsocket: bad handshakeā after I authenticate with Nanit.
Seems like Iām communicating successfully with Nanit, but itās dropping out when I attempt to open the video stream.
Thoughts?
Hey everybody,
Just a heads up, I think this docker container will no longer work because of Nanit forcing 2FA on everybodies account. Woke up this morning, turned on 2FA, and now the container is no longer able to verify account creds.
The docker version of this by Adam in this thread is no longer being supported by them. Still looking for a non-docker version of this that just works, especially now with the 2FA being forced. Anyone have ideas?
Does anyone know the API for nanit commands to turn the camera on and off?
I got the https://api.nanit.com/login, and rtmps://media-secured.nanit.com/nanit/{{baby_uid}}.{{access_token}} to work with curl commands, so iām able to login with 2FA and get the video stream but i donāt know how to turn the camera off using the api.
Thanks!
For those facing the impending 2FA problem, the steps defined here have worked brilliantly and only took 20 mins or so to follow.
I just had to update the docker image to use the dev
branch and obtain a refresh token using Postman.