Giter VIP home page Giter VIP logo

grow-iot's Introduction

Status: Prototype

Grow-IoT on freenode

Please open issues or PRs with suggestions for improvements. Let's make something useful!

Feature Requests

General Feedback

An extensible, open source stack for growing things

Example screenshot

Together with grow.js, Grow-IoT is a full javascript based IoT stack with a simple API and basic user interface. Use it to run your own home network in the cloud, or as the basis for your own IoT app.

After the initial alpha launch, we hope to begin working on problems such as improving the usability and security for configuring devices, creating control systems, splitting up the code base into more useful modules, and contributing useful feedback / code back to W3C Internet of Things interest group.

Installing Grow-IoT

You need to install Meteor if you haven't already. To do so, open your terminal and enter:

curl https://install.meteor.com/ | sh

Then clone the repo, enter the new directory, and start meteor.

git clone https://github.com/CommonGarden/Grow-IoT
cd Grow-IoT
meteor

And that's it! Visit http://localhost:3000 with your browser of choice; you should now have a meteor application running.

Next step: Create an account. You will use the email address you create your account with when you connect to your Grow-IoT instance.

Quickstart

First, make a Grow.JS project for the plant you want to monitor:

mkdir my-cool-plant
cd my-cool-plant
npm init -y
npm install --save grow.js

Now, let's make a file that defines our plant. Be sure to set the 'username' property to the username you created an account with.

plant.js

// Import the grow.js library.
var GrowInstance = require('grow.js');

// Create a new grow instance. Connects by default to localhost:3000
var grow = new GrowInstance({
    "name": "Light", // The display name for the thing.
    "description": "An LED light with a basic on/off api.",
    "state": "off", // The current state of the thing.

    // SET THIS TO THE EMAIL OF THE ACCOUNT YOU CREATED ON THE GROW-IOT APP.
    "username": "YOURUSERNAME", // Eventually we'll have api keys and proper UX for device configuration.
    "actions": [ // A list of action objects
        {
            "name": "On", // Display name for the action
            "description": "Turns the light on.", // Optional description
            "id": "turn_light_on", // A unique id
            "updateState": "on", // Updates state on function call
            "schedule": "at 9:00am", // Optional scheduling using later.js
            "event": "Light turned on", // Optional event to emit when called.
            "function": function () {
                // The implementation of the action.
                // Here we simply log "Light on." See links to hardware
                // examples below to begin using microcontrollers
                console.log("Light on."); 
            }
        },
        {
            "name": "off",
            "id": "turn_light_off",
            "updateState": "off",
            "schedule": "at 8:30pm",
            "event": "Light turned off",
            "function": function () {
                console.log("Light off.");
            }
        }
    ],
    "events": [
        {
            "name": "Light data", // Events get a display name like actions
            "id": "light_data", // An id that is unique to this device
            "type": "light", // Data type. There might be different kinds of events?
            "schedule": "every 1 second", // Currently required
            "function": function () {
                // function should return the event to emit when it should be emited.
                return Math.random();
            }
        }
    ]
}, function start () {
    // Optional Callback function. Calls turn_light_off function on start.
    grow.callAction("turn_light_off");
});

Run the script with:

node plant.js

Next, visit http://localhost:3000 in your browser.

Create a new environment and you should see the device. Click on it to add it to the environment.

Like magic, you will see a generated UI based on the configuration object you passed in.

Example screenshot

If you click on one of the buttons, you should see the appropriate log message in the terminal where you are running plant.js.

Cool! What did I just do?

Well, running plant.js for the first time:

  1. Connects to the Grow-IoT host (ddp).

  2. Registers the device with host server. The information in config object is used to create a UI and API.

  3. Saves state to a file state.json, so if the device powers off or resets, it resumes it's last configuration.

  4. Sets up readable and writable streams and listens for commands.

Full grow.js documentation and examples can be found here.

Setting up an instance on Meteor Galaxy

You can easily host your own Grow-IoT instance on Meteor Galaxy. See the Meteor Galaxy website for instructions on hosting a new meteor application.

See instructions in Grow.js for securely connecting devices to the instance.

Python support

You can interact with the Grow-IoT api using the Python DDP library.

Contributing

Please read:

Reach out

Get involved with our community in any way you are interested:

  • Forum โ€” General discussion and support by the Common Garden community.

License

Grow-IoT is released under the 2-Clause BSD License, sometimes referred to as the "Simplified BSD License" or the "FreeBSD License".

grow-iot's People

Contributors

anaclair avatar arcalinea avatar elsehow avatar jakehartnell avatar mitar avatar

Watchers

 avatar

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.