Arlo: replacement pyarlo module

From memory the Arlo Pros do support sound activation - I have the binary sensor (sound) configured, but do not use sound activation as I have disabled the feature in the arlo app.
As soon as I try add your card (without even saving it) the log starts to fill up with the frontend errors.

My environment is Ubuntu 18 running a VE. Lovelace is in storage mode.

I did not run the script process as part of your install, just the manual copy process, component config and resource config

2019-02-12 11:12:32 WARNING (SyncWorker_2) [pyaarlo] file not read

2019-02-12 11:12:40 WARNING (ArloBackgroundWorker) [pyaarlo] file not written

2019-02-12 11:15:27 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:27 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:27 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:28 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:28 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:28 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:28 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:28 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:29 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:29 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:29 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:29 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:29 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘attributes’ of undefined
2019-02-12 11:15:30 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘attributes’ of undefined
2019-02-12 11:15:30 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘attributes’ of undefined
2019-02-12 11:15:31 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:31 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:31 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:31 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-12 11:15:32 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property

Sorry, I figured out what the problem was. I didn’t setup the sensor configuration properly with all the sensors for battery, etc. Now it is working as expected.

I would be awesome if you could add a feature to turn on/off specific cameras. I would love to be able to activate specific cameras when a certain window is open.

Thanks again for your efforts!

@sherrell This looks very similar to my suggestion here:

I am glad that somebody is having a go at an event driven component!

@danielhitch

I swear I searched for Arlo related posts but never came across yours, sorry.

But I feel exactly the same way about the old implementation as you do, hence my attempt here. The new implementation is completely event driven - events arrive, local storage gets updated, events get fired into home-assistant for the appropriate component and the calls from home-assistant get handled asynchronously so nothing is every hanging around waiting.

Now I’ve got to fill in a few missing pieces - the Baby Arlo being the biggie.

1 Like

@grantc

I think your camera name is wrong - and this my fault for not following the home-assistant conventions. You have to use the name without the camera.aarlo_ prefix. For my front door camera, appearing as camera.aarlo_front_door_camera in the State page the card entry looks like:

camera: front_door_camera
name: Front Door
show:
  - motion
  - sound
  - battery
  - signal_strength
  - captured
type: 'custom:aarlo-glance'

I will move to a more standard entity key in an update.

I just noticed you’re using a virtualenv so I know why you’re seeing the file not written errors. I’ll fix that too.

1 Like

@sherrell , no worries at all! I read your original post and saw that you had combed through PyArlo, but wanted to make sure you were aware of jeffreywalter’s module as well. I’m glad you were able merge bits of them together - this is what I had been hoping for all along. I have replaced my Arlo component setup with yours, and I am thoroughly impressed - outstanding work! No issues so far. Having external changes reflected in Home Assistant entity states in real-time is huge! I’ll be able to get rid of my laggy IFTTT automations based on Arlo motion now :slight_smile:. Thanks for your work!

@jwillaz, no problems and glad it’s working for you!

Hi Sherrell,

Thanks for your patience - finally some success. I assume live streaming is still on your “to-do” list?

Thanks again.

@ffm777
I just update the code with on/off support. Turning the camera off shows the ‘broken image’ place holder on the aarlo-glance card, I’ll take a look at why that is.

@grantc
Yes, live streaming is on my list. It’s more complicated than showing the last recorded video because it uses a flash stream so I need to incorporate some extra code and work out how to embed it.

Also, you can use the following conf_dir item to change where aarlo stores its state to quiet down the can't write message. Just change /config/.aarlo to somewhere you have write permission. This will also save state across restarts.

aarlo:
  username: !secret arlo_username
  password: !secret arlo_password
  conf_dir: /config/.aarlo

Thanks Sherrell, had to remove the conf_dir line as it was causing similar errors to before. The permission on the conf dir appears to have write permisssions, so not sure what it coul be. Removed the line and it appears to be working fine again.

2019-02-13 11:25:22 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined

I tested “camera on” but it actually doesn’t turn on the motion detection. It really doesn’t do anything on my system. What I’m looking for is a way to activate/deactivate the motion detection for specific cameras without switching the mode on the base station. This is because I would like to activate motion detection for one specific camera whenever I open a certain window. Once I close the window, the motion detection should be switched off again. There is a service called “camera.enable_motion_detection”, but this is not working on my system.

What I also noticed is that I’m not able to replay the last recorded clip on iOS devices. Is that normal? Playback on a PC works just fine.

Thanks again for your great support!

Does the ffmpeg_arguments: ‘-pred 1 -q:v 2’ work for Hass.io?
Or is the “ffmpeg is not running” returned in the log?

On my system it works (Hass.io with HassOS).

