Arlo: replacement pyarlo module

hi all,
about once a day i have to restart ha 0.92.0 - virtualenv b/c the aarlo component stops working. Any help/leads appreciated:

2019-05-03 20:18:30 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for aarlo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-05-03 20:19:41 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of platform nest is taking over 10 seconds.
2019-05-03 20:19:41 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform nest is taking over 10 seconds.
2019-05-03 20:19:41 ERROR (MainThread) [homeassistant.components.binary_sensor] Setup of platform nest is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2019-05-03 20:19:41 ERROR (MainThread) [homeassistant.components.sensor] Setup of platform nest is taking longer than 60 seconds. Startup will proceed without waiting any longer.
2019-05-03 21:18:32 ERROR (MainThread) [homeassistant.components.updater] Got unexpected response: None
2019-05-04 02:54:34 WARNING (MainThread) [homeassistant.components.wemo.switch] Lost connection to Pool Flood Light
2019-05-04 02:54:39 WARNING (Thread-18) [pywemo.ouimeaux_device.api.service] Error communicating with Pool Flood Light, retry 0
2019-05-04 02:56:12 WARNING (MainThread) [homeassistant.components.wemo.switch] Lost connection to Pool Flood Light
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:22:00 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-04 20:44:30 WARNING (MainThread) [homeassistant.components.websocket_api.http.connection.1602516688] Disconnected: Did not receive auth message within 10 seconds
2019-05-04 21:18:32 ERROR (MainThread) [homeassistant.components.updater] Got unexpected response: None
2019-05-05 01:32:22 WARNING (MainThread) [homeassistant.components.wemo.switch] Lost connection to Pool Speakers
2019-05-05 01:32:27 WARNING (Thread-7) [pywemo.ouimeaux_device.api.service] Error communicating with Pool Speakers, retry 0
2019-05-05 21:18:32 ERROR (MainThread) [homeassistant.components.updater] Got unexpected response: None
2019-05-05 23:48:14 WARNING (MainThread) [homeassistant.components.wemo.switch] Lost connection to Pool Speakers
2019-05-06 00:53:56 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558999792] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 00:54:06 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558999792] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 00:57:46 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558999792] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 00:57:47 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558999792] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 00:59:57 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558430864] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 00:59:58 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1558430864] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 395, in websocket_snapshot_image
    'content': base64.b64encode(image).decode('utf-8')
  File "/usr/lib/python3.5/base64.py", line 59, in b64encode
    encoded = binascii.b2a_base64(s)[:-1]
TypeError: a bytes-like object is required, not 'bool'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/homeassistant/.homeassistant/custom_components/aarlo/camera.py", line 399, in websocket_snapshot_image
    except HomeAssistantError:
NameError: name 'HomeAssistantError' is not defined
2019-05-06 01:00:19 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet
2019-05-06 01:00:24 ERROR (stream_worker) [homeassistant.components.stream.worker] Error demuxing stream: No dts in packet
2019-05-06 03:46:06 WARNING (MainThread) [homeassistant.components.wemo.switch] Lost connection to Pool Flood Light
2019-05-06 03:46:11 WARNING (Thread-5) [pywemo.ouimeaux_device.api.service] Error communicating with Pool Flood Light, retry 0
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.
2019-05-06 07:00:04 WARNING (MainThread) [asyncio] socket.send() raised exception.

First of all, Thank you for making this!!
I’m a HA newby, but am enjoying the tinkering. So far the only HA-Arlo interaction I use is arming and dis-arming my Arlo bridge which is connected to 2 cameras. I also (by far) do not understand everything, but I do notice than this custom component is performing much better that the official Arlo component.

The issue I face though, is that I’m not able to arm the bridge into to ‘scheduled’ mode (it’s called ‘Planing’ in my Dutch Arlo app). Here’s a similar issue:

I had the same issue with the official Arlo component. Is this a known issue? Am I doing something wrong?
As a work-around I know that I can also create schedule in HA, but if possible I prefer to set the bridge to scheduled when being home.

@grinch067 That looks like I’m not handling a socket failure correctly. For whatever reason I don’t get the image back and my code just carries on like everything is working great. I’ll take a look into it but is there any chance you can turn on some debug? This in configuration.yaml should be ok:

logger:
    default: info
    logs:
      pyaarlo: debug

Sure, just let it run until I see that issue or another issue? I also, upgraded again to 0.92.4 and the latest aarlo code (as of last night 5/6/2019).

Just let it run until it stops. I won’t need most of the debug but around the time things die you’ll see some message mentioning snapshots - either idle or streaming. These calls are failing and causing me issues.

@Plevuus We don’t support schedules at the moment. I missed the code when I was updating the original arlo component.

I’ll look to add it in. I think I’ll try and make it look like a mode but I’ll have to do some testing to see what’s possible.

1 Like

@Plevuus Are you ok trying a branch? If so, try this one: schedules

The only issue is the name of your schedule might not be what you think it is. Mine is schedule.1 and I can’t find anywhere to change it. You can turn on debug to see the name being returned by Arlo. But, that being said, you should be able to set the mode using the schedule name.

I was trying to find a way to show the mode was being controlled by schedule but I think it will need a template. Adding an * to the end of the mode changed the string and caused it to appear incorrectly in Lovelace.

There is a new attribute on_schedule that will be true if the station is running a schedule.

1 Like

Wow! Impressively fast response. Sure, I’m willing to try a branche. Unfortunately, I will not be able to try before tomorrow evening.

@sherrell Working good so far with debug turned on :wink: Typical huh lol

Found an error in my system log today.

