1.0.11 • Published 1 year ago

arlo-api v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

arlo-api

CircleCI

Thin API for interacting with Arlo

Usage

import { Basestation } from './basestation';

const arlo = new Client(config);

// `result` contains necessary information to make further requests
// allowing you to consume just the login result in your library.
const result = await arlo.login();

// Now that arlo has been logged in get the device matching type basestation.
const device = await arlo.getDevice({ deviceType: 'basestation' });

// Construct a new basestation object using our arlo client and the the basestation device.
const basestation = new Basestation(arlo, device);

// Setup event listeners.
basestation.on(ARLO_EVENTS.open, () => {});

basestation.on(ARLO_EVENTS.close, () => {});

// Start event stream.
await basestation.startStream();

Authentication

Currently, email is the only supported MFA method. Caveat I've only tested with Gmail. The library will mark Arlo OTP emails has read. A future release will allow deletion based on a configuration value.

Configuration

{
  arloUser: 'something@somewhere.com',
  arloPassword: 'super secret password',
  emailUser: 'myemail@gmail.com',
  emailPassword: 'another secret password',
  emailServer: 'imap.gmail.com',
  emailImapPort: 993
}

The emailUser must match one of the configured MFA sources in Arlo.

Gmail

Gmail has certain limitations when trying to connect from a third party app using just username and password. As of May 2022 Google blocked "less secure apps" from accessing their email services. You have to manually opt in and then set up a separate password for a third party. Additionally, you must enable IMAP in Gmail.

Tests

Tests make use of dotenv package for providing environment variables to the running process.

Create a .env file at the root of the solution and supply it with whatever your secrets are.

ARLO_USER="user@gmail.com"
ARLO_PASSWORD="password"
EMAIL_USER="other_user@gmail.com"
EMAIL_PASSWORD="password2"

You can also skip the login flow if you've already received a login result object and instead use the following secrets.

SERIAL_NUMBER="serial"
SESSION_EXPIRES="session_expiration"
TOKEN="token"
USER_ID="userId"

And then use the provided _shortCircuitLogin method.

const arlo = new Client(config);

const loginResult: LoginResult = {
  serialNumber: process.env.SERIAL_NUMBER as string,
  sessionExpires: Number.parseInt(process.env.SESSION_EXPIRES as string),
  token: process.env.TOKEN as string,
  userId: process.env.USER_ID as string,
};

arlo._shortCircuitLogin(loginResult);

References

Based on JOHNEPPILLAR's and easton36's great work.

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago