GithubHelp home page GithubHelp logo

ruuvi-nodejs's Introduction

NOTICE

As of right now, changes in FFI interface prevent ccurl.interface.js from compiling in NodeJS 9+ Please use NodeJS 8.9.4

Usage

Program searches for RuuviTag which has Nordic UART service enabled and automatically connects to first RuuviTag it finds. Please update the RuuviTag with MAM-firmware.

Sometimes there is issue with Bluetooth stack, and you'll need to run sudo hciconfig hci0 reset. Replace the HCI interface number if applicable.

A simple command line interface is given. User is given option to setup temperature sensor for a single-shot measurement, continous measurement (once per second) and querying temperature in plain text. User can also send a MAM query, which will trigger reading environmental data and soon the environmental data is sent from RuuviTag with MAM coding.

The example program publishes MAM data to tangle to fixed address defined in example.js.

You can observe the state of RuuviTag by RED LED, if the led is on or blinking there is activity going on.

After installing, run node example.js

Dependencies

NodeJS, npm

NOTE: This modifies your global NodeJS and NPM versions. Update NodeJS to 8.9.4 with instructions found at https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version . i.e.

sudo npm cache clean -f
sudo npm install -g n
sudo n 8.9.4
sudo ln -sf /usr/local/n/versions/node/8.9.4/bin/node /usr/bin/node
curl -0 -L https://npmjs.com/install.sh | sudo sh

This repository is tested on nodejs 8.9.4, check your version with node --version

Noble

Noble repositry npm install noble sudo setcap cap_net_raw+eip $(eval readlink -f \which node`)`

iota.lib.js, ruuvi.endpoints.js ccurl.interface.js

git submodule update --init --recursive

npm install iota.lib.js

npm install ccurl.interface.js

cp raspberrypi-bin/libbcurl.so node_modules/ccurl.interface.js

Sleep

npm install sleep

ccurl

Install ccurl according to instructions published on NPM. For your convenience binaries are provided for Raspberry Pi and 64-bit debian.

Licensing

  • Ruuvi / Ojousima: BSD-3
  • iota libs: MIT
  • BLE-UART: Unknown, please refer to source
  • Noble: MIT

ruuvi-nodejs's People

Contributors

ojousima avatar ojousima-jenkins avatar

Stargazers

Doug A avatar Chris avatar Vijaya Kumar Bhavani avatar  avatar Antonio Nardella avatar Vimal avatar Erwin Rooijakkers avatar Zauz avatar  avatar Sebastian Fuchs avatar Sabas avatar Christopher Aldave avatar Tim avatar 0x1 avatar Xavier Baldacci avatar

Watchers

James Cloos avatar Xavier Baldacci avatar  avatar amplicade avatar Zauz avatar

ruuvi-nodejs's Issues

Cannot Get example.js working.

I've followed all the steps to the best of my ability up until "node example.js" in the ruuvi-nodejs directy. This is what I get when trying to run...

image

Cannot run example.js

I did every step and when I tried to run example.js I got this issue:

pi@raspberrypi:~/Desktop/iota/ruuvi-nodejs $ sudo node example.js
/home/pi/Desktop/iota/ruuvi-nodejs/iota-mam/iota-mam.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB

Error: Cannot find module 'ccurl.interface.js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object. (/home/pi/Desktop/iota/ruuvi-nodejs/example.js:15:15)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)

I installed ccurl as NPM says but still happen

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.