mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-26 13:24:09 +00:00
DVCSMP-2168 Philips Hue/LIFX: Send device watch registration
-Send device watch register events in update()
This commit is contained in:
@@ -299,6 +299,7 @@ def initialize() {
|
|||||||
state.bridgeRefreshCount = 0
|
state.bridgeRefreshCount = 0
|
||||||
state.bulbRefreshCount = 0
|
state.bulbRefreshCount = 0
|
||||||
state.updating = false
|
state.updating = false
|
||||||
|
setupDeviceWatch()
|
||||||
if (selectedHue) {
|
if (selectedHue) {
|
||||||
addBridge()
|
addBridge()
|
||||||
addBulbs()
|
addBulbs()
|
||||||
@@ -321,6 +322,14 @@ def uninstalled(){
|
|||||||
state.username = null
|
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) {
|
private upgradeDeviceType(device, newHueType) {
|
||||||
def deviceType = getDeviceType(newHueType)
|
def deviceType = getDeviceType(newHueType)
|
||||||
|
|
||||||
|
|||||||
@@ -271,9 +271,17 @@ def initialize() {
|
|||||||
updateDevices()
|
updateDevices()
|
||||||
// Check for new devices and remove old ones every 3 hours
|
// Check for new devices and remove old ones every 3 hours
|
||||||
runEvery5Minutes('updateDevices')
|
runEvery5Minutes('updateDevices')
|
||||||
|
setupDeviceWatch()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Misc
|
// 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() {
|
Map apiRequestHeaders() {
|
||||||
return ["Authorization": "Bearer ${state.lifxAccessToken}",
|
return ["Authorization": "Bearer ${state.lifxAccessToken}",
|
||||||
|
|||||||
Reference in New Issue
Block a user