Compare commits

..

1 Commits

Author SHA1 Message Date
Juan Risso
d1b796491a MSA-1214: Simulated Device Manager 2016-04-21 14:51:17 -04:00
15 changed files with 150 additions and 89 deletions

View File

@@ -9,7 +9,7 @@ apply plugin: 'smartthings-slack'
buildscript {
dependencies {
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.8"
classpath "com.smartthings.deployment:executable-deployment-scripts:1.0.7"
}
repositories {
mavenLocal()

View File

@@ -58,4 +58,4 @@ def parse(String description) {
}
log.debug "Parse returned ${result?.descriptionText}"
return result
}
}

View File

@@ -31,7 +31,6 @@ metadata {
capability "Configuration"
capability "Refresh"
capability "Sensor"
capability "Health Check"
// indicates that device keeps track of heartbeat (in state.heartbeat)
attribute "heartbeat", "string"

View File

@@ -31,7 +31,6 @@ metadata {
capability "Refresh"
capability "Temperature Measurement"
capability "Water Sensor"
capability "Health Check"
command "enrollResponse"

View File

@@ -31,7 +31,6 @@ metadata {
capability "Battery"
capability "Temperature Measurement"
capability "Refresh"
capability "Health Check"
command "enrollResponse"

View File

@@ -35,7 +35,6 @@ metadata {
capability "Acceleration Sensor"
capability "Refresh"
capability "Temperature Measurement"
capability "Health Check"
command "enrollResponse"
fingerprint inClusters: "0000,0001,0003,0402,0500,0020,0B05,FC02", outClusters: "0019", manufacturer: "CentraLite", model: "3320"

View File

@@ -23,9 +23,8 @@
capability "Acceleration Sensor"
capability "Refresh"
capability "Temperature Measurement"
capability "Health Check"
command "enrollResponse"
command "enrollResponse"
}
simulator {

View File

@@ -20,7 +20,6 @@ metadata {
capability "Refresh"
capability "Temperature Measurement"
capability "Relative Humidity Measurement"
capability "Health Check"
fingerprint endpointId: "01", inClusters: "0001,0003,0020,0402,0B05,FC45", outClusters: "0019,0003"
}

View File

@@ -80,31 +80,19 @@ metadata {
state "default", label:''
}
// multi-line text (explicit newlines)
standardTile("multiLine", "device.multiLine", width: 2, height: 2) {
state "default", label: '${currentValue}'
}
standardTile("multiLineWithIcon", "device.multiLine", width: 2, height: 2) {
state "default", label: '${currentValue}', icon: "st.switches.switch.off"
}
main("actionRings")
main("standard1")
details([
"actionRings", "actionFlat", "noActionFlat",
"flatLabel", "flatIconLabel", "flatIcon",
"flatDefaultState", "flatImplicitDefaultState1", "flatImplicitDefaultState2",
"multiLine", "multiLineWithIcon"
])
}
}
def installed() {
sendEvent(name: "switch", value: "off")
sendEvent(name: "multiLine", value: "Line 1\nLine 2\nLine 3")
}
def parse(String description) {

View File

@@ -69,25 +69,16 @@ metadata {
]
}
valueTile("noValue", "device.nada", width: 4, height: 2) {
valueTile("noValue", "device.nada", width: 2, height: 2) {
state "default", label:'${currentValue}'
}
valueTile("multiLine", "device.multiLine", width: 3, height: 2) {
state "default", label: '${currentValue}'
}
valueTile("multiLineWithIcon", "device.multiLine", width: 3, height: 2) {
state "default", label: '${currentValue}', icon: "st.switches.switch.off"
}
main("text")
details([
"text", "longText", "integer",
"integerFloat", "pi", "floatAsText",
"bgColor", "bgColorRange", "bgColorRangeSingleItem",
"bgColorRangeConflict", "noValue",
"multiLine", "multiLineWithIcon"
"bgColorRangeConflict", "noValue"
])
}
}
@@ -99,7 +90,6 @@ def installed() {
sendEvent(name: "integerFloat", value: 47.0)
sendEvent(name: "pi", value: 3.14159)
sendEvent(name: "floatAsText", value: "3.14159")
sendEvent(name: "multiLine", value: "Line 1\nLine 2\nLine 3")
}
def parse(String description) {

View File

@@ -67,47 +67,14 @@ metadata {
attributeState "VALUE_DOWN", action: "levelDown"
}
}
multiAttributeTile(name:"lengthyTile", type:"generic", width:6, height:4) {
tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821"
}
tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821"
}
}
multiAttributeTile(name:"multilineTile", type:"generic", width:6, height:4) {
tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821"
}
tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821"
}
}
multiAttributeTile(name:"lengthyTileWithIcon", type:"generic", width:6, height:4) {
tileAttribute("device.lengthyText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on"
}
tileAttribute("device.lengthyText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'The value of this tile is long and should wrap to two lines', backgroundColor:"#79b821", icon: "st.switches.switch.on"
}
}
multiAttributeTile(name:"multilineTileWithIcon", type:"generic", width:6, height:4) {
tileAttribute("device.multilineText", key: "PRIMARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on"
}
tileAttribute("device.multilineText", key: "SECONDARY_CONTROL") {
attributeState "default", label:'Line 1 YES\nLine 2 YES\nLine 3 NO', backgroundColor:"#79b821", icon: "st.switches.switch.on"
}
}
main(["basicTile"])
details(["basicTile", "sliderTile", "valueTile", "lengthyTile", "multilineTile", "lengthyTileWithIcon", "multilineTileWithIcon"])
details(["basicTile", "sliderTile", "valueTile"])
}
}
def installed() {
sendEvent(name: "lengthyText", value: "The value of this tile is long and should wrap to two lines")
sendEvent(name: "multilineText", value: "Line 1 YES\nLine 2 YES\nLine 3 NO")
}
def parse() {

View File

@@ -25,10 +25,7 @@ metadata {
fingerprint deviceId: "0x2001", inClusters: "0x30,0x80,0x84,0x85,0x86,0x72"
fingerprint deviceId: "0x07", inClusters: "0x30"
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x98"
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x86,0x72,0x98", outClusters: "0x5A,0x82"
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x80,0x71,0x85,0x70,0x72,0x86,0x30,0x31,0x84,0x59,0x73,0x5A,0x8F,0x98,0x7A", outClusters:"0x20" // Philio multi+
fingerprint deviceId: "0x0701", inClusters: "0x5E,0x72,0x5A,0x80,0x73,0x86,0x84,0x85,0x59,0x71,0x70,0x7A,0x98" // Vision door/window
}
// simulator metadata
@@ -243,7 +240,7 @@ def batteryGetCommand() {
def retypeBasedOnMSR() {
switch (state.MSR) {
case "0086-0002-002D":
log.debug "Changing device type to Z-Wave Water Sensor"
log.debug("Changing device type to Z-Wave Water Sensor")
setDeviceType("Z-Wave Water Sensor")
break
case "011F-0001-0001": // Schlage motion
@@ -252,16 +249,9 @@ def retypeBasedOnMSR() {
case "0060-0001-0002": // Everspring SP814
case "0060-0001-0003": // Everspring HSP02
case "011A-0601-0901": // Enerwave ZWN-BPC
log.debug "Changing device type to Z-Wave Motion Sensor"
log.debug("Changing device type to Z-Wave Motion Sensor")
setDeviceType("Z-Wave Motion Sensor")
break
case "013C-0002-000D": // Philio multi +
log.debug "Changing device type to 3-in-1 Multisensor Plus (SG)"
setDeviceType("3-in-1 Multisensor Plus (SG)")
break
case "0109-2001-0106": // Vision door/window
log.debug "Changing device type to Door / Window Sensor Plus (SG)"
setDeviceType("Door / Window Sensor Plus (SG)")
break
}
}

View File

@@ -332,7 +332,8 @@ private addChildBulb(dni, hueType, name, hub, update=false, device = null) {
if (deviceType) {
return addChildDevice("smartthings", deviceType, dni, hub, ["label": name])
} else {
}
else {
log.warn "Device type $hueType not supported"
return null
}
@@ -348,10 +349,8 @@ def addBulbs() {
newHueBulb = bulbs.find { (app.id + "/" + it.value.id) == dni }
if (newHueBulb != null) {
d = addChildBulb(dni, newHueBulb?.value?.type, newHueBulb?.value?.name, newHueBulb?.value?.hub)
if (d) {
log.debug "created ${d.displayName} with id $dni"
d.refresh()
}
log.debug "created ${d.displayName} with id $dni"
d.refresh()
} else {
log.debug "$dni in not longer paired to the Hue Bridge or ID changed"
}
@@ -359,7 +358,7 @@ def addBulbs() {
//backwards compatable
newHueBulb = bulbs.find { (app.id + "/" + it.id) == dni }
d = addChildBulb(dni, "Extended Color Light", newHueBulb?.value?.name, newHueBulb?.value?.hub)
d?.refresh()
d.refresh()
}
} else {
log.debug "found ${d.displayName} with id $dni already exists, type: '$d.typeName'"

View File

@@ -0,0 +1,132 @@
/**
* Simulated Device Manager
*
* Author: SmartThings (Juan Risso - juan@smartthings.com)
*/
definition(
name: "Simulated Device Manager",
namespace: "smartthings",
author: "SmartThings",
description: "Allows you to create virtual devices to populate your account.",
category: "SmartThings Labs",
iconUrl: "https://d3abxbgmpfhmxi.cloudfront.net/assets/downloads/smartthings-logo-ring.7311e9df.png",
iconX2Url: "https://d3abxbgmpfhmxi.cloudfront.net/assets/downloads/smartthings-logo-ring.7311e9df.png",
singleInstance: true
)
preferences {
page(name:"selectDevices", title:"Simulated Device Manager")
}
//PAGES
def selectDevices() {
return dynamicPage(name:"selectDevices", title:"Simulated Device Manager", nextPage:"", install:true, uninstall: true) {
def options = [1,2,3,4,5]
section("Please select the number of virtual devices you want to install") {
input "selectedswitch", "enum", required:false, title:"Select number of Simulated Switches", multiple:false, options:options
input "selectedmotion", "enum", required:false, title:"Select number of Simulated Motion Sensors", multiple:false, options:options
input "selectedpresence", "enum", required:false, title:"Select number of Simulated Presence Sensors", multiple:false, options:options
input "selectedsmoke", "enum", required:false, title:"Select number of Simulated Smoke Alarms", multiple:false, options:options
input "selectedleak", "enum", required:false, title:"Select number of Simulated Water Sensors", multiple:false, options:options
input "selectedalarm", "enum", required:false, title:"Select number of Simulated Alarms", multiple:false, options:options
input "selectedbutton", "enum", required:false, title:"Select number of Simulated Buttons", multiple:false, options:options
input "selectedcontact", "enum", required:false, title:"Select number of Simulated Contact Sensors", multiple:false, options:options
input "selectedlock", "enum", required:false, title:"Select number of Simulated Locks", multiple:false, options:options
input "selectedtemperature", "enum", required:false, title:"Select number of Simulated Temperature Sensors", multiple:false, options:options
input "selectedthermostat", "enum", required:false, title:"Select number of Simulated Thermostats", multiple:false, options:options
input "selectedvalve", "enum", required:false, title:"Select number of Simulated Valves", multiple:false, options:options
}
}
}
def installed() {
log.trace "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.trace "Updated with settings: ${settings}"
initialize()
}
def uninstalled() {
def devices = getChildDevices()
log.trace "deleting ${devices.size()} device"
devices.each {
deleteChildDevice(it.deviceNetworkId)
}
}
def initialize() {
addDevice()
}
//CHILD DEVICE METHODS
def addDevice(){
log.trace "addDevice()"
def type = [selectedswitch: selectedswitch,selectedmotion: selectedmotion,selectedpresence: selectedpresence,selectedsmoke: selectedsmoke,selectedleak: selectedleak,selectedalarm: selectedalarm,selectedbutton: selectedbutton,selectedcontact: selectedcontact,selectedlock: selectedlock,selectedtemperature: selectedtemperature,selectedthermostat: selectedthermostat,selectedvalve: selectedvalve]
type.each {key, value ->
if (value > 0) {
def deviceName = getDeviceName(key)
log.trace "Adding ${deviceName}"
def aux
for (aux = 1; aux <= value; aux++) {
def dni = "$key$aux"
def d = getChildDevice(dni)
if(!d) {
d = addChildDevice("smartthings/testing", deviceName, dni, null, [label:"${deviceName} ${aux}"])
log.trace "Created ${deviceName} with id ${dni}"
} else {
log.trace "${dni} already exists"
}
}
}
}
}
def getDeviceName(type) {
def result
switch (type) {
case 'selectedswitch':
result = 'Simulated Switch'
break
case 'selectedmotion':
result = 'Simulated Motion Sensor'
break
case 'selectedpresence':
result = 'Simulated Presence Sensor'
break
case 'selectedsmoke':
result = 'Simulated Smoke Alarm'
break
case 'selectedleak':
result = 'Simulated Water Sensor'
break
case 'selectedalarm':
result = 'Simulated Alarm'
break
case 'selectedbutton':
result = 'Simulated Button'
break
case 'selectedcontact':
result = 'Simulated Contact Sensor'
break
case 'selectedlock':
result = 'Simulated Lock'
break
case 'selectedtemperature':
result = 'Simulated Temperature Sensor'
break
case 'selectedthermostat':
result = 'Simulated Thermostat'
break
case 'selectedvalve':
result = 'Simulated Water Valve'
break
default:
result = ''
break
}
result
}

View File

@@ -335,4 +335,5 @@ private timeIntervalLabel()
{
(starting && ending) ? hhmm(starting) + "-" + hhmm(ending, "h:mm a z") : ""
}
// TODO - End Centralize
// TODO - End Centralize