Files
SmartThingsPublic/smartapps/networkscanner/scanner-smartthings-apps.src/scanner-smartthings-apps.groovy
2015-12-08 04:59:23 -06:00

69 lines
1.5 KiB
Groovy

/**
* SCANNER SMARTTHINGS APPS
*
* Copyright 2015 kathiresan
*
*/
definition(
name: "SCANNER SMARTTHINGS APPS",
namespace: "NetworkScanner",
author: "kathiresan",
description: "Network Scanner Smartthings Apps",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
oauth: true)
preferences {
section("Title") {
// TODO: put inputs here
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
def hub = location.hubs[0]
initialize()
log.debug "id: ${hub.id}"
log.debug "zigbeeId: ${hub.zigbeeId}"
log.debug "zigbeeEui: ${hub.zigbeeEui}"
// PHYSICAL or VIRTUAL
log.debug "type: ${hub.type}"
log.debug "name: ${hub.name}"
log.debug "firmwareVersionString: ${hub.firmwareVersionString}"
log.debug "localIp: ${hub.localIP}"
log.debug "localSrvPortTCP: ${hub.localSrvPortTCP}"
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
// TODO: subscribe to attributes, devices, locations, etc.
}
mappings {
path("/HubInfo") {
action: [
GET: "hubInfo"
]
}
}
// returns a list like
// [[name: "kitchen lamp", value: "off"], [name: "bathroom", value: "on"]]
def hubInfo() {
def hub = location.hubs[0]
return "localIp: ${hub.localIP}"
}
// TODO: implement event handlers