UNPKG

nomiku-js

Version:

A NodeJS module for interacting the a WiFi Nomiku and the Nomiku Tender service

3,284 lines (798 loc) 33.8 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Nomiku</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Nomiku</h1> <section> <header> <h2>Nomiku</h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Nomiku"><span class="type-signature"></span>new Nomiku<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Creates a new Nomiku adapter </div> <h5 class="subsection-title">Properties:</h5> <table class="props"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>STATE_ON</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The value to indicate that a unit is "ON"</td> </tr> <tr> <td class="name"><code>STATE_OFF</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The value to indicate that a unit is "OFF"</td> </tr> <tr> <td class="name"><code>STATE_OFFLINE</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The value to indicate that a unit is "OFFLINE"</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line39">line 39</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="auth"><span class="type-signature"></span>auth<span class="signature">(email, password, cb)</span><span class="type-signature"></span></h4> <div class="description"> Authenticates and grabs an access token </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>email</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">email to login to the Nomiku API with</td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">password for the login</td> </tr> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">authenticateCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line166">line 166</a> </li></ul></dd> </dl> <h4 class="name" id="CtoF"><span class="type-signature"></span>CtoF<span class="signature">(c)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Converts temperatures in Celcius to Farenheight </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>c</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The temp value in degrees Celcius</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line434">line 434</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The converted temperature in Farenheight </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id="debug"><span class="type-signature"></span>debug<span class="signature">(arg)</span><span class="type-signature"></span></h4> <div class="description"> Manually sets if debugging is on or off </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>arg</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">The future state of the debugger's on state</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line78">line 78</a> </li></ul></dd> </dl> <h4 class="name" id="FtoC"><span class="type-signature"></span>FtoC<span class="signature">(f)</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Converts temperatures in Farenheight to Celcius </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>f</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The temp value in degrees Farenheight</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line446">line 446</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The converted temperature in Celcius </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(variableName, cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs an arbitrary variable value </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>variableName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the variable name to grab</td> </tr> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line249">line 249</a> </li></ul></dd> </dl> <h4 class="name" id="getDevices"><span class="type-signature"></span>getDevices<span class="signature">(email, password, cb)</span><span class="type-signature"></span></h4> <div class="description"> Authenticates and grabs an access token </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>email</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">email to login to the Nomiku API with</td> </tr> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">password for the login</td> </tr> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">authenticateCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line208">line 208</a> </li></ul></dd> </dl> <h4 class="name" id="getReceipeID"><span class="type-signature"></span>getReceipeID<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs the most recent recipe ID </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line390">line 390</a> </li></ul></dd> </dl> <h4 class="name" id="getSetPoint"><span class="type-signature"></span>getSetPoint<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs the most recent set point temperature in Celcius </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line379">line 379</a> </li></ul></dd> </dl> <h4 class="name" id="getState"><span class="type-signature"></span>getState<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs the most recent state (0 = off, 1 = on, -1 = offline) </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line357">line 357</a> </li></ul></dd> </dl> <h4 class="name" id="getTemp"><span class="type-signature"></span>getTemp<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs the most recent temperature in Celcius </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line368">line 368</a> </li></ul></dd> </dl> <h4 class="name" id="getToken"><span class="type-signature"></span>getToken<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> Returns the current apiToken </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line153">line 153</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The current apiToken / access token </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="getVersion"><span class="type-signature"></span>getVersion<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Grabs the most recent version </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line401">line 401</a> </li></ul></dd> </dl> <h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(variableName, value, cb)</span><span class="type-signature"></span></h4> <div class="description"> Sets an arbitrary variable value </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>variableName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the variable name to set</td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the value to set the variable to</td> </tr> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line299">line 299</a> </li></ul></dd> </dl> <h4 class="name" id="setDebug"><span class="type-signature"></span>setDebug<span class="signature">(arg)</span><span class="type-signature"></span></h4> <div class="description"> Manually sets if debugging is on or off </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>arg</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="description last">The future state of the debugger's on state</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line61">line 61</a> </li></ul></dd> </dl> <h4 class="name" id="setDeviceID"><span class="type-signature"></span>setDeviceID<span class="signature">(id)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Manually sets the device ID </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the device ID to use</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line131">line 131</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if a id is provided. False otherwise </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="setSetPoint"><span class="type-signature"></span>setSetPoint<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Sets the current temperature set point in Celcius of the device </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line423">line 423</a> </li></ul></dd> </dl> <h4 class="name" id="setState"><span class="type-signature"></span>setState<span class="signature">(cb)</span><span class="type-signature"></span></h4> <div class="description"> Sets the current state of the device </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>cb</code></td> <td class="type"> <span class="param-type">getSetCallback</span> </td> <td class="description last">The callback that handles the response.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line412">line 412</a> </li></ul></dd> </dl> <h4 class="name" id="setToken"><span class="type-signature"></span>setToken<span class="signature">(apiToken)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Manually sets a token </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>apiToken</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the API token to use</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line91">line 91</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if a token is provided. False otherwise </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id="setUserID"><span class="type-signature"></span>setUserID<span class="signature">(id)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Manually sets a userID </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the user ID to use</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line111">line 111</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true if a id is provided. False otherwise </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h3 class="subsection-title">Type Definitions</h3> <h4 class="name" id="authenticateCallback"><span class="type-signature"></span>authenticateCallback<span class="signature">(error)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type">Boolean</span> | <span class="param-type">object</span> </td> <td class="description last">False if no error occured; an error obejct if an error did occur</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line464">line 464</a> </li></ul></dd> </dl> <h4 class="name" id="getSetCallback"><span class="type-signature"></span>getSetCallback<span class="signature">(error, value)</span><span class="type-signature"></span></h4> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>error</code></td> <td class="type"> <span class="param-type">Boolean</span> | <span class="param-type">object</span> </td> <td class="description last">False if no error occured; an error obejct if an error did occur</td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">the value returned from the get request if an error did not occur</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nomiku.js.html">nomiku.js</a>, <a href="nomiku.js.html#line470">line 470</a> </li></ul></dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-nomiku-js.html">nomiku-js</a></li></ul><h3>Classes</h3><ul><li><a href="Nomiku.html">Nomiku</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Sat Feb 13 2016 10:09:18 GMT-0800 (Pacific Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>