npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

alexa-iot-helper

v1.0.12

Published

Work with aws-iot-client. The alexa-iot-helper is used to simply update device state on thing shadow. Currently, support monitor on\off, media player control, system shutdown

Downloads

23

Readme

alexa-iot-helper

Work with aws-iot-client. The alexa-iot-helper is used to simply update device state on thing shadow.
Currently, support monitor on\off, media player control, system shutdown

Installation

npm install alexa-iot-helper

API

var alexaIotHelper = require('alexa-iot-helper');

ctrMonitor(iotdata)

Create a new ctrMonitor object by the given iotdata. For example, assume we want to create an iot-helper object to control our monitor, we can use the following code

var alexaIotHelper = require('alexa-iot-helper').ctrMonitor;
var monitor = new alexaIotHelper(iotdata);

ctrMediaPlayer(iotdata)

Create a new ctrMediaPlayer object by the given iotdata. For example, assume we want to create an iot-helper object to control our music player, we can use the following code

var alexaIotHelper = require('alexa-iot-helper').ctrMediaPlayer;
var player = new alexaIotHelper(iotdata);

.ctrMonitor.turnOff(clientId, callback)

Update thingshadow by clientId for monitor off and process callback function.

.ctrMonitor.turnOn(clientId, callback) {

Update thingshadow by clientId for monitor on and process callback function.

.ctrMediaPlayer.play(clientId, callback) {

Update thingshadow by clientId for passing play message to the media player and process callback function.

.ctrMediaPlayer.pause(clientId, callback) {

Update thingshadow by clientId for passing pause message to the media player and process callback function.

.ctrMediaPlayer.next(clientId, callback) {

Update thingshadow by clientId for passing next message to the media player and process callback function.

.ctrMediaPlayer.pre(clientId, callback) {

Update thingshadow by clientId for passing pre message to the media player and process callback function.

ctrSystem(iotdata)

.ctrSystem.shutdown(clientId, callback)

Update thingshadow by clientId for system shutdown and process callback function.

.ctrSystem.shutdownAsync(clientId, callback)

Update thingshadow by clientId for system shutdown asynchronizely

Examples

This simple example shows how to use alexa-iot-helper to change device status on the cloud. First, we create the object of the iotdata via aws-sdk with particular endpoint loaded from iotConfig.json

//iotConfig.json
{
    "endpoint": "ef3423d1pm93tna.iot.us-east-1.amazonaws.com"
}

After that, inject iotdata into alexaIotHelper.

Here is the sample code.


/*  Initialize   */
//require aws sdk
var AWS = require("aws-sdk");
AWS.config.update({ region: 'us-east-1' });

//create iotdata object
const endpoint = require('./iotConfig');
var iotdata= new AWS.IotData(endpoint);

//require alexa-iot-helper 
// and create an object for monitor control
var alexaIotHelper = require('alexa-iot-helper').ctrMonitor;
var monitor = new alexaIotHelper(iotdata);


//monitor control, update device status on cloud
monitor.turnOn("clientId", function () {
  //Do something
}); 

Release Note:

v1.0.12

Support Shutdown system asynchronizely