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

esp8266-iotjs

v0.0.4

Published

Package for control Esp8266 (with loaded ESP8266 olimex IoT firmware ) over WebSocket.

Downloads

3

Readme

ESP8266-IoTJS

Package for control ESP8266-EVB (with loaded ESP8266 olimex IoT firmware ) over WebSocket. Npm package link

Use at your own risk, it is Beta 0.0.1

Work properly with only one board connected to host at the time

only work with

  • Relay
  • Button
  • MOD-TC-MK2-31855 - temperature sensor (K-TYPE THERMOCOUPLE)
  • more comming soon ++

Events

  • Board:
    • ready (when web socket is open for requests)
    • push (Is triggered when button is pressed)
  • Relay:
    • relayStateIsChange (Is triggered when relay state is change)
  • MOD-TC-MK2-31855 - temperature sensor
    • temperature (Return temperature value of MOD-TC-MK2-31855 module.Event trriger is based on your Poll settings on web based config page of the firmware)
  • Finger Print Sensor
    • onFingerPrintDetected - When finger print is detected.

Methods

  • Relay module:
    • setRelayState(param) - Change relay state with giving param, accept (1 or 0)
    • relayOn() - TurnOn the relay
    • relayOff() - TurnOff the relay
    • relayToggle() - Toggle relay state
  • MOD-TC-MK2-31855 - temperature sensor
    • getTemperature() - Force emit temperature event to handle temperature.

Requirements

To use this you have to

  1. Use Olimex IoT Firmware on your ESP8266-EVB - Link
  2. Configure your computer as IoT Server using ESP-Sample-Application.html-link
    • Select IoT tab
    • Check WebSocket
    • Uncheck SSL
    • Set Server to your computer IP address
    • Leave everything else blank
    • (optimal) Fill name -- required for next updates
    • (optimal) Fill token -- required for next updates

3.Type following commands , but make sure you have already installed NPM and NodeJS

npm install esp8266-iotjs
  1. Require 'esp8266-iotjs' in your code:
var esp8266 = require('esp8266-iotjs');
var board = new esp8266();

board.on("push",function(){
    console.log("button is pushed");
});

####Or

var esp8266 = require('esp8266-iotjs');
var board = new esp8266();

board.on('push',function(){
    this.relayToggle();
});

####Or if you wish make a termostat:

var ESP8266EVB = require('esp8266-iotjs');
var board = new ESP8266EVB();
var targetTemperature = 31;
var relayState = 0;
board.on('ready,function(){
    board.on('temperature',function(temperature){
        if(temperature < targetTemperature && relayState == 0){
            board.relayOn();
        }else if (temperature > targetTemperature && relayState == 1){
            board.relayOff();
        }
    });
});