Code Monkey home page Code Monkey logo

python-arlo's Introduction

Python Arlo

image

image

image

image

RETIRED:

Please visit the awesome work by @twrecked at https://github.com/twrecked/hass-aarlo

Python Arlo is a library written in Python 2.7/3x that exposes the Netgear Arlo cameras as Python objects.

Developer Documentation: http://python-arlo.readthedocs.io/

Installation

$ pip install pyarlo

# Install latest development
$ pip install git+https://github.com/tchellomello/python-arlo

Usage

# connecting
from pyarlo import PyArlo
arlo  = PyArlo('foo@bar', 'secret')

# listing devices
arlo.devices

# listing base stations
arlo.base_stations

# get base station handle
# assuming only 1 base station is available
base = arlo.base_stations[0]

# get the current base station mode
base.mode  # 'disarmed'

# listing Arlo modes
base.available_modes # ['armed', 'disarmed', 'schedule', 'custom']

# Updating the base station mode
base.mode = 'custom'

# listing all cameras
arlo.cameras

# showing camera preferences
cam = arlo.cameras[0]

# check if camera is connected to base station
cam.is_camera_connected  # True

# printing camera attributes
cam.serial_number
cam.model_id
cam.unseen_videos

# get brightness value of camera
cam.brightness

# get signal strength of camera with base station
cam.signal_strength

# get flip property from camera
cam.flip_state

# get mirror property from camera
cam.mirror_state

# get power save mode value from camera
cam.powersave_mode

# get current battery level of camera
cam.battery_level
92

# get boolean result if motion detection
# is enabled or not
base.is_motion_detection_enabled  # True

# get battery levels of all cameras
# prints serial number and battery level of each camera
base.get_cameras_battery_level  # {'4N71235T12345': 92, '4N71235T12345': 90}

# get base station properties
base.properties

# get camera properties
base.get_camera_properties

# get camera rules
base.get_camera_rules

# get camera schedule
base.get_camera_schedule

# get camera motion detection sensitivity
cam.get_motion_detection_sensitivity

# refreshing camera properties
cam.update()

# gathering live_streaming URL
cam.live_streaming()  # rtmps://vzwow72-z2-prod.vz.netgear.com:80/vzmodulelive?egressToken=b723a7bb_abbXX&userAgent=web&cameraId=48AAAAA

# gather last recorded video URL
cam.last_video.video_url

Loading Videos

# by default, all videos recorded within
# the last 30 days will be pre-loaded
arlo.ArloMediaLibrary.videos

# Or you can load Arlo videos directly
from pyarlo.media import ArloMediaLibrary
library = ArloMediaLibrary(arlo, days=2)
len(library.videos)

# showing a video properties
media = library.videos[0]

# printing video attributes
media.camera
media.content_type
media.media_duration_seconds

# displaying thumbnail to stdout
media.download_thumbnail()

# downloading video
media.download_video('/home/user/demo.mp4')

Ambient Sensors Data Usage (Arlo Baby Monitor)

# Get the base_station instance corresponding to the Arlo Baby
base_station = arlo.base_stations[0]

# Store all ambient sensor history in self._ambient_sensor_data
# All of the accessor properties will call this if values are not cached.
base_station.get_ambient_sensor_data()

# Get cached sensor history (property)
base_station.ambient_sensor_data

# Get most recent temperature reading in degrees celsius (property)
base_station.ambient_temperature

# Get most recent humidity reading in relative humidity percentage (property)
base_station.ambient_humidity

# Get most recent air quality reading (property)
# Not 100% sure on the unit of measure, but would assume it's VOC PPM
base_station.ambient_air_quality

Music Playback Usage (Arlo Baby Monitor)

# Get the current playback status and available track list
base_station.get_audio_playback_status()

# Play a track, optionally specify the track and seek time in seconds
base_station.play_track(
    track_id='229dca67-7e3c-4a5f-8f43-90e1a9bffc38',
    position=0)

# Pause the currently playing track
base_station.pause_track()

# Skip to the next track in the playlist
base_station.skip_track()

# Set the music loop mode to repeat the entire playlist
base_station.set_music_loop_mode_continuous()

# Set the music loop mode to repeat the current track
base_station.set_music_loop_mode_single()

# Sets playback to shuffle
base_station.set_shuffle_on()

# Sets playback to sequential
base_station.set_shuffle_off()

# Change the playback volume
base_station.set_volume(100)

Night Light Usage (Arlo Baby Monitor)

# Turn on the night light
base_station.set_night_light_on()

# Turn off the night light
base_station.set_night_light_off()

# Set the brightness of the night light
base_station.set_night_light_brightness(200)

Supported Devices

If you have a different model, please feel free to contribute by reporting your results.

Model Tested by Status Results/Issues
Arlo 1st Generation @tchellomello working/ok

N/A

Arlo 2st Generation @tchellomello working/ok

N/A

Contributing

See more at CONTRIBUTING.rst.

python-arlo's People

Contributors

aneisch avatar broox avatar chaddotson avatar jwillaz avatar karlkar avatar lukiffer avatar misterek avatar ryanwinter avatar tchellomello avatar viswa-swami avatar yoooou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-arlo's Issues

Arm/Disarm issue

Hi,

when I'm trying to run the following example I'm getting the error bellow. Can you please help me? Regards.

%# connecting
from pyarlo import PyArlo
arlo = PyArlo('xxx@xxx', 'xxxx')

%# get base station handle
%# assuming only 1 base station is available
base = arlo.base_stations[0]

%# get base mode
base.mode = 'disarmed'

Error running the command[Tecnologia][Arlo Netgear][Disarm] : Error on shell exec, return value : 1. Details : Array ( [0] => Traceback (most recent call last): File "/var/www/html/core/php/../../plugins/script/core/ressources/ArloDisarm.py", line 10, in base.mode = 'disarmed' File "/usr/local/lib/python2.7/dist-packages/pyarlo/base_station.py", line 374, in mode if mode not in self.available_modes: File "/usr/local/lib/python2.7/dist-packages/pyarlo/base_station.py", line 237, in available_modes return list(self.available_modes_with_ids.keys()) File "/usr/local/lib/python2.7/dist-packages/pyarlo/base_station.py", line 244, in available_modes_with_ids [(m.get("type", m.get("name")), m.get("id")) for m in modes] TypeError: 'NoneType' object is not iterable )

Streaming `rtmps` over web

What is the approach to stream over web the video once I have a streaming URL like:

rtmps://vzwow72-z2-prod.vz.netgear.com:80/vzmodulelive?egressToken=b723a7bb_abbXX&userAgent=web&cameraId=48AAAAA

Does it require flash to be installed in the browser?

Can't get base station mode

Hi,

I can get the base station mode (I see the update in my mobile App) but base.mode (like in the sample) return an empty result even if I set it just before.

I'm on a raspberry with raspbian jessie lite with Python 2.7.9

Nice to have device on/off

Hi, I would to know if it is possible set a device on/off in the same way I can do selecting a cam from "devices windows", accessing to setup of a specific cam and toggling the flag "device on/off".
Thanks

Arm and Disarm

Hi Guys,

Great work you have done!
Sorry for raising an issue but need your expertise since I couldn't find the documentation (saw an issue open for that).

Can you please assist me with info how I arm and disarm all cameras (at once)?

Im having a RPI integrated into my house alarm system which I want to trigger the arm/disarm of the Arlo system.

Thanks in advance,

Daniel K

How to determine the current Arlo mode???

It seems to determine which is the current mode for the Arlo cameras, it is only possible if we consume the Angular.js object (I could not find a way to do it via request).

So the library does have yet a way to determine which mode the cameras are set.

We need to crack this out or how to implement it on our side.

  • Should we just have a mode set after flipping it to the desired mode via pyarlo?
  • How about the changes made on the webUI, how to update the state on PyArlo?

Any ideas are very welcome.

Getting multiples HTTP 401 when polling camera.get_battery_level

I was working on extending a sensor for Home Assistant to get battery level for the cameras, then I hit the problem below when pulling the cameras to get the battery level:

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/base_station.py", line 40, in thread_function
    data = self._session.query(url, method='GET', raw=True, stream=True)
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/__init__.py", line 141, in query
    req.raise_for_status()
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/requests/models.py", line 928, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://arlo.netgear.com/hmsweb/client/subscribe?token=<REDACTED>

2017-07-07 00:03:22 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.last_front_door_lateral, old_state=None, new_state=<state sensor.last_front_door_lateral=07-06-2017 08:09:28; attribution=Data provided by arlo.netgear.com, brand=Netgear Arlo, model=VMC3030, friendly_name=Last Front Door Lateral, icon=mdi:run-fast @ 2017-07-07T00:03:22.768137-04:00>>
2017-07-07 00:03:23 INFO (SyncWorker_6) [pyarlo.base_station] Action body: {'action': 'get', 'from': '<REDACTED>_web', 'properties': None, 'publishResponse': 'false', 'resource': 'cameras', 'to': '48914CXXXXX', 'transId': '<REDACTED>'}
2017-07-07 00:03:23 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2017-07-07 00:03:25 INFO (SyncWorker_12) [pyarlo.base_station] Action body: {'action': 'set', 'from': '<REDACTED>_web', 'properties': {'devices': ['48914CXXXX']}, 'publishResponse': 'false', 'resource': 'subscriptions/<REDACTED>_web', 'to': '48914CXXXXX', 'transId': '<REDACTED>'}
Exception in thread Thread-5:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/base_station.py", line 40, in thread_function
    data = self._session.query(url, method='GET', raw=True, stream=True)
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/__init__.py", line 141, in query
    req.raise_for_status()
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/requests/models.py", line 928, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://arlo.netgear.com/hmsweb/client/subscribe?token=<REDACTED>

2017-07-07 00:03:26 INFO (SyncWorker_12) [pyarlo.base_station] Action body: {'action': 'get', 'from': '<REDACTED>_web', 'properties': None, 'publishResponse': 'false', 'resource': 'cameras', 'to': '48914CXXXXX', 'transId': '<REDACTED>'}
2017-07-07 00:03:26 WARNING (MainThread) [homeassistant.components.sensor] Setup of platform arlo is taking over 10 seconds.
2017-07-07 00:03:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 181, in _step
    result = coro.throw(exc)
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 212, in async_add_entity
    yield from self.hass.async_add_job(entity.update)
  File "/usr/lib64/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib64/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mdemello/devel/home-assistant/homeassistant/components/sensor/arlo.py", line 104, in update
    self._state = self._data.get_battery_level
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/camera.py", line 132, in get_battery_level
    return base.get_camera_battery_level[self.device_id]
TypeError: 'NoneType' object is not subscriptable
2017-07-07 00:03:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 181, in _step
    result = coro.throw(exc)
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 212, in async_add_entity
    yield from self.hass.async_add_job(entity.update)
  File "/usr/lib64/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib64/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mdemello/devel/home-assistant/homeassistant/components/sensor/arlo.py", line 104, in update
    self._state = self._data.get_battery_level
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/camera.py", line 132, in get_battery_level
    return base.get_camera_battery_level[self.device_id]
TypeError: 'NoneType' object is not subscriptable
2017-07-07 00:03:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 181, in _step
    result = coro.throw(exc)
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 212, in async_add_entity
    yield from self.hass.async_add_job(entity.update)
  File "/usr/lib64/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib64/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mdemello/devel/home-assistant/homeassistant/components/sensor/arlo.py", line 104, in update
    self._state = self._data.get_battery_level
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/camera.py", line 132, in get_battery_level
    return base.get_camera_battery_level[self.device_id]
TypeError: 'NoneType' object is not subscriptable
2017-07-07 00:03:31 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 181, in _step
    result = coro.throw(exc)
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/home/mdemello/devel/home-assistant/homeassistant/helpers/entity_component.py", line 212, in async_add_entity
    yield from self.hass.async_add_job(entity.update)
  File "/usr/lib64/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib64/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mdemello/devel/home-assistant/homeassistant/components/sensor/arlo.py", line 104, in update
    self._state = self._data.get_battery_level
  File "/home/mdemello/.virtualenvs/ha-py36/lib/python3.6/site-packages/pyarlo/camera.py", line 132, in get_battery_level
    return base.get_camera_battery_level[self.device_id]
TypeError: 'NoneType' object is not subscriptable

If I leave it running, due to multiple requests being executed on the Thread(), eventually all sensors will get updated

image

I believe the issue might be happening for any requests inside of the Thread().

2017-07-07 01:12:31 WARNING (Thread-3) [r2017-07-07 01:12:28 WARNING (SyncWorker_8) [requests.packages.urllib3.connectionpool] Connection pool is full, discarding connection: arlo.netgear.com
equests.packages.urllib3.connectionpool] Connection pool is full, discarding connection: arlo.netgear.com

I believe we'll need to work with HTTPAdapter to increase the pool. There is a good article about it at https://laike9m.com/blog/requests-secret-pool_connections-and-pool_maxsize,89/

But besides extending the pool, what else should we do to avoid the 401 requests? Maybe should we modify the Thread() code to make sure to just request its one component?

@viswa-swami any ideas?

Arlo Q not supported

I just bought a 2 pack of arlo q cameras. They are returning as devicetype == "arloq".

Error Retrieving Media

A couple days ago I noticed that HomeAssistant was no longer showing images from my Arlo cameras - the API was returning a 500 error. Ultimately I found that the HA code could not retrieve any of the camera's last_video properties.

I decided to try connecting directly through the python-arlo API and see if I could get to the root cause. I am seeing the following:
`from pyarlo import PyArlo
arlo = PyArlo("", "")

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/pyarlo/init.py", line 52, in init
days=days)
File "/usr/local/lib/python3.7/site-packages/pyarlo/media.py", line 29, in init
self.videos = self.load(days)
File "/usr/local/lib/python3.7/site-packages/pyarlo/media.py", line 69, in load
)[0]
IndexError: list index out of range
`
It seems like Arlo may not longer be providing the expected data to initialize PyArlo, so I wanted to raise awareness and see if the root cause could be determined.

Arlo Baby Support

Creating this issue to gauge interest in the additional Arlo Baby functionality. Typically I would just jam out some code and submit a PR, but it appears that there would be a considerable refactor involved to keep the reusable code clean, and I would like to have open discussion with the maintainer @tchellomello to make sure this jives with his vision for the module and that downstream packages such as Home Assistant have an easy (if not transparent) migration path.

Why Refactor?

There's a big chunk of functionality in the ArloBaseStation class that maintains a server-side event stream socket to query certain bits of information about the base station. With the Arlo Baby camera API, it uses the same pattern (at a different endpoint) to get these bits of information:

  • Ambient air temperature
  • Ambient air quality (VOC detection)

The API also exposes pub/sub for the following actions:

  • Audio/music functionality (play, pause, skip, shuffle, volume control, timer, etc.)
  • Nightlight functionality (on, off, color, timer, etc.)
  • Alert configuration

Having these exposed to Home Assistant would be extremely helpful in that you could trigger HVAC events in response to air temperature alarms, play music when motion is detected, start your air purifier in response to air quality alarms, and more.

Proposal

There are a couple ways we could tackle this.

  1. Extract the SSE client into a base class and have both ArloBaseStation and ArloCamera extend the new base class that has the subscribe/notify functionality.
  2. Extract the SSE client into PyArlo itself and manage these extra bits of sensor data and device RPC separate from the domain classes through a specific get_sensor_data(sensor_type) (or similar) method.

In the former case, we could expose these items as properties (as they are now) and safeguard by checking to see if the camera is of the correct type. Alternatively, we could provide a map of available metrics/sensors on the ArloCamera class.

Again, I'm happy to contribute this, I just wanted community and maintainer input before actioning. Cheers!

Save snapshot image to disk.

I'm aware this is an ID10T error, but after hours I can't figure out how to save the most recent camera snapshot to disk.
using last_image
I can echo it to the console, but am missing how to write it to a file.
I had assumed appending download_thumbnail may do the job, but I was wrong. Though this does work for last_video.

thank you for any help you can offer.

Base Modes incorrect

I'm running Python 2.7 and just did a fresh pip install of pyarlo
When I run it, I get incorrect modes returned :--

Devices : {'base_station': [<ArloBaseStation: Home>], 'cameras': [<ArloCamera: BackGardenCamera>, <ArloCamera: HallwayCamera>, <ArloCamera: GarageCamera>, <ArloCamera: KitchenCamera>, <ArloCamera: LivingRoomCamera>, <ArloCamera: LandingCamera>]}

Arlo Base Stations : [<ArloBaseStation: Home>]

Base : <ArloBaseStation: Home>

Base Mode : disarmed

Modes : [u'disarmed', 'schedule']

However the app and the website all report my correct list of modes which is :--
Armed,Disarmed,Schedule,Geofencing,andys,Night

Also, the "Night" mode is what is actually currently selected not "disarmed"

Code :--

[root@server pyarlo]# pip list | grep arlo
pyarlo (0.2.3)

from pyarlo import PyArlo
arlo = PyArlo('[email protected]', '*********')

print
print("Devices : %s" % (arlo.devices))

print
print("Arlo Base Stations : %s" %(arlo.base_stations))

base = arlo.base_stations[0]

print
print("Base : %s" % (base))

print
print("Base Mode : %s" % (base.mode))

print
print("Modes : %s" % (base.available_modes))

print
print("Base Properties : %s" % (base.properties))

Serial Numbers Deprecated?

I have yet to see serialNumber come back in a response for either a base station or camera. Is this property deprecated? Or does it just come with certain models?

Streaming API Changed

It looks like all requests to the streaming API (including the initial notify call) are returning a permissions error:

{'data': {'error': '2016', 'message': "We are sorry, but you don't have permission to perform this action.", 'reason': 'No Such Permissions'}, 'success': False}

I'll continue looking into the underlying cause and post any updates here.

Battery level

Any ideas on if battery level can be accessed via their API? I've dug around watching the network requests but haven't seen anything.

Battery Level and Signal Strength do not work on Arlo GO

The battery level and signal strength return "None" on the Arlo Go cameras. The rest of the values seem to work. I can see Signal Strength values if I check the camera.attrs, but I do not see a battery level value listed there. But there is a value is visible within Arlo's portal.

How To Check If Camera Is On Or Off?

By calling Notify endpoint i can turn on and off camera. Is that any endpoint i can call for device and they tells me if camera is on or off?

How to download the latest thumbnail image from each camera?

I'm using the below python script (extract) to pull out the last two images from the cameras I have. I actually have 2 cameras, how would I extract the latest image from each camera?

Thanks!

cam = arlo.cameras[0]

printing camera attributes

#cam.serial_number
cam.model_id
cam.unseen_videos

load Arlo videos directly

from pyarlo.media import ArloMediaLibrary
library = ArloMediaLibrary(arlo, days=1)
len(library.videos)

showing a video properties

media = library.videos[0]

displaying thumbnail to stdout

media.download_thumbnail('/home/parallels/arlo/output.jpg')
media = library.videos[1]
media.download_thumbnail('/home/parallels/arlo/output2.jpg')

View RTMPS live stream access

cam_object.live_streaming() provides the live stream which is returned as type rtmps://. This would indicate that it is an encrypted RTMP stream.

At this point, I haven't seen anyone successfully open the stream. I have tried to stream with ffmpeg however received errors of various types.

I suspect either a certificate is required, or some token is needed to access/decrypt the stream.

Sometimes I hit this issue when trying to refresh Arlo BaseStation status

2018-06-04 16:29:52 DEBUG (Thread-131) [sseclient] Initialized SSE client from event source None
Exception in thread Thread-131:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mdemello/.virtualenvs/hass_devel/lib/python3.6/site-packages/pyarlo/base_station.py", line 56, in thread_function
    for event in (self.__sseclient).events():
  File "/home/mdemello/.virtualenvs/hass_devel/lib/python3.6/site-packages/sseclient/__init__.py", line 58, in events
    for chunk in self._read():
  File "/home/mdemello/.virtualenvs/hass_devel/lib/python3.6/site-packages/sseclient/__init__.py", line 48, in _read
    for chunk in self._event_source:
