kevinelliott / arlo-ruby

Ruby library for interacting with Netgear's Arlo camera system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arlo-ruby

A client library written in Ruby to interact with the Netgear Arlo camera system.

Why?

Netgear notoriously keeps a closed system around the Arlo API. They do not publish the API specifications publicly, and if it was up to them you would never be able to access your devices directly. This is because they rely on the revenue from cloud-based subscriptions to store and manage your equipment and it is not in their interests to open it up to you.

For those of us who want to backup our videos to our own NAS for backup, sync to a different cloud provider, or otherwise integrate the system into our existing home automation platforms, this library was written.

While this is functional, it is still incomplete. Contributions of any kind at this time are welcome and encouraged!

Installation

Add this line to your application's Gemfile:

gem 'arlo-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arlo-ruby

Usage

Initialize the client

client = Arlo::Client.new

Login

response = client.login(email: 'YOUR EMAIL', password: 'YOUR PASSWORD')

Get Devices

Retrieves all of the devices associated with your account.

devices = client.devices
+---------------+----------------------+
|                Login                 |
+---------------+----------------------+
| Variable      | Value                |
+---------------+----------------------+
| User ID       | NZ69AUK-336-51372586 |
| Email         | kevin+dev@phunc.com  |
| Valid Email   | true                 |
| Token         | xxxxxxxxxxxxxx       |
| Authenticated | 1566062204           |
| Created       | 1565912809854        |
+---------------+----------------------+

+---------------+---------------+----------------------------------+-------------+---------------+-----------+---------------------+-------------+----------------------+
|                                                                                Devices                                                                                |
+---------------+---------------+----------------------------------+-------------+---------------+-----------+---------------------+-------------+----------------------+
| ID            | Parent ID     | Unique ID                        | Type        | Model         | HW        | Name                | State       | Connectivity         |
+---------------+---------------+----------------------------------+-------------+---------------+-----------+---------------------+-------------+----------------------+
| 4R036C71A22F2 |               | Z92W-336-6644878_4R036C71A22F2   | basestation | VMB4000       | VMB4000r3 | Beatty Base Station | provisioned | ethernet / connected |
| 4XH16C71A8A5C | 4R036C71A22F2 | Z92W-336-6644878_4XH16C71A8A5C   | camera      | VMC4030       | H8        | Office              | provisioned |                      |
| 4XH16C7EAA32C | 4R036C71A22F2 | Z92W-336-6644878_4XH16C7EAA32C   | camera      | VMC4030       | H8        | Family Room         | provisioned |                      |
| 4R036C71A22F2 | 4R036C71A22F2 | Z92W-336-6644878_4R036C71A22F2#1 | siren       | VMB4000-siren |           | Beatty Base Station | provisioned |                      |
+---------------+---------------+----------------------------------+-------------+---------------+-----------+---------------------+-------------+----------------------+

Setup a Basestation Object

This allows you to operate directly on a basestation.

basestation = Arlo::Basestation.new(devices.detect { |device| device.deviceType == 'basestation' }, client)

Set Mode

basestation.system_mode(:disarm)
basestation.system_mode(:arm)

Valid modes: :disarm, :arm

Get Video Library

Returns an array of OpenStruct that contain details about the captured videos associated with your basestation.

videos = basestation.library(2.weeks.ago, Time.current)

Download Video Library

This is useful in order to backup your captured videos to local storage, or perhaps a NAS on your network.

basestation.library_download('arlo_videos')
Downloading 1566061318696 to arlo_videos/1566061318696.mp4...

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kevinelliott/arlo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

About

Ruby library for interacting with Netgear's Arlo camera system

License:MIT License


Languages

Language:Ruby 98.6%Language:Shell 1.4%