Created
August 14, 2019 16:22
-
-
Save hardillb/66e95f62ec9d3dca969d7a66cc20c5bc to your computer and use it in GitHub Desktop.
code to reboot a Ikea Tradfri gateway
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) => { | |
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