Git Product home page Git Product logo

sensornode's Introduction

SensorNode

SensorNode-client application for IOTA.

Either data is being pushed to Tangle or send as Masked Authenticated Message, or both.

(Image by Wyn Tiedmers)

Installation:

Clone this repository:

git clone https://github.com/rckey/SensorNode

Install node_modules:

cd SensorNode/
npm install

Install mam.node.js:

cd node_modules/
git clone https://github.com/rckey/mam.node.js

Creating streams:

You can create streamobjects with the following parameters:

Parameters:
Parameter Function Default
host (Remote-) node we're connecting to. 0.0.0.0
port Iota-api port on the node. 14265
id Identifies the streamobject. "SensorNode"
location Nodes location, eg. 'lat': 52.26 'lng': 13.42. {'lat': 40.65, 'lng': -73.91}
seed Seed for creating transactions/MAM-messages. [generated]
rec Receiving address (tanglestream only). "GPB9PBNCJTPGF..."
tag Tag for Transactions (tanglestream only). "SENSORNODEROCKS"
depth Depth for tip-selection (tanglestream only). 3
wait Discards packets till the current packet has been send. true
fetch Enable continuous fetching from MAM-root when multiple nodes stream from the same seed (mamstream only). false

First Stream (TANGLE):

streams.push(new STREAM ({
  'host': 'http://[remote node / localhost]',
  'port':  [port]

  [OPTIONAL PARAMETERS]

}))

Second Stream (MAM):

streams.push(new MAM_STREAM ({
  'host': 'http://[remote node / localhost]',
  'port':  [port]

  [OPTIONAL PARAMETERS]

}))

Add data sources

Data sources are (async) functions which return the data you want to stream, eg:

async function functionFoo () {
	return await sensorA.read();
}
async function functionBar () {
	return await sensorB.read();
}
streams[0].addSource(functionFoo);
streams[1].addSource(functionBar);

Cool! Whats next?

Run with npm start [delay] where delay specifies a timeout between each push (default 60 seconds).

Thats it. Have fun providing data over the iota protocol. ;)

sensornode's People

Contributors

r-c-k avatar rckey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sensornode's Issues

App launch problem

npm app will not start the app. Is it node app ? But then I get the error

`node app
module.js:538
throw err;
^

Error: Cannot find module 'iota.lib.js'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (/SensorNode/utils/stream.js:5:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.