indiefan / home_assistant_nanit

Docker container for mirroring nanit feed suitable for Home Assistant integration
63 stars 12 forks source link

Unable to get past WRN No stream publisher registered yet, closing subscriber stream #20

Open dudenell opened 5 days ago

dudenell commented 5 days ago

Not sure what's wrong, ip address of camera is correct, I can ping the camera from the docker instance. Everything in the debug log says it's working up until a remote connection is requested over port 1935, happens with both frigate, home assistant, and vlc media player. The IP I'm trying to connect to is the docker instances as a FYI.

24 Nov 24 02:39 UTC INF Application started
24 Nov 24 02:39 UTC INF No .env file found. Using only environment variables path=/app/.env
24 Nov 24 02:39 UTC INF Setting log level to trace
24 Nov 24 02:39 UTC INF Loaded app session from the file filename=/data/session.json
24 Nov 24 02:39 UTC INF Authorized token=eyJ0*******************************************************************************************************************************************************************************************************************************************************************ikCA
24 Nov 24 02:39 UTC INF Retreived refresh_token=48e1****************************************9ed6
24 Nov 24 02:39 UTC TRC Storing app session to the file filename=/data/session.json
24 Nov 24 02:39 UTC TRC Starting attempt runner=websocket-N301AKN20521WT try=1
24 Nov 24 02:39 UTC TRC Connecting to websocket
24 Nov 24 02:39 UTC INF RTMP server started addr=:1935
24 Nov 24 02:39 UTC INF Connected to websocket url=wss://api.nanit.com/focus/cameras/N301AKN20521WT/user_connect
24 Nov 24 02:39 UTC DBG Baby state updated baby_uid=xxxxxxxx is_websocket_alive=true
24 Nov 24 02:39 UTC TRC Notifying websocket ready handlers num_handlers=2
24 Nov 24 02:39 UTC DBG Sending message data="type:REQUEST  request:{id:1  type:GET_SENSOR_DATA  getSensorData:{all:true}}"
24 Nov 24 02:39 UTC TRC Sending data rawdata="\b\x01\x12\b\b\x01\x10\fb\x02\b\x01"
24 Nov 24 02:39 UTC INF Requesting local streaming target=rtmp://10.0.11.64:1935/local/xxxxxxxx
24 Nov 24 02:39 UTC DBG Sending message data="type:REQUEST  request:{id:2  type:PUT_STREAMING  streaming:{id:MOBILE  status:STARTED  rtmpUrl:\"rtmp://10.0.11.64:1935/local/xxxxxxxx\"  attempts:1}}"
24 Nov 24 02:39 UTC TRC Sending data rawdata="\b\x01\x123\b\x02\x10\x02\"-\b\x02\x10\x00\x1a%rtmp://10.0.11.64:1935/local/xxxxxxxx \x01"
24 Nov 24 02:39 UTC DBG Received message data="type:RESPONSE  response:{requestId:1  requestType:GET_SENSOR_DATA  statusCode:200  sensorData:{sensorType:TEMPERATURE  isAlert:false  timestamp:9185  valueMilli:18893  value:19  7:1732415998094}  sensorData:{sensorType:HUMIDITY  isAlert:false  timestamp:9185  valueMilli:54000  value:54  7:1732415998094}  sensorData:{sensorType:LIGHT  isAlert:false  timestamp:9185  valueMilli:228000  value:228  7:1732415998102}  sensorData:{sensorType:NIGHT  isAlert:true  timestamp:9185  value:1  7:1732415998102}}"
24 Nov 24 02:39 UTC DBG Baby state updated baby_uid=xxxxxxxx humidity=54 is_night=true temperature=18.893
24 Nov 24 02:39 UTC DBG Received message data="type:RESPONSE  response:{requestId:2  requestType:PUT_STREAMING  statusCode:200  7:\"\\x08\\x02\\x10\\x00\\x1a$rtmps://136.61.0.205:48874/nanit/p2p\"}"
24 Nov 24 02:39 UTC INF Local streaming successfully requested
24 Nov 24 02:39 UTC DBG Baby state updated baby_uid=xxxxxxxx stream_request_state=1
24 Nov 24 02:40 UTC DBG Received message data="type:REQUEST  request:{id:569  type:PUT_SENSOR_DATA  sensorData:{sensorType:TEMPERATURE  isAlert:false  timestamp:9198  valueMilli:18893  value:19  7:1732416011013}}"
24 Nov 24 02:40 UTC DBG Received message data="type:REQUEST  request:{id:570  type:PUT_SENSOR_DATA  sensorData:{sensorType:HUMIDITY  isAlert:false  timestamp:9198  valueMilli:54000  value:54  7:1732416011041}}"
24 Nov 24 02:40 UTC DBG New stream subscriber connected baby_uid=xxxxxxxx client_addr=10.0.10.67:35532
24 Nov 24 02:40 UTC WRN No stream publisher registered yet, closing subscriber stream baby_uid=xxxxxxxx client_addr=10.0.10.67:35532
24 Nov 24 02:40 UTC TRC Sending message data=type:KEEPALIVE
24 Nov 24 02:40 UTC TRC Sending data rawdata="\b\x00"
dudenell commented 4 days ago

Finally figured it out... The ip address in the RTMP in the docker compose configuration should be that of the docker instance, not the nanit camera. Also the port can be changed if you have another service running on 1935 (frigate in my case).

dudenell commented 4 days ago

New to github, created a pull request here: https://github.com/indiefan/home_assistant_nanit/pull/21