Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

relayr

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

relayr

Relayr sensor SDK for node

  • 0.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
2
Weekly downloads
 
Created
Source

node-relayr

Relayr sensor SDK for node.

Works by connecting to the MQTT channel associated with your Relayr connected device.

Status

This is still not much more thatn a utiity script, but will grow to expose a lot more useful functionality.

installation

npm install relayr

connecting

Require the module

var Relayr = require('relayr');

Get the following from your account at relayr.io

var app_id = "YOURAPPID";
var dev_id = "YOURDEVICEID";
var token  = "YOURSENSORTOKEN";

Initialise the libary

var relayr = new Relayr(app_id);

Connect using the keys:

relayr.connect(token, dev_id);

Listen and do stuff

relayr.on('data', function (topic, msg) {
        console.log(topic + ":" + msg);
}

Send a Command

relayr.command(token, dev_id, 
    {
        path:"led", 
        command:"led", 
        value:true
    }, 
    function (err,code) {
        console.log(err||code)
    });

get Info about the registered user

relayr.user(token, function (err, user) {
    console.log(err || user);
}

get Info about the users devices

relayr.devices(user_id, token, function (err, devices) {
    console.log(err || devices);
}

get Info about the an individual device

relayr.deviceModel(token, dev_id, function (err, model) {
    console.log(err || model);
}

Credits

Big thanks to BinaryMax for putting in the ground work

License

MIT License

Keywords

FAQs

Package last updated on 27 Feb 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc