Arlo: replacement pyarlo module

I have two arlo pro 2 cameras, both exhibiting the issue.

@opentekhead It’s working for me. I thought the template might be the issue but that’s fine.

We can make sure the file write is working. First thing, configure the directory whitelist and turn on more debug:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  ... add the following after your config...
  whitelist_external_dirs:
    - /config

logger:
  default: info
  logs:
    pyaarlo: debug
    custom_components.aarlo.camera: debug

Modify your automation to write to /config:

  action:
  - service: aarlo.camera_request_snapshot_to_file
    data_template:
      entity_id: camera.aarlo_driveway
      filename: /config/driveway_snapshot.jpg

Trigger the animation and look in the directory, do you see the file appear? If you don’t there should be more debug for me to look at!

Thanks for the quick reply. I loaded up the changes requests and triggered the automation from HA.

2020-04-27 21:53:35 DEBUG (ArloBackgroundWorker) [pyaarlo] fast refresh
2020-04-27 21:53:35 DEBUG (ArloBackgroundWorker) [pyaarlo] day testing with 2020-04-27!
2020-04-27 21:53:54 INFO (MainThread) [homeassistant.components.automation] Executing [Arlo] Driveway Snapshot
2020-04-27 21:53:54 INFO (MainThread) [homeassistant.components.automation] [Arlo] Driveway Snapshot: Running script
2020-04-27 21:53:54 INFO (MainThread) [homeassistant.components.automation] [Arlo] Driveway Snapshot: Executing step call service
2020-04-27 21:53:54 INFO (MainThread) [custom_components.aarlo.camera] camera_request_snapshot_to_file service called
2020-04-27 21:53:54 INFO (MainThread) [custom_components.aarlo.camera] camera.aarlo_driveway snapshot(filename=Template("/config/driveway_snapshot.jpg"))
2020-04-27 21:53:54 DEBUG (SyncWorker_19) [pyaarlo] idle snapshot
2020-04-27 21:53:54 DEBUG (SyncWorker_19) [pyaarlo] handle dodgy cameras
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] sending cameras/52M17B7WAE13E to 52M17B7WAE13E
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] Driveway CAMERA got one cameras/52M17B7WAE13E
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] set:ArloCamera/52M17B7WAE13E/activityState=fullFrameSnapshot
2020-04-27 21:53:55 DEBUG (ArloEventStream) [custom_components.aarlo.camera] callback:Driveway:activityState:fullFrameSnapshot
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] sending cameras/52M17B7WAE13E to 52M17B7WAE13E
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] Driveway CAMERA got one cameras/52M17B7WAE13E
2020-04-27 21:53:55 DEBUG (ArloEventStream) [pyaarlo] set:ArloCamera/52M17B7WAE13E/activityState=fullFrameSnapshot
2020-04-27 21:53:55 DEBUG (ArloEventStream) [custom_components.aarlo.camera] callback:Driveway:activityState:fullFrameSnapshot
2020-04-27 21:53:58 DEBUG (ArloEventStream) [pyaarlo] sending cameras/52M17B7WAE13E to 52M17B7WAE13E
2020-04-27 21:53:58 DEBUG (ArloEventStream) [pyaarlo] Driveway CAMERA got one cameras/52M17B7WAE13E
2020-04-27 21:53:58 DEBUG (ArloEventStream) [pyaarlo] set:ArloCamera/52M17B7WAE13E/activityState=idle
2020-04-27 21:53:58 DEBUG (ArloEventStream) [custom_components.aarlo.camera] callback:Driveway:activityState:idle
2020-04-27 21:54:00 DEBUG (ArloEventStream) [pyaarlo] sending cameras/52M17B7WAE13E to 52M17B7WAE13E
2020-04-27 21:54:00 DEBUG (ArloEventStream) [pyaarlo] Driveway CAMERA got one cameras/52M17B7WAE13E
2020-04-27 21:54:00 DEBUG (ArloEventStream) [pyaarlo] queing snapshot update
2020-04-27 21:54:00 DEBUG (ArloEventStream) [pyaarlo] set:ArloCamera/52M17B7WAE13E/presignedFullFrameSnapshotUrl=https://arlos3-prod-z
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [pyaarlo] getting image for Driveway
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloCamera/52M17B7WAE13E/lastImageSource=snapshot/04-27 21:54
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloCamera/52M17B7WAE13E/presignedLastImageData=b'\xff\xd8\xff\xe0\x00\x10JF
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [custom_components.aarlo.camera] callback:Driveway:presignedLastImageData:b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00\x00\x00\x00\x00\x00\xff\xdb\x
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [pyaarlo] our snapshot finished, signal real state
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloCamera/52M17B7WAE13E/activityState=idle
2020-04-27 21:54:00 DEBUG (ArloBackgroundWorker) [custom_components.aarlo.camera] callback:Driveway:activityState:idle
2020-04-27 21:54:00 INFO (MainThread) [homeassistant.components.automation] Executing [Arlo] Notify Driveway Motion
2020-04-27 21:54:00 INFO (MainThread) [homeassistant.components.automation] [Arlo] Notify Driveway Motion: Running script
2020-04-27 21:54:00 INFO (MainThread) [homeassistant.components.automation] [Arlo] Notify Driveway Motion: Executing step delay 0:00:10
2020-04-27 21:54:11 INFO (MainThread) [homeassistant.components.automation] [Arlo] Notify Driveway Motion: Executing step call service
2020-04-27 21:54:11 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for John: 1 sent, 150 allowed, 0 errors, resets in 22:05:48

it created the file but it doesn’t appear to be current photo. I tested walking in front of the camera to confirm that it wasn’t current, unfortunately the image did not update.

What does the entity picture give you? Look for the entity_picture url against the camera state. Paste that onto the back of your home assistant URL. It will look something like this (with a longer token):

http://your-url-here/api/camera_proxy/camera.aarlo_front_door_camera?token=XXXXX

Also; you can use this URL instead of saving a snapshot if you want. It’s always the last image - either from motion or snapshot.

I’m running a couple more tests. With executing the script appears to be updating the snapshot successfully. I moved the file to /config/www/driveway_snapshot.jpg and it seems to be refreshing correctly. Not sure the exact mix. I’ll toy with some more scenarios and see if I can pin it down. Thanks for the help. I’ll see what I can do with the camera URL as well to see if that simplifies anything.

I also have the integration working but I can’t get the custom aarlo card working. I installed it via HACS but the Lovelace UI does not recognize a card type of custom:aarlog-glance. I verified that the resource is configured in the lovelace configuration.

@richmon.schumann It’s type: 'custom:aarlo-glance', only the one g.

And if it’s not the typo, how did you install it?

I installed aarlo and aarlo lovelace from HACS. I was working on this all morning but now it is working just fine. I am sure it was a typo or @sherrell can intimidate my technlogy.

Is there a way when you click on the image to play the live feed and not the last recorded?

The GUI can cache things so sometimes you need to refresh a few times.

Add the following to your card config to start a stream.

image_click: play

Unfortunately it seems when I trigger the automation from HA it takes the snapshot but when actual motion occurs it doesn’t return the current snapshot. I tried using the URL but I can’t test that it’s functioning as I get a 401 unauthorized response. I setup a long access token for it but no success. I tried enabling api: in the config but that didn’t make any difference.

Should I be able to directly access the camera_proxy URL in a browser or doesn’t only work when it’s sent as a notification?

Do I need to add the api: into my configuration.yaml, does it need to be under the http: section?

Thanks again for the help.

@ sherrell Prior warning with 0.110 release pending

2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify AarloSwitch to extend SwitchEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify AarloSirenBaseSwitch to extend SwitchEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify AarloSirenSwitch to extend SwitchEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify AarloAllSirensSwitch to extend SwitchEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.switch] SwitchDevice is deprecated, modify AarloSnapshotSwitch to extend SwitchEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.alarm_control_panel] AlarmControlPanel is deprecated, modify ArloBaseStation to extend AlarmControlPanelEntity
2020-05-15 19:33:36 WARNING (MainThread) [homeassistant.components.binary_sensor] BinarySensorDevice is deprecated, modify ArloBinarySensor to extend BinarySensorEntity

