Skip to content

Instantly share code, notes, and snippets.

@hardillb
Created August 14, 2019 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hardillb/66e95f62ec9d3dca969d7a66cc20c5bc to your computer and use it in GitHub Desktop.
Save hardillb/66e95f62ec9d3dca969d7a66cc20c5bc to your computer and use it in GitHub Desktop.
code to reboot a Ikea Tradfri gateway
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) => {
console.log(creds);
client.connect(creds.identity, creds.psk);
// client.observeNotifications()
client.rebootGateway().then((res) => {
if (res) {
console.log("rebooting");
} else {
console.log("problem");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment