Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function testDevice (u, t) {
var testDevice = new Thing({
// PUT YOUR UUID AND TOKEN HERE OR SUPPLY THEM AS ARGUMENTS
uuid: u,
token: t,
component: 'TestDevice',
properties: {
state: 'off',
interval: 3000
},
start: function () {
setInterval(()=> {
testDevice.call('temp_data');
}, this.get('interval'));
},
let Thing = require('Grow.js');
let testDevice = new Thing({
uuid: 'test',
token: 'test',
component: 'Thermostat',
// Properties can be updated by the API
properties: {
state: 'off',
growfile: {
temperature: {
min: 1,
ideal: 4,
max: 9,
pid: {
k_p: 300,
k_i: 0,
function testDevice (u, t) {
var testDevice = new Thing({
// PUT YOUR UUID AND TOKEN HERE OR SUPPLY THEM AS ARGUMENTS
uuid: u,
token: t,
component: 'TentacleExample',
properties: {
interval: 3000,
growfile: {
ph: {
min: 4.0,
max: 7.0,
},
ec: {
min: 700,
max: 1400,
},
function createGrowHub(u, t) {
const growHub = new Thing({
uuid: u,
token: t,
component: 'GrowMobile',
// Properties can be updated by the API
properties: {
state: 'off',
light_state: 'off',
fan_state: 'off',
pump_state: 'off',
threshold: 300,
interval: 3000,
currently: null,
lightconditions: null,
growfile: {
phases: {
board.on('ready', function start() {
var data_interval,
water_temp;
// This requires OneWire support using the ConfigurableFirmata
var thermometer = new five.Sensor('A0');
thermometer.on('change', function(value) {
console.log(value);
// water_temp = this.celsius;
});
// Create a new grow instance and connect to https://grow.commongarden.org
var grow = new Grow({
uuid: 'meow',
token: 'meow',
component: 'Thermostat',
// Properties can be updated by the API
properties: {
state: 'off',
growfile: {
temperature: {
min: 22,
ideal: 27,
max: 29,
pid: {
k_p: 300,
k_i: 0,
// See node-webcam docs for additional instructions.
// https://www.npmjs.com/package/node-webcam
const NodeWebcam = require( 'node-webcam' );
const Thing = require('Grow.js');
const fs = require('fs');
const opts = {
width: 1280,
height: 720,
delay: 0,
quality: 100,
output: 'jpeg',
verbose: true
}
const cam = new Thing({
properties: {
name: 'Camera',
interval: 100000
},
picture: function () {
NodeWebcam.capture( 'image', opts, ( err, data )=> {
if ( !err ) console.log( 'Image created!' );
fs.readFile('./' + data, (err, data) => {
if (err) throw err; // Fail if the file can't be read.
this.sendImage(data);
});
});
},
start: function () {
board.on('ready', function start() {
let data_interval,
water_temp;
// This requires OneWire support using the ConfigurableFirmata
let thermometer = new five.Thermometer({
controller: 'DS18B20',
pin: 4
});
thermometer.on('change', function() {
water_temp = this.celsius;
});
// Create a new grow instance and connect to https://grow.commongarden.org
let grow = new Grow({
uuid: 'meow',
token: 'meow',
component: 'Thermostat',
// Properties can be updated by the API
properties: {
state: 'off',
growfile: {
temperature: {
min: 22,
ideal: 27,
max: 29,
pid: {
k_p: 300,
k_i: 0,
var pH_reading,
eC_reading,
data_interval,
acidpump = new five.Pin('P1-11'),
basepump = new five.Pin('P1-12'),
nutrientpump = new five.Pin('P1-13');
// Hack: Relays are inversed... make sure pumps are off.
// Better hardware could take care of this... I'm not an electrical engineer.
acidpump.high();
basepump.high();
nutrientpump.high();
// Create a new grow instance and connect to https://grow.commongarden.org
var grow = new Grow({
uuid: '3080d548-a52e-4e08-9904-973c035533c9',
token: 'rwJYs9ufZL2A53R8nQpnxwHjjY44eDXq',
component: 'DrDose',
// Properties can be updated by the API
properties: {
growfile: {
ph: {
min: 6.0,
ideal: 6.15,
max: 6.3,
pid: {
k_p: 0.25,
k_i: 0.01,
k_d: 0.01,
board.on('ready', function start() {
// Define variables
var power = new five.Pin(11),
LED = new five.Pin(13),
lightSensor = new five.Sensor('A1');
power.high();
// Create a new thing.
var light = new Thing({
uuid: 'testmeow',
token: 'testmeow',
component: 'SmartLight',
properties: {
state: 'off',
threshold: 300,
interval: 1000,
currently: null,
lightconditions: null,
cycles: {
day: {
schedule: 'after 7:00am'
},
night: {
board.on('ready', function start() {
// Define variables
var power = new five.Pin(11),
LED = new five.Pin(13),
lightSensor = new five.Sensor('A1');
power.high();
// Create a new thing.
var light = new Thing({
uuid: 'meow',
token: 'meow',
component: 'SmartLight',
properties: {
state: 'off',
threshold: 300,
interval: 1000,
currently: null,
lightconditions: null,
cycles: {
day: {
schedule: 'after 7:00am'
},
night: {