TypeError: 'NoneType' object is not iterable

Arlo Baby 'get' Commands?

Is there a current method to 'get' the following status on the Arlo Baby? I see that there's commands to change the status but I'm not sure how to get the current status.

  • volume level
  • night light on/off
  • night light brightness

Updating the Camera Snapshot

I'm wanting to script grabbing an image from each of my cameras. Is there anyway to update each camera's current snapshot?

Trying to run..

Hi,

I'm getting a syntax error when trying to execute the example. Any ideas what I'm doing wrong?

Thanks in advance!

File "newtest.py", line 7
{'base_station': [ArloBaseStation: Home>]}
SyntaxError: invalid syntax

I'm getting the above error when trying to execute...

connecting

from pyarlo import PyArlo
arlo = PyArlo('myuser', 'bypass')

listing devices

arlo.devices
{'base_station': [ArloBaseStation: Home>]}

Retrieving Camera "State" Attributes

I've been working on modifications to turn individual cameras On/Off. This is achievable by setting "privacyActive" to False/True, respectively. However, while setting the data is straightforward, getting it is not. In order to initialize the state of a device, it would be helpful to retrieve the current values like privacyActive. However, I cannot find any endpoint for retrieving this particular value. I've spent hours sifting through Fiddler traces and javascript to see how the arlo.netgear.com website is reading whether a camera is On or Off, but I have found nothing.

It would also be great to figure out how event alerts are triggered, as those could be used as motion/sound sensors. SmartThings publishes the cameras as motion sensors, so they can be used to trigger other automation events.

Exception while getting mode (if in custom mode)

There is an issue getting the mode from base stations if you are set to schedule or custom mode.

Set custom mode before testing.

from logging import basicConfig, getLogger, INFO
from pyarlo import PyArlo

logger = getLogger(__name__)

logging_config = dict(level=INFO, format='[%(asctime)s - %(filename)s:%(lineno)d - %(funcName)s - %(levelname)s] %(message)s')
basicConfig(**logging_config)

arlo = PyArlo(username, password)

base = arlo.base_stations[0]
print(base.mode)

Results in:

Traceback (most recent call last):
  File "/Users/someuser/projects/arlotest/scratch.py", line 36, in <module>
    print(base.mode)
  File "/Users/someuser/.virtualenvs/python3/lib/python3.6/site-packages/pyarlo/base_station.py", line 242, in mode
    return mode['type']
KeyError: 'type'

Issue signing in

I can no longer sign in, please could you help, my credentials are working on the other "arlo" library.
here is my code and the output

Code:

from pyarlo import PyArlo
arlo = PyArlo('test', 'test')
print("Devices : %s" % (arlo.devices))

Output:
Traceback (most recent call last):
File "/home/pi/arm_arlo.py", line 2, in
arlo = PyArlo('[email protected]', 'test')
File "/usr/local/lib/python2.7/dist-packages/pyarlo/init.py", line 52, in init
days=days)
File "/usr/local/lib/python2.7/dist-packages/pyarlo/media.py", line 29, in init
self.videos = self.load(days)
File "/usr/local/lib/python2.7/dist-packages/pyarlo/media.py", line 69, in load
)[0]
IndexError: list index out of range

`last_image` and `snapshot_url` returns stale images

I'm trying to fetch a last know camera image on a periodic basis. I'm trying to use last_image (bytes) as well as the snapshot_url (with schedule_snpashot() method call to update it) but unfortunately, it seems it returns me stale images (different).

  1. This one always returns the same URL and doesn't update it even though schedule_snapshot() return True:
    http://python-arlo.readthedocs.io/index.html#pyarlo.camera.ArloCamera.snapshot_url

  2. This one returns a stale image, the same image I can see as a streaming preview and it's never updated, it could stay the same for days and I didn't find a way to update it expect of start streaming via the user interface (web or app):
    http://python-arlo.readthedocs.io/index.html#pyarlo.camera.ArloCamera.last_image

What is the approach to refresh the current image and download it?

Basestation Scheduled Mode

I notice that accessing the mode for the base station while in scheduled mode returns the mode current set by the schedule. Also, arlo.base_stations[0].mode = "schedule" does not appear to work.

nothing returning?

I made a quick script to see what is going on, because I use this module in home-assistant.


from pyarlo import PyArlo
arlo  = PyArlo('juasdfe.asdf', '')

print("devices ", arlo.devices)
print("cameras ", arlo.cameras)

# showing camera preferences
cam = arlo.cameras[0]

# check if camera is connected to base station
print("connected ", cam.is_camera_connected)

# printing camera attributes
print("serial ", cam.serial_number)
print("model_id ", cam.model_id)
print("unseen videos ", cam.unseen_videos)

# get brightness value of camera
print("brightness ", cam.brightness)

# get signal strength of camera with base station
print("signal ", cam.signal_strength)

# get flip property from camera
print("flip ", cam.flip_state)

# get mirror property from camera
print("mirror ", cam.mirror_state)

# get power save mode value from camera
print("powersave ", cam.powersave_mode)

# get current battery level of camera
print("battery level ", cam.battery_level)

Some of the things it is return, is broken or empty:

devices  {'cameras': [<ArloCamera: asdf>], 'base_station': []}
cameras  [<ArloCamera: asdf>]
connected  None
serial  asdf
model_id  asdf
unseen videos  0
brightness  None
signal  None
flip  None
mirror  None
powersave  None
battery level  None

PyAlro login issue

Hi,

I have PyArlo run every 30 mins to check my Arlo base station using AzureDevOps pipelines.

Running PyArlo('username', 'passwordhere') is now giving the following error:

PyArlo('username', 'passwordhere')
Traceback (most recent call last):
File "", line 1, in
File "C:\Python38\lib\site-packages\pyarlo_init_.py", line 50, in init
self.ArloMediaLibrary = ArloMediaLibrary(self,
File "C:\Python38\lib\site-packages\pyarlo\media.py", line 29, in init
self.videos = self.load(days)
File "C:\Python38\lib\site-packages\pyarlo\media.py", line 56, in load
data = self._session.query(url,
AttributeError: 'NoneType' object has no attribute 'get'

This error is also occurring manually on execution.

Can you advise on how I can assist with getting this resolved?
Thanks.

Turn siren on / off

Hi @broox,

I figured out what commands to issue to turn the siren on the basestation on / off.
Any chance you could add this to your code?

This is an example of the message send when turning the siren on:
{"from":"VHFP9-161-14197254_web","to":"4RD17570A1DC3","action":"set","resource":"siren","transId":"web!b93a567.a795f!1508699879247","publishResponse":true,"properties":{"sirenState":"on","duration":300,"volume":8,"pattern":"alarm"}}

The resource is "siren", and the properties are:
properties":{"sirenState":"on","duration":300,"volume":8,"pattern":"alarm"}

For switching the siren off, the propterties looks like this:
properties":{"sirenState":"off","duration":300,"volume":8,"pattern":"alarm"}

Disabling a camera

I’ve been trying to disable a camera, but not having much joy..

Snippet from my python script..

Where am I going wrong?

is_enabled = False
cam = arlo.cameras[1]
arlo.base_stations[0].set_camera_enabled(cam.uniqueid,is_enabled)

history_event.get('properties') throwing NoneType

2018-07-21 04:05:47 ERROR (MainThread) [homeassistant.core] Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/arlo.py", line 84, in hub_refresh
    update_base_station=True)
  File "/usr/local/lib/python3.6/site-packages/pyarlo/__init__.py", line 270, in update
    base.update()
  File "/usr/local/lib/python3.6/site-packages/pyarlo/base_station.py", line 687, in update
    self.get_ambient_sensor_data()
  File "/usr/local/lib/python3.6/site-packages/pyarlo/base_station.py", line 481, in get_ambient_sensor_data
    properties = history_event.get('properties')
AttributeError: 'NoneType' object has no attribute 'get'

cc @lukiffer can you take a look at this for us? I don't have this device so I can't test it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.