You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

weenect-api

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weenect-api

A NodeJS implementation of the Weenect Pet tracker API

0.0.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

weenect-api

A NodeJS implementation of the Weenect Pet tracker API, inspired by / borrowed from RMHonor's Surepet API and mmende's Homebridge Weenect API

Installation

Just do npm install weenect-api

Usage

In a normal Javascript file, the usage would be as follows, I'll add in the EC alternative once I understand it!

Initialisation

// Import the Module
var Weenect = require('weenect-api');

// Initialise the Module with your credentials
var myWeenect = new Weenect.WeenectClient("username", "password");

Getting an array of trackers on the account

// Return an array of trackers
myWeenect.getTrackers().then((trackers) => {
    console.log("got trackers");

    console.log(trackers)
})

Getting a trackers history between two points in time


// Get The history of a specific tracker
let now = new Date();
var oneHour = 60 * 60 * 1000;
var prev = new Date(now - oneHour);

/* Arguments:

id: Tracker ID
measurement system: 'km' or 'miles'
start: the start date
end: the end data
*/

myWeenect.getTrackerHistory(00001, 'km', prev, now).then((history) => {
    console.log("got history");

    console.log(history)
})


Example Trackers Object:

[
  {
    name: 'Luna',
    id: '123456',
    battery: 66,
    online: true,
    type: 'cat2',
    imei: 000000000000000,
    latitude: 49,
    longitude: -1,
    firmware: 'cat3'
  }
]

Keywords

weenect

FAQs

Package last updated on 19 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts