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

nomiku

v0.3.3

Published

Client library for controlling Nomiku WiFi devices

Downloads

4

Readme

Nomiku JavaScript SDK

This library provides a simple interface to control your WiFi Nomiku. Currently compatible with node v6.x.x

Installing

Installing is as easy as:

npm install --save nomiku

Example

Some example usage:

var NomikuClient = require("nomiku");

var nomiku = new NomikuClient();

nomiku.on("state", function({ state }) {
  console.log("State: " + JSON.stringify(state));
});

nomiku.connect({
  email: process.env.TENDER_EMAIL,
  password: process.env.TENDER_PASSWORD
});

nomiku.on("connect", function() {
  nomiku.set().on();
  nomiku.set().setpoint(55.0);
});

On connect, the client grabs the login token and the list of devices and starts listening to the default device indicated in Tender. It will return the state whenever it changes.

See longer examples in the examples directory

Getting the state

The state event is documented in the API, but the further details of the state object are:

| Name | Type | Description | | --- | --- | --- | | recipeID | number | Recipe ID currently cooking | | recipeTitle | string | Indicates whether the state has been emitted before | | setpoint | number | Set temperature in °C | | showF | boolean | True if temp should be displayed in °F | | state | number | -1: offline, 0: online but not heating/circulating, 1: online and running | | temp | number | Current temperature in °C | | timerEnd | number | Timer end time in UTC seconds (if timer is running) | | timerRunning | boolean | Whether timer is running | | timerSecs | number | Time remaining in seconds (if timer is not running) |

Setting the state

The most straightforward way to update the state is to pass a new state object (only changed keys need to be included) to the set function of device id (omit id to use default device):

nomiku.set(id).state(state)

A number of other convenience functions were created on top of nomiku.set(id):

  • .off() turns off the device
  • .on() turns on the device
  • .setpoint(setpoint) changes setpoint to setpoint in °C
  • .timer.start() starts the timer
  • .timer.stop() stops the timer
  • .timer.set(secs) stops the timer and sets it to secs seconds
  • .units(unit) changes displayed units, unit is either the char 'C' or 'F'
  • .recipe(recipe) starts cooking a new recipe, where recipe has properties:

| Name | Type | Description | | --- | --- | --- | | id | number | (optional) Recipe ID | | title | string | (optional) Recipe title | | temp | number | Set temperature in °C | | time | number | Number of seconds for the timer |

Client API

Functions

Client

Kind: global class

new Client(options)

The Nomiku Client controls the connection to the Nomiku. Descends from EventEmitter

| Param | Type | Description | | --- | --- | --- | | options | Object | The option object. Can also be passed to connect. | | options.email | string | tender account email (for email, password login) | | options.password | string | tender account password (for email, password login) | | options.userID | string | ID of the user (for token login) | | options.apiToken | string | API token (for token login) |

"event:connect"

Successfully connected

Kind: event emitted by Client

"event:close"

Connection is closed

Kind: event emitted by Client

"event:state"

New state

Kind: event emitted by Client
Properties

| Name | Type | Description | | --- | --- | --- | | id | number | Tender ID of device | | new | boolean | Indicates whether the state has been emitted before | | state | object | Latest state | | provisional | object | Dict with same keys as state, key is true if it is unconfirmed | | valid | boolean | Indicates whether the state is valid |

connect(options)

Connects to server for streaming data

Kind: global function

| Param | Type | Description | | --- | --- | --- | | options | Object | The option object Options: | | options.email | string | tender account email (for email, password login) | | options.password | string | tender account password (for email, password login) | | options.userID | string | ID of the user (for token login) | | options.apiToken | string | API token (for token login) | | options.defaultDevice | string | number | (optional) default device to connect to | | options.devices | array | (optional) array of devices, {hwid,id,name} | | options.verboseState | boolean | (optional) will send state event with every message |

auth(options)

Gets API token from tender

Kind: global function

| Param | Type | Description | | --- | --- | --- | | options | object | Info needed to auth with Tender API (email/password) |

loadDevices()

Gets device list from Tender

Kind: global function

getDefaultDevice()

Gets default device from Tender

Kind: global function

listen(id)

Listens for state on device

Kind: global function

| Param | Type | Description | | --- | --- | --- | | id | string | number | Tender ID of nomiku to listen to |

set(id)

Set state on device

Kind: global function

| Param | Type | Description | | --- | --- | --- | | id | string | number | Tender ID of nomiku to set |