Thanks for the heads up.

@sherrell, I created a new issue for this on GitHub. It looks like for now this is just a warning.

As far as I’m aware you should be able to access the URL from anywhere. Just right-click on the camera image and copy the link and do:

wget "url-you-copied"

on a remote machine and it should work. Or paste it into an anonymous browser tab.

I’ve tried to achieve the same thing and am now stuck with the exact same problem: Old images delivered when motion occurs

Any updates on your side on this?

Unfortunately same issue. I was just thinking today maybe this is related to having the Local storage option enabled in Arlo? Do you have That enabled as well? I was planning on disabling and seeing if that makes a difference. I’m attaching my config in Arlo.

Seems not to cause the issue for me at least, since I have no USB device connected and this setting is therefore disabled in my setup.

@opentekhead @ParUnicycle
Can you paste the automation, I can try it here.

What mechanism are you using to retrieve the image?

I’ve tried two different methods. First I tried with the automation example on github https://github.com/twrecked/hass-aarlo/blob/master/README.md#advanced-automations but did not have any success. I then switched it up to another example I saw in the forums. Tensorflow, Arlo, Docker - Automate a secure(ish) home

I’ve turned off the local storage option with no success as well.

I have some blink cameras and I was able to get that to send the latest video.

I’ve also tested using dynamic content iOS notifications where I include the camera entity. That seemed to work once or twice then failed. The image in Lovelace is correct sometimes but I find it hangs within a day or so. The other challenge with the camera dynamic content is it only shows the latest image, if I had multiple notifications it does seem to show the history through the notifications.

I was planning testing send the camera_proxy URL however I get struggle with the wrong token and getting forbidden. Is there a way to send the camera URL attribute instead of typing it in? I believe I read that the token for camera proxy expires. I’ve tried a long lasting token but couldn’t get that to work by just adding it to the camera_proxy URL.

Mine looks like this - also mostly taken from samples and added a 3sec delay before sending the image to a telegram chat. I’ve already tried extending the delays without success

- id: automation-0100
  alias: Camera Snapshot
  trigger:
  - entity_id: camera.aarlo_entrance
    for: 00:00:03
    from: 'idle'
    platform: state
    to: 'recording'
  - entity_id: camera.aarlo_entrance
    for: 00:00:03
    from: 'recently active'
    platform: state
    to: 'recording'
  condition:
  - condition: device
    device_id: c1c079655a8e4d3a86c46b976a0
    domain: binary_sensor
    entity_id: binary_sensor.entrance_door
  action:
  - data_template:
      entity_id: "{{ trigger.entity_id }}"
    service: camera.aarlo_request_snapshot
  - delay: 00:00:03
  - data:
      data:
        photo:
        - capture: Snapshot
          file: /config/www/cameras/frontdoor/frontdoor_snapshot.jpg
      message: Movement detected
      title: Front Door
    service: notify.notify_group```

@sherrell started noticing an issue today with my state not updating in Home-assistant and my set mode command not working sometimes. I get the following log message

## Log Details (WARNING)

Logger: pyaarlo
Source: custom_components/aarlo/pyaarlo/__init__.py:273
First occurred: June 3, 2020, 9:50:30 PM (265 occurrences)
Last logged: 12:32:29 PM

* general exception HTTPSConnectionPool(host='my.arlo.com', port=443): Read timed out. (read timeout=120.0)
* attempt 1: error in response when setting mode={'data': {'error': 'AUTO-5010', 'message': "Device doesn't belong to the User", 'reason': "XXXXXXXXXXXXX doesn't belong to the User / Is not provisioned"}, 'success': False}

The “XXXXXXXXXXXXX” is my base station serial number. I logged in with the same user that I am using in Home-assistant with aarlo (not the primary user on the account) and I can’t see the base station in the list of devices. Could that have something to do with it? Did arlo change something?

As a note I am also seeing this in the standalone pyaarlo. It looks like it works fine with my primary user account, but the seconday account looks to not be working correctly. The first disarm call always seems to fail, but any arm/disarms after that work fine. However, I am not getting notifications back in a timely manner that the mode successfully changed.