DVCSMP-2168 Philips Hue/LIFX: Send device watch registration

-Send device watch register events in update()
This commit is contained in:
Lars Finander
2016-10-24 14:44:08 -06:00
parent 07c5a3533f
commit 5e48e710d4
2 changed files with 17 additions and 0 deletions

View File

@@ -271,9 +271,17 @@ def initialize() {
updateDevices()
// Check for new devices and remove old ones every 3 hours
runEvery5Minutes('updateDevices')
setupDeviceWatch()
}
// Misc
private setupDeviceWatch() {
def hub = location.hubs[0]
// Make sure that all child devices are enrolled in device watch
getChildDevices().each {
it.sendEvent(name: "DeviceWatch-Enroll", value: "{\"protocol\": \"LAN\", \"scheme\":\"untracked\", \"hubHardwareId\": \"${hub?.hub?.hardwareID}\"}")
}
}
Map apiRequestHeaders() {
return ["Authorization": "Bearer ${state.lifxAccessToken}",