Ring Client
The Ring Client crate provides a client for interfacing with Ring home security devices.
Usage
[]
= "0.0.2"
Capabilities
- Authenticate with Ring - either via Username and Password, or Refresh Tokens.
- Interact with Ring locations - including listening for events (such as motion detectors) in real-time, as well as changing the states of devices (such as enabling or disabling an Alarm system).
- Retrieve profile information.
Examples
More in-depth examples can be found in documentation comments on the Client methods.
Listening for Events
Perhaps one of the most useful features of the crate is the ability to listen and respond to events which occur in a location in real-time.
This is done using the [crate::location::Location::listen_for_events] method.
use Client;
use Credentials;
use OperatingSystem;
let client = new;
// For berevity, a Refresh Token is being used here. However, the client can also
// be authenticated using a username and password.
//
// See `Client::login` for more information.
let refresh_token = RefreshToken;
client.login
.await
.expect;
let locations = client.get_locations
.await
.expect;
let location = locations
.first
.expect;
let listener = location.listen_for_events
.await
.expect;
// Wait for the listener to finish.
listener
.join
.await
Listing Devices
use Client;
use Credentials;
use OperatingSystem;
let client = new;
// For berevity, a Refresh Token is being used here. However, the client can also
// be authenticated using a username and password.
//
// See `Client::login` for more information.
let refresh_token = RefreshToken;
client.login
.await
.expect;
let devices = client.get_devices
.await
.expect;
println!;
Contributing
There are tons of features which could be added to the crate. If you'd like to contribute, please feel free to open an issue or a pull request.
Examples of features which could be added:
- Better parity between the Ring API and the structs.
- Support for streaming video from Ring cameras and doorbells.
Testing
Many of the tests require a valid Ring account before they can be run, which can be provided
via a Refresh Token being set in the .env file.
The .env file can be created by using .env.example as a template:
Running tests
The tests can be run with: