Skip to content

Instantly share code, notes, and snippets.

View dpjanes's full-sized avatar

David Janes dpjanes

View GitHub Profile
@dpjanes
dpjanes / Working IoT Policy.json
Last active March 26, 2016 16:30
This one works
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"*"
@dpjanes
dpjanes / IoTPolicy.json
Created March 24, 2016 15:20
Why won't this AWS IoT Policy Work?
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iot:Connect"
],
"Resource": [
"*"
@dpjanes
dpjanes / iotdb-mqtt.js
Created January 15, 2016 16:30
Send IOTDB things to MQTT
/*
make sure to
homestar install iotdb-transport-mqtt
homestar install iotdb-transport-iotdb
(npm install will probably work too)
Further reading on transporter
https://homestar.io/about/transporters
@dpjanes
dpjanes / NetflixChill3.js
Created September 29, 2015 19:45
Netflix & Chill #3 - in JavaScript
things = require('iotdb').connect()
things
.with_facet(":media.tv")
.with_zone("Living Room")
.set(":on", true)
.set(":band", ":band.service.netflix")
things
.with_facet(":lighting")
@dpjanes
dpjanes / NetflixChill2.iotql
Last active September 29, 2015 19:41
Netflix & Chill #2 - with IoTQL and Views
-- CREATE VIEW not implemented yet
CREATE VIEW
LivingRoom
WHERE
meta:zone & "Living Room";
CREATE ACTION
NetflixChill
BEGIN
UPDATE
@dpjanes
dpjanes / NetflixChill1.iotql
Created September 29, 2015 19:35
Netflix & Chill - IoTQL Example (1)
-- this assumes that the TV supports Netflix (my LG does)
CREATE SCENE
NetflixChill
BEGIN
SET
state:on = true,
state:band = iot-attribute:band.service.netflix
WHERE
meta:facet & iot-facet:media.tv;
AND
@dpjanes
dpjanes / gist:2f4cebe6a6d7aaa14ede
Last active September 17, 2015 21:24
IOTQL Example - Turn on LED when Button Pressed
CREATE THING JohnnyFiveButton WITH pin = 4, meta:name = "The Button";
CREATE THING JohnnyFiveLED WITH pin = 6, meta:name = "The LED";
CREATE RULE
LED
WHERE
meta:name = "The Button"
BEGIN
SET
state:on = $_$state:on
@dpjanes
dpjanes / repeat-3.js
Created August 10, 2015 21:33
Cookbook / Recipe Example
/*
* repeat-3.js
*
* David Janes
* IOTDB.org
* 2014-12-30
*
* This will broadcast Count=0, Count=1, Count=3
* when pushed.
*/
@dpjanes
dpjanes / hue-light
Last active May 2, 2019 01:36
HueLight JSON-LD
{
"@context": {
"@base": "file:///hue-light",
"@vocab": "file:///hue-light#",
"iot": "https://iotdb.org/pub/iot#",
"schema": "http://schema.org/",
"iot-attribute": "https://iotdb.org/pub/iot-attribute#"
},
"@id": "",
"@type": "iot:Model",
{
"@context": {
"@base": "http://example.com/th",
"@vocab": "http://example.com/th",
"iot": "https://iotdb.org/pub/iot#",
"schema": "http://schema.org/",
"iot-attribute": "https://iotdb.org/pub/iot-attribute#"
},
"@type": "iot:Model",
"iot:attribute": [