@grantc
I don’t believe the 2 are related. The config_dir directive just tells the back end where to store its state, it really shouldn’t affect the front end.

The front end issue is because my custom card wasn’t checking if the camera exists and asking for the state of something that doesn’t exist. You’ll notice it’s still buggy - it only complains about a missing camera every other key press when you’re typing the camera name but I honestly think that’s a lovelace issue because hass is only set 50% of the time. But once the camera name is correct a snapshot will appear.

The latest update should quieten your log down.

@ffm777
iOS: is it better now? As mentioned above front ends aren’t my speciality and I never thought to try it on an iOS device. I’m going to figure a way to add a stop button to the playback but for now it should return to the status icons when playback finishes.

on/off: If you send a camera_off to device and look at it on the Arlo website or app it will tell you it’s disabled. Getting per camera motion is (if my understanding is correct ) more complicated. A work around to your problem is to leave the system Armed but turn the cameras off until you need them. I ran SmartThings like this for a year or two.
A better solution - and one I’m thinking about - is to have a custom mode and change the cameras in this mode as motion_enabled/disabled are called. This breaks the arm/disarm alarm panel but I can’t see a way to turn on an individual camera another way. I suppose I could do the same with the Armed mode…

What I was saying is that there is a problem with ffmpeg in hassio, and has been for a while.

All of you with live streams from Arlo. Are you using something else besides hassio? Hassbian maybe?

Hi Sherrell,

Very weird, apologies for the constant replies.

So I d/loaded the change - commented out the conf_dir line and this is what I now get. If I comment the line, there are no issues with the frontend.

2019-02-14 07:44:38 ERROR (MainThread) [homeassistant.config] Invalid config for [aarlo]: [conf_dir] is an invalid option for [aarlo]. Check: aarlo->aarlo->conf_dir. (See /home/homeassistant/.homeassistant/configuration.yaml, line 69). Please check the docs at https://home-assistant.io/components/aarlo/
2019-02-14 07:44:38 ERROR (MainThread) [homeassistant.setup] Setup failed for aarlo: Invalid config.
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of alarm_control_panel.aarlo. Setup failed for dependencies: aarlo
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform alarm_control_panel.aarlo: Could not set up all dependencies.
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of sensor.aarlo. Setup failed for dependencies: aarlo
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.aarlo: Could not set up all dependencies.
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of binary_sensor.aarlo. Setup failed for dependencies: aarlo
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform binary_sensor.aarlo: Could not set up all dependencies.
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of camera.aarlo. Setup failed for dependencies: aarlo
2019-02-14 07:44:39 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform camera.aarlo: Could not set up all dependencies.
ad property ‘state’ of undefined
2019-02-14 07:45:14 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-14 07:45:14 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-14 07:45:14 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-14 07:45:14 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property ‘state’ of undefined
2019-02-14 07:45:14 ERROR (MainThread) [frontend.js.latest.201902030] https://unpkg.com/@polymer/[email protected]/lib/utils/async.js?module:44:11 Uncaught TypeError: Cannot read property

@grantc
No worries about the messages. I made this public because the machines available for me to test with are rather limited.

Looking at that trace I’d say you are using an old version. The [conf_dir] is an invalid option shouldn’t happen with the latest version. Where did you download from? Can you try pulling the latest stuff from git?

@Vennerberg
Funny thing, I could never get the video to play correctly with arlo till I started accessing the arlo videos directly. The video would run fast or be truncated, I figured it was something to with ffmpeg but never looked too deeply into it. I just coped the parameters from the original arlo component.

Might have had a win - pulled the latest updates and removed the conf_dir option and no errors so far. So you know, the “conf_dir” option is still showing in your docs for VE installs. Thanks again.

Just a heads up, 0.88 beta is out - most of the custom components will break as I have just found out.

https://rc--home-assistant-docs.netlify.com/blog/2019/02/13/release-88/

Note for custom component developers: We are moving to a new file structure. Platforms now live embedded in components. Custom platforms will have to be updated to follow this pattern. This is a breaking change in case your custom platform overrides a built-in platform. Rename your custom platform from, ie light/hue.py to hue/light.py .

Great job @sherrell. I could never get the arlo: component to work properly, but this worked first time. I’m looking forward to trying live streaming.

One issue, which is probably just a reflection of my understanding of the alarm control panel:

I’ve used your alarm_control_panel: config from Github. I can disarm the base station using an Alarm Control Panel card, but I can’t arm it.

If I arm or disarm using the Arlo web portal, the status is reflected correctly. If I click Disarm in the alarm control panel, the status is reflected in the web portal. But clicking either Arm Home or Arm Away on the alarm control panel has no effect.

I’ve got Armed, Disarmed, Schedule (unused) and Geofencing (unused) as modes in the Arlo base station settings.