twrecked / hass-aarlo

Asynchronous Arlo Component for Home Assistant
GNU Lesser General Public License v3.0
385 stars 78 forks source link

/api/camera_proxy_stream returns last recorded video instead of live stream #400

Open christiaaneggink opened 3 years ago

christiaaneggink commented 3 years ago

Hi @twrecked,

Before diving into my issue, I wanted to thank you for the time and effort you put into hass-aarlo!

In the end, I am keen to record my live Arlo Ultra camera feeds using a NVR solution, e.g. Synology Surveillance Station. Since we cannot access the Arlo camera streams directly, piping them through Home Assistant with the hass-aarlo integration, with the added flexibilities of automations etc, makes sense for my use case.

To access camera streams from Home Assistant externally, I am piping request for the streams through a simple proxy server (Node JS) to add a long lived token to the request header, as described here. To test whether this works, I used a TP-Link camera and a Raspberry Pi camera, both integrated in Home Assistant. Both streams could be accessed successfully through the proxy server.

ISSUE: For my Arlo cameras, using your integration, I noticed that /api/camera_proxy_stream returns the last recorded video instead of live stream. Is there a way to access the stream (recognising the stream currently times out and you are working on an always 'on' stream) through a Home Assistant API?

Thanks!

twrecked commented 3 years ago

The /api/camera_proxy_stream is the way it is because I never changed it when I forked the original arlo project. I can add an option to make that return a live stream instead.

And we can access the streams directly. The problem here is getting the URL back to your code. What can you access from the NodeJS server? Can you access component states or make web service calls?

christiaaneggink commented 3 years ago

The /api/camera_proxy_stream is the way it is because I never changed it when I forked the original arlo project. I can add an option to make that return a live stream instead.

That would be great! Home Assistant (hass-aarlo) would then basically act as a middle man to handle authentication with Arlo and pass on the camera streams.

And we can access the streams directly. The problem here is getting the URL back to your code. What can you access from the NodeJS server? Can you access component states or make web service calls?

In principle, you can get component states calling /api/states/camera.aarlo_my_camera, which will return a JSON with state information. You could pass the URL this way. Not sure how I would subsequently feed the stream from this URL to e.g. Synology Surveillance Station. The URL likely contains authentication data and changes every time a stream times out, correct?