mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
Merge pull request #1387 from larsfinander/DVCSMP-2168_Philips_Hue_LIFX_dw_registration_in_update_staging
DVCSMP-2168 Philips Hue/LIFX: Send device watch registration
This commit is contained in:
@@ -299,6 +299,7 @@ def initialize() {
|
||||
state.bridgeRefreshCount = 0
|
||||
state.bulbRefreshCount = 0
|
||||
state.updating = false
|
||||
setupDeviceWatch()
|
||||
if (selectedHue) {
|
||||
addBridge()
|
||||
addBulbs()
|
||||
@@ -321,6 +322,14 @@ def uninstalled(){
|
||||
state.username = null
|
||||
}
|
||||
|
||||
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}\"}")
|
||||
}
|
||||
}
|
||||
|
||||
private upgradeDeviceType(device, newHueType) {
|
||||
def deviceType = getDeviceType(newHueType)
|
||||
|
||||
|
||||
@@ -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}",
|
||||
|
||||
Reference in New Issue
Block a user