This is a Node.js version of this python library. It allows to communicate with Blink Home Security System from a Node.js application.
npm install node-blink-security
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);
});
class Blink
email
- your Blink account emailpassword
- your Blink account passworddeviceId
- 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
blink.cameras
- the information about all available camerasblink.idTable
-{cameraId:cameraName}
map for further referencesblink.networks
- map of configured networks (sync modules)blink.accountId
- account idblink.region
- region (e.g.prod
)blink.regionId
- region (e.g.United States
)
blink.refresh
- get all blink cameras and pulls their most recent statusblink.getSummary
- get a full summary of system information, broken down by sync moduleblink.getCameraThumbs
- refresh all cameras thumbnailsblink.getVideos(page, Date)
- get metadata for X (per page is unknown) videos recorded sinceDate
. Paginate withpage
parameterblink.getEvents
- get all events from Blink server (e.g. heartbeats, motion...), by sync moduleblink.isOnline
- return boolean system online status, by sync moduleblink.getLastMotions
- refresh motion events datablink.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 defaultblink.getCameras
- find and creates cameras; used for internal purposesblink.getLinks
- set access links and required headers for each camera in system; used for internal purposesblink.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 purposeblink.getClients
- get information about devices that have connected to the system
class BlinkCamera
blinkCamera.id
- camera idblinkCamera.name
- camera nameblinkCamera.region_id
- region idblinkCamera.armed
- camera arm statusblinkCamera.clip
- current clipblinkCamera.thumbnail
- current thumbnailblinkCamera.temperature
- camera temperatureblinkCamera.battery
- battery levelblinkCamera.notifications
- number of notificationsblinkCamera.image_link
- image linkblinkCamera.arm_link
- link to arm camerablinkCamera.header
- request headerblinkCamera.motion
- last motion event detailblinkCamera.updated_at
- last device update dateblinkCamera.network_id
- camera's assigned sync module id (network id)
blinkCamera.snapPicture
- take a picture with camera to create a new thumbnailblinkCamera.setMotionDetect(boolean)
- set motion detectionblinkCamera.update
- update camera information; internal useblinkCamera.imageRefresh
- refresh current thumbnailblinkCamera.fetchImageData
- get the image data for the camera's current thumbnailblinkCamera.recordClip
- record video clip from the camera
MIT