Arlo: replacement pyarlo module


Here you are

And the log:

Log Details (ERROR)
Mon Feb 18 2019 21:28:46 GMT+0100 (Centraleuropæisk normaltid)
Error handling message: {'type': 'call_service', 'domain': 'camera', 'service': 'aarlo_request_snapshot', 'service_data': {'entity_id': 'camera.aarlo_kitchen'}, 'id': 27}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1130, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1152, in _execute_service
    await handler.func(service_call)
  File "/config/custom_components/aarlo/camera.py", line 72, in service_handler
    target_device.take_snapshot()
  File "/config/custom_components/aarlo/camera.py", line 241, in take_snapshot
    self._camera.take_snapshot()
  File "/config/custom_components/aarlo/pyaarlo/camera.py", line 240, in take_snapshot
    self._arlo._bg.run( self._arlo._be.post,url=SNAPSHOT_URL,params=body,headers={ "xcloudId":self.base_station.xcloud_id } )
AttributeError: 'NoneType' object has no attribute 'xcloud_id'

Damn, the Alro Q cameras don’t have base stations so no xcloud_id… I’ll fix that.

1 Like

@Vennerberg
I just noticed the ‘FFmpeg isn’t running’ message on my docker image. A bit of poking around and I found out the ffmpeg binary in the docker image doesn’t support the rtsps protocol - it stops with a ‘operation not allowed’ error - it support rtsp fine.

As far as I can tell Arlo doesn’t support live streams, clicking on the image would get you the newest library video and ffmpeg only had to convert from mp4 to mjpeg and that worked fine. In Aarlo (notice the double A) the custom card I wrote streams the library videos directly from the Arlo cloud so I can use a <video> tag and things just seems to work better. I’m trying to get live streams going and I ran straight into the error you are seeing. I was testing inside a docker image and once I ran home assistant in a Python virtualenv I could get the live streams to appear.

I think the ffmpeg in the docker and, I presume, inside hass.io needs building to support rtsps. I tried running the docker image as privileged but it made no difference.

1 Like

@onkelfarmor I just merged some tidy up code into the master, one piece was a possible fix to your snapshot issue, let me know if it works.

If anybody else upgrades the code now uses the new home assistant file structure so you’ll need to remove the old files - there is a shell script called remove_old that will help.

just did the upgrade - so far looking better - can arm now and Baby shows sensor activity for sound - just humidity, temp and air quality showing unknown …

I’m pretty new to working with Arlo since I could never get the arlo component to work. aarlo is working very well.

When I request a snapshot from the service dev tool, I see that the image in the aarlo glance card updates. If the snapshot otherwise stored/accessible somewhere?

I updated at snapshot now works. But I don’t see that the picture updates. I don’t see any pictures in the Arlo app, so I think it must make a video?

I still experience that the Aarlo component “dies” and stops working but the Arlo component continue to work. See log underneath.

Moreover motionsensor don’t have any motion at all.

Log Details (ERROR)
Tue Feb 19 2019 19:53:39 GMT+0100 (Centraleuropæisk normaltid)
Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/real_ip.py", line 34, in real_ip_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/ban.py", line 67, in ban_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/auth.py", line 99, in auth_middleware
    return await handler(request)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/http/view.py", line 118, in handle
    result = await result
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 407, in get
    return await self.handle(request, camera)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/camera/__init__.py", line 443, in handle
    return await camera.handle_async_mjpeg_stream(request)
  File "/config/custom_components/aarlo/camera.py", line 148, in handle_async_mjpeg_stream
    await stream.close()
  File "/usr/local/lib/python3.6/site-packages/haffmpeg/core.py", line 133, in close
    await self._proc.communicate(input=b'q')
  File "/usr/local/lib/python3.6/asyncio/subprocess.py", line 195, in communicate
    loop=self._loop)
  File "/usr/local/lib/python3.6/asyncio/subprocess.py", line 143, in _feed_stdin
    self.stdin.write(input)
  File "/usr/local/lib/python3.6/asyncio/streams.py", line 300, in write
    self._transport.write(data)
  File "uvloop/handles/stream.pyx", line 671, in uvloop.loop.UVStream.write
  File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_alive
RuntimeError: unable to perform operation on <WriteUnixTransport closed=True reading=False 0x72a87688>; the handler is closed

@ronschaeffer You can retrieve it from the camera_image method of the camera class. That will always return the latest image generated either from a manually snapshot or from motion activity detected by the camera. You can see it in either the aarlo-glance card or the standard picture-entity card. Any where the camera image can be shown.

@onkelfarmor Firstly, I’ve found a Q camera locally so hopefully I can pick it up later this week and work out what is going wrong for you.

But in the meantime… are you ever seeing an image in the picture entity card or custom:aarlo-glance card? One should appear as soon as you enter the camera name as the entity in the configuration. Snapshot shouldn’t make a video - there is a different snapshot call I can use when a video is streaming - but I haven’t got that set up yet.

I think the back trace is from trying to stream the last recorded video using a standard picture-entity card and it looks like ffmpeg dies? Did you add the ffmpeg extra options? That might be the problem in this case.

camera:
  - platform: aarlo
    ffmpeg_arguments: '-pred 1 -q:v 2'

Does the streaming of the last video work in the curstom:aarlo-glance card? You just click the image and it talks directly to the Arlo servers, bypassing the calls to ffmpeg and the home assistant server.

Got it. Thanks!

This looks really good! Thanks for your effort, can’t wait to be able to test it. Can this be installed on Hassio?

It should work but I’ve never tried it. I think you will have to export your /config directory using samba, mount it on another machine and then follow the installation instructions in the README on github to install to that mounted directory.

I’ll look into this some more tonight.

1 Like

It works well on hassio all i did is to copy manually the folder and files via Samba thanks for that great integration

1 Like

I did the same right now and it works great! Thanks for you hard work @sherrell This is really good news for everybody using Arlo!

Why dont you do a PR on existing Arlo module to update it?

Is it possible to start and stop a recording with this component?

@Vennerberg That’s an option. I chose to give it a different name so during testing I (or people) could run the old and new side-by-side. I have to work out how best to get it included this week.

@Stimo Not yet. It’s on the to-do list, along with live streaming. For now I’m concentrating on getting the functionality identical to the old Arlo module.

Maybe I’m late to the party but i had a similar problem,
i changed to

alarm_control_panel:

  • platform: aarlo
    home_mode_name: Home
    away_mode_name: Away

In this case i could only arm “home” and not away.

But when i switched to exactly what you have in your example:

alarm_control_panel:

  • platform: aarlo
    name: Arlo
    home_mode_name: Home
    away_mode_name: armed

It works :stuck_out_tongue:

this works for me

alarm_control_panel:

  • platform: aarlo
    home_mode_name: home
    away_mode_name: armed

so lowercase …

@Pliind @r4nd0m I’m going to check in a fix that ignores case completely. I blame Arlo for this one - it shows one thing on web page and uses another thing behind the scenes!!

Thanks for the answer! For me everything works flawless!