node-blink-security
node-blink-security copied to clipboard
This is an npm module for communicating with Blink Home Security System
node-blink-security
This is a Node.js version of this python library. It allows to communicate with Blink Home Security System from a Node.js application.
Installation
npm install node-blink-security
Usage
const Blink = require('node-blink-security');
var blink = new Blink('YOUR_EMAIL', 'YOUR_PASSWORD', 'DEVICE_ID');
blink.setupSystem()
.then(() => {
blink.setArmed()
.then(() => {
// see the object dump for details
console.log(blink);
});
}, (error) => {
console.log(error);
});
API
class Blink
Constructor
-
email
- your Blink account email -
password
- your Blink account password -
deviceId
- identifies your device and registers it in your account. It's required since version 4.0.0 of this package as this is when Blink switched to 2-factor authentication flow. The value is provided by you and it should let you identify the device correctly when you receive a verification email from Blink. -
options
-
-
auth_2FA: false
- set totrue
if you want to receive verification code for each login, otherwise you'll receive verification email only once for the first time and after that the device will be remembered by Blink.
-
-
-
verification_timeout: 60000
- number of milliseconds to wait for email verification until retrying account login
-
-
-
device_name: "node-blink-security"
- this name appears in verification email along with yourdeviceId
-
Properties
-
blink.cameras
- the information about all available cameras -
blink.idTable
-{cameraId:cameraName}
map for further references -
blink.networks
- map of configured networks (sync modules) -
blink.accountId
- account id -
blink.region
- region (e.g.prod
) -
blink.regionId
- region (e.g.United States
)
Methods
-
blink.refresh
- get all blink cameras and pulls their most recent status -
blink.getSummary
- get a full summary of system information, broken down by sync module -
blink.getCameraThumbs
- refresh all cameras thumbnails -
blink.getVideos(page, Date)
- get metadata for X (per page is unknown) videos recorded sinceDate
. Paginate withpage
parameter -
blink.getEvents
- get all events from Blink server (e.g. heartbeats, motion...), by sync module -
blink.isOnline
- return boolean system online status, by sync module -
blink.getLastMotions
- refresh motion events data -
blink.isArmed()
- return boolean statuses of all sync modules: armed(true)/disarmed(false). -
blink.setArmed(boolean, [networkIds])
- arm/disarm the system/specific set of sync modules;true
by default -
blink.getCameras
- find and creates cameras; used for internal purposes -
blink.getLinks
- set access links and required headers for each camera in system; used for internal purposes -
blink.setupSystem([system name or id])
- logs in and sets auth token, urls, and ids for future requests. Specify a system identifier if you have more than one system setup. -
blink.getIDs
- set the network IDs and Account ID; used for internal purpose -
blink.getClients
- get information about devices that have connected to the system
class BlinkCamera
Properties
-
blinkCamera.id
- camera id -
blinkCamera.name
- camera name -
blinkCamera.region_id
- region id -
blinkCamera.armed
- camera arm status -
blinkCamera.clip
- current clip -
blinkCamera.thumbnail
- current thumbnail -
blinkCamera.temperature
- camera temperature -
blinkCamera.battery
- battery level -
blinkCamera.notifications
- number of notifications -
blinkCamera.image_link
- image link -
blinkCamera.arm_link
- link to arm camera -
blinkCamera.header
- request header -
blinkCamera.motion
- last motion event detail -
blinkCamera.updated_at
- last device update date -
blinkCamera.network_id
- camera's assigned sync module id (network id)
Methods
-
blinkCamera.snapPicture
- take a picture with camera to create a new thumbnail -
blinkCamera.setMotionDetect(boolean)
- set motion detection -
blinkCamera.update
- update camera information; internal use -
blinkCamera.imageRefresh
- refresh current thumbnail -
blinkCamera.fetchImageData
- get the image data for the camera's current thumbnail -
blinkCamera.recordClip
- record video clip from the camera
License
MIT