View show-creds.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
var encryptionAlgorithm = "aes-256-ctr"; | |
function decryptCreds(key, cipher) { | |
var flows = cipher["$"]; | |
var initVector = Buffer.from(flows.substring(0, 32),'hex'); | |
flows = flows.substring(32); | |
var decipher = crypto.createDecipheriv(encryptionAlgorithm, key, initVector); | |
var decrypted = decipher.update(flows, 'base64', 'utf8') + decipher.final('utf8'); |
View blinkt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import blinkt | |
import argparse | |
def list_str(values): | |
return values.split(',') | |
if __name__ == "__main__": |
View usb-rndis.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View rebootGW.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { |
View Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ |
View Notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View bridge.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>', |
View ConvertedXML.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
View bridgeservice.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
View SendMessage.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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); |
NewerOlder