19-05-08 07:57:42 INFO (SyncWorker_6) [hassio.docker.interface] Restart homeassistant/qemux86-64-homeassistant
19-05-08 07:57:51 ERROR (MainThread) [hassio.homeassistant] Error on call https://172.30.32.1:8123/api/states/binary_sensor.snapshots_stale: Cannot connect to host 172.30.32.1:8123 ssl:None [Connection refused]
19-05-08 07:57:51 ERROR (MainThread) [hassio.api.proxy] Error on API for request states/binary_sensor.snapshots_stale
19-05-08 07:58:01 ERROR (MainThread) [hassio.homeassistant] Error on call https://172.30.32.1:8123/api/states/binary_sensor.snapshots_stale: Cannot connect to host 172.30.32.1:8123 ssl:None [Connection refused]
19-05-08 07:58:01 ERROR (MainThread) [hassio.api.proxy] Error on API for request states/binary_sensor.snapshots_stale

I believe aarlo is the only thing on my system that is a binary sensor. And it looks like something is trying to connect within Docker. I am running everything within Docker on Ubuntu 18.04. Thanks for your hard work and if this is not an aarlo thing I will start looking elsewhere.

@sherrell, It works! :grinning:
I just tried and did some basic testing (switching modes in lovelace while viewing the mode in the Arlo app on my phone) and it seems to work very well. Also for me the schedule mode is called schedule.1. I will keep using it for while, maybe perform some additional test and let you know how things are going. Do you want me to perform some additional tests or share any kind of logging?

Edit: One thing I noticed, the lovelace card shows the actual arm or disarm state when schedule is activated. It’not showing any schedule is active. Is that why you created the new attribute on_schedule? I could use that in my card of course.

@Kalmar-rocks
I think that’s a Google Drive issue. See here people talking about it here: Hass.io Add-on: Hass.io Google Drive Backup

@Plevuus
That’s great news. For now just keep an eye on it. Arlo, being Arlo, means nothing is quite straightforward so the code might get into a confused state and it would be good to get some logs if that does happen.

And correct on the Lovelace card. I tried appending an asterisk to the mode when a schedule was active but it ended up breaking the naming in the card. I think you can modify the card/button to look at the attribute and append the asterisk or change the icon. I just don’t have time to do that now.

@grinch067 Isn’t that always the case!!!

Edit: I just noticed I’ve got the same message in my logs. I’ll take a look.

Edit #2: I think it has to do with the camera being offline.

@sherrell also, if i use the arlo app to set a custom mode : aarlo freaks out and doesn’t work very well. i only told aarlo about home, away, and one night mode. if i pick a fourth unknown mode the alarm panels look weird. is this expected when using a mode that isn’t known to aarlo?

thanks in advance,
grinch067

@grinch067 Custom modes should work, I just tested here and it looked fine on both the card and badge. The way it works is if it’s home, away or night it will use the HA naming, if it’s a custom mode it will show the name you gave the mode in Arlo.

You custom mode does exist? And check the name returned by Arlo, you can see it in the logs with a ‘<==>’ near it.

Thanks again!
As I’m new to HA (and to YAML, Python and home automation in general) I had a nice small challenge to do something useful with the on_schedule attribute. I ended up with simple Template Binary Sensor:

binary_sensor:
 - platform: template
   sensors:
     aarlo_schedule:
       friendly_name: "Schedule:"
       value_template: '{{states.alarm_control_panel.aarlo_hgy77f5jmb53e.attributes.on_schedule}}'
       device_class: moving

and a vertical stack card:

type: vertical-stack
cards:
  - type: alarm-panel
    entity: alarm_control_panel.aarlo_hgy77f5jmb53e
    name: Arlo
    states:
      - arm_away
      - arm_home
  - type: entities
    entities:
      - entity: binary_sensor.aarlo_schedule
    show_header_toggle: false

(changed the random sequence in my arlo contol panel name. Not sure if I should regards that as private info)

I’m not sure if you intended something like that, but it works fine for me!
If this post is too off-topic or to specific, please just ignore it.

I did notice something odd. It happened that the visible modes in the lovelace card changed. Not sure if its related to the custom component or the branch. I’ll keep an eye on it. If it happens again I’ll try to reproduce and log.

1 Like

@Plevuus
That is exactly what I had in mind. If I change the mode name too much it screws up with the home/away and disarmed name mapping in the standard cards.

What do you mean by ‘visible mode’? Do you mean the icon?

@sherrell
I meant the modes being displayed and clickable in the card. Per configuration I enabled the arm_away and arm_home modes. They show up in the card as buttons “INSCHAKELEN AFWEZIG” and “INSCHAKELEN THUIS” (probably called something like “ARM AWAY” and “ARM HOME” in English). At a certain point “INSCHAKELEN THUIS” changed to “INSCHAKELEN NACHT” (Probably called “ARM NIGHT” in English).

In hindsight I think it was because I was messing in the lovelace GUI, but I’m not sure. As said, I’ll keep an eye on it and try to reproduce and log when it happens again. So far it didn’t.

I’ve installed the latest component however I’m getting this file not read error in the log

image

Any ideas on how to fix? I have a Arlo Baby
Also I’ve added the temp/humidity/moisture sensors to the config but they are not pulling from the camera into HA, any ideas on how to fix that?

@sharkpunch I’ve not seen this one before.

  • What type of home assistant system are you using - rapsberry pi or docker or virtualenv?
  • Which version of Aarlo are you using?
  • Did it ever work for you?

Off the top off my head it looks like the installation is missing some files or has incorrect read permissions. Can you see a file called __init__.py in the your custom_components/aarlo/pyaarlo directory?