Skip to content

Instantly share code, notes, and snippets.

Ben Hardill hardillb

Block or report user

Report or block hardillb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hardillb
hardillb / usb-rndis.sh
Last active Feb 24, 2020
A script to configure libcomposite USB Ethernet Gadget that will be recognised by Windows based on https://github.com/RoganDawes/P4wnP1/blob/62b5c40d9461e4b80998c54830625d6c855833f0/boot/init_usb.sh
View usb-rndis.sh
#!/bin/bash
cd /sys/kernel/config/usb_gadget/
mkdir -p pi4
cd pi4
echo 0x1d6b > idVendor # Linux Foundation
echo 0x0100 > idProduct # change to get Windows to rescan while testing
echo 0x0100 > bcdDevice # v1.0.0
echo 0x0200 > bcdUSB # USB2
@hardillb
hardillb / Dockerfile
Last active Nov 20, 2019
Mosquitto + auth_plugin + mongo
View Dockerfile
FROM ubuntu:16.04
MAINTAINER Ben Hardill <hardillb@gmail.com>
ENV DEBIAN_FRONTEND noninteractive
USER root
RUN apt-get update && apt-get install -y \
pkg-config \
@hardillb
hardillb / rebootGW.js
Created Aug 14, 2019
code to reboot a Ikea Tradfri gateway
View rebootGW.js
const trad = require('node-tradfri-client');
const TradfriClient = trad.TradfriClient;
const psk = "the psk stored in the QR code on bottom of GW";
const ip = "IP address of GW"; // you find this with avahi
const client = new TradfriClient(ip);
//console.log(client);
client.authenticate(psk).then( (creds) => {
@hardillb
hardillb / Notes
Last active Feb 22, 2018
Notes on IKEA TRÅDFRI Smart Lighting
View Notes
Basic MQTT bridge can be found here:
https://github.com/hardillb/TRADFRI2MQTT
Bridge adds a mDNS entry for a COAP sever:
Service Type: _coap._udp
Service Name: gw:b0-72-bf-25-bf-59
Domain Name: local
Interface: wlan0 IPv4
@hardillb
hardillb / bridge.js
Last active Mar 17, 2017
A short script to do admin tasks on the WeMo Link ZigBee bridge
View bridge.js
var http = require('http');
var util = require('util');
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');
var postbodyfooter = ['</s:Body>',
@hardillb
hardillb / wemo-control.js
Last active Mar 17, 2017
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-contol.js" for instructions
View wemo-control.js
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 / ConvertedXML.xml
Created Mar 17, 2017
The SOAP command to create a Light Group on a Wemo Link ZigBee Bridge
View ConvertedXML.xml
<?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>
@hardillb
hardillb / bridgeservice.xml
Created Mar 17, 2017
The uPnP descriptor for the WeMo Link ZigBee bridge
View bridgeservice.xml
<?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 / Wemo-Osram Lights capabilities
Created Oct 31, 2015
A list of available capabilities and a description of their fields
View Wemo-Osram Lights capabilities
{ 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 / wemo-light.js
Last active Nov 3, 2016
Wemo lights example - "npm install wemo-js xml2js" then "node wemo-light.js" for instructions
View wemo-light.js
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');
You can’t perform that action at this time.