GithubHelp home page GithubHelp logo

ozzieg / node-red-contrib-particle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chuank/node-red-contrib-particle

0.0 2.0 1.0 53 KB

Node-RED node to connect to Particle devices (currently, Core and Photon). This can be used to connect to Particle clouds and call functions, read variables or listen to events

HTML 46.79% JavaScript 53.21%

node-red-contrib-particle's Introduction

node-red-contrib-particle

Node-RED node to connect to Particle Devices, either via local cloud, or the Particle.io cloud. This can be used to connect to the Particle Core/Photon, call functions, read variables or listen to Server-Sent-Events (SSEs).

Install

npm install node-red-contrib-particle

Usage

Three separate nodes are provided to interact with Particle Devices โ€“ call a function, read a variable and subscribe to SSEs. The nodes have both INPUT and OUTPUTs โ€“ sending appropriate messages (e.g. msg.payload, msg.name) to the INPUT allows you to change the parameters dynamically.

Where appropriate, the OUTPUT provides returned data from the Particle cloud after the query has been made.

Following are the return values:

Function call

  1. msg.raw contains the raw JSON string returned
  2. msg.payload contains the return value of the function
  3. msg.id contains the device id

Read a Variable

  1. msg.raw contains the raw JSON string returned
  2. msg.payload contains the value of the variable
  3. msg.id contains the core id

Subscribe to Server-Sent Events (SSEs)

  1. msg.raw contains the raw JSON string returned
  2. msg.evtname contains the event name published
  3. msg.payload the event data
  4. msg.id contains the core id
  5. msg.published_at contain the published date and time

Local Cloud and SSE Limitations

There are current limitations with the local cloud package from Particle, which prevents any subscription of device-specific and device-and-event-specific events. Effectively, if you are attempting to subscribe to a local cloud, you are currently only able to listen in on the public firehose (ALL SSEs), or on the event-specific public firehose.

An equivalent of such requests using the RESTful API will resemble:

http://particlecloud.local:8080/v1/events/&access_token=123456789abcdef123456789abcdef123456789a

http://particlecloud.local:8080/v1/events/someEvent&access_token=123456789abcdef123456789abcdef123456789a

Credits

This is a forked project that built off @krvarma's node-red-contrib-sparkcore initial work (0.0.12).

Copyright 2015 Chuan Khoo (node-red-contrib-particle 0.0.2) for local cloud SSE (limited) support, configuration node implementation, renaming to Particle, implementation of separate nodes for clarity, and cosmetic fixes.

Copyright 2014 Krishnaraj Varma (node-red-contrib-sparkcore 0.0.12)

node-red-contrib-particle's People

Contributors

chuank avatar krvarma avatar

Watchers

James Cloos avatar  avatar

Forkers

jst1source

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.