Skip to content

Instantly share code, notes, and snippets.

View hardillb's full-sized avatar
🚴‍♂️
Suitably Employed

Ben Hardill hardillb

🚴‍♂️
Suitably Employed
View GitHub Profile
@hardillb
hardillb / 78-digiRGB.html
Last active December 23, 2015 03:28
Digispark RGB Node-RED node Use git clone to check this out into the node-red/nodes/hardware directory After you will need to run npm install node-hid in the node-red directory to add the required dependencies
<!--
Copyright 2013 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@hardillb
hardillb / 79-SensorTag.html
Last active December 26, 2015 09:08
Ti SensorTag Node-red node, it depends on the sensortag and noble nodes run "npm install sensortag@https://api.github.com/repos/hardillb/node-sensortag/tarball'' in the node red directory Put these 2 files in nodes/hardware directory. You will need to apt-get libbluetooth-dev to get noble to build during the npm install
<!--
Copyright 2013 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@hardillb
hardillb / test.js
Created October 23, 2013 21:14
Example Sensorttag node app
var SensorTag = require('sensortag');
var node = {};
console.log("starting");
SensorTag.discover(function(sensorTag){
console.log("discovered: " + sensorTag);
console.log(tag);
node.st = tag;
Verifying that +hardillb is my blockchain ID. https://onename.com/hardillb
@hardillb
hardillb / wemo-events.js
Created January 14, 2015 12:16
Wemo Event listener - Get events when sockets and lights turn on and off - Run "npm install node-ssdp express body-parser xml2js request" to install the pre-reqs. It only listens for 10mins at the moment, I'll do subscription updates when I bundle it all into a node module
var Client = require('node-ssdp').Client;
var http = require('http');
var url = require('url');
var request = require('request');
var express = require('express');
var bodyparser = require('body-parser');
var os = require('os');
var xml2js = require('xml2js');
var util = require('util');
<html>
<head>
<title>Push button, send message</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.1/mqttws31.js" type="text/javascript"></script>
</head>
<body>
<button onclick="sendMessage();">Push Me</button>
<script type="text/javascript">
var clientID = "ID-" + Math.round(Math.random() * 1000);
var client = new Paho.MQTT.Client(location.hostname, Number(location.port), clientID);
@hardillb
hardillb / wemo-light.js
Last active November 3, 2016 08:08
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-light.js" for instructions
var wemo = require('wemo-js');
var http = require('http');
var util = require('util');
var xml2js = require('xml2js');
var postbodyheader = [
'<?xml version="1.0" encoding="utf-8"?>',
'<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">',
'<s:Body>'].join('\n');
@hardillb
hardillb / Wemo-Osram Lights capabilities
Created October 31, 2015 10:50
A list of available capabilities and a description of their fields
{ CapabilityProfileList:
{ CapabilityProfile:
[ { CapabilityID: [ '10006' ],
CapabilitySpec: [ 'ZigBee' ],
CapabilityProfileName: [ 'OnOff' ],
CapabilityAttrName: [ 'OnOff' ],
CapabilityDataType: [ 'IntegerSet' ],
CapabilityNameValue: [ '{Off:0,On:1,Toggle:2}' ],
CapabilityControl: [ 'RW' ] },
{ CapabilityID: [ '10008' ],
@hardillb
hardillb / bridgeservice.xml
Created March 17, 2017 00:19
The uPnP descriptor for the WeMo Link ZigBee bridge
<?xml version="1.0"?>
<scpd xmlns="urn:Belkin:service-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<actionList>
<action>
<name>OpenNetwork</name>
<argumentList>
@hardillb
hardillb / ConvertedXML.xml
Created March 17, 2017 15:02
The SOAP command to create a Light Group on a Wemo Link ZigBee Bridge
<?xml version="1.0" encoding="UTF-8"?>
<CreateGroup>
<GroupID>1489757700</GroupID>
<GroupName>Lighting Group</GroupName>
<DeviceIDList>94103EA2B278030F,94103EA2B27803ED</DeviceIDList>
<GroupCapabilityIDs>10008,10006,30008,30009,3000A</GroupCapabilityIDs>
<GroupCapabilityValues>255:0,0,,,</GroupCapabilityValues>
</CreateGroup>