Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#3694 from SmartThingsCommunit…
Browse files Browse the repository at this point in the history
…y/staging

Rolling up staging to production
  • Loading branch information
workingmonk committed Nov 20, 2018
2 parents ec1a33b + b9b7ec6 commit 5e4eb40
Show file tree
Hide file tree
Showing 5 changed files with 1,227 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ def configure() {
encap(zwave.configurationV1.configurationSet(parameterNumber: 111, size: 4, scaledConfigurationValue: 300)), // ...every 5 min
encap(zwave.configurationV1.configurationSet(parameterNumber: 102, size: 4, scaledConfigurationValue: 2)), // report energy in kWh...
encap(zwave.configurationV1.configurationSet(parameterNumber: 112, size: 4, scaledConfigurationValue: 300)), // ...every 5 min
zwave.configurationV1.configurationSet(parameterNumber: 90, size: 1, scaledConfigurationValue: 1), // enabling automatic reports...
zwave.configurationV1.configurationSet(parameterNumber: 91, size: 2, scaledConfigurationValue: 10) // ...every 10W change
zwave.configurationV1.configurationSet(parameterNumber: 90, size: 1, scaledConfigurationValue: 1).format(), // enabling automatic reports...
zwave.configurationV1.configurationSet(parameterNumber: 91, size: 2, scaledConfigurationValue: 10).format() // ...every 10W change
], 500)
else
delayBetween([
Expand All @@ -188,7 +188,7 @@ private encap(physicalgraph.zwave.Command cmd) {
} else if (zwaveInfo.cc.contains("56")){
crcEncap(cmd)
} else {
response(cmd.format())
cmd.format()
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* Copyright 2018 SmartThings
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/

metadata {
definition (name: "Mobile Presence Occupancy", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.mobile.presence") {
capability "Presence Sensor"
capability "Occupancy Sensor"
capability "Sensor"
}

simulator {
status "not present": "presence: 0"
status "present": "presence: 1"
status "unoccupied": "occupancy: 0"
status "occupied": "occupancy: 1"
}

tiles {
standardTile("presence", "device.presence", width: 2, height: 2, canChangeBackground: true) {
state("present", labelIcon:"st.presence.tile.mobile-present", backgroundColor:"#00A0DC")
state("not present", labelIcon:"st.presence.tile.mobile-not-present", backgroundColor:"#ffffff")
}
standardTile("occupancy", "device.occupancy", width: 2, height: 2, canChangeBackground: true) {
state ("occupied", labelIcon: "st.presence.tile.mobile-present", backgroundColor: "#00A0DC")
state ("unoccupied", labelIcon: "st.presence.tile.mobile-not-present", backgroundColor:"#ffffff")
}
main "presence"
details(["presence", "occupancy"])
}
}

def parse(String description) {
def name = parseName(description)
def value = parseValue(description)
def linkText = getLinkText(device)
def descriptionText = parseDescriptionText(linkText, value, description)
def handlerName = getState(value)
def isStateChange = isStateChange(device, name, value)

def results = [
translatable: true,
name: name,
value: value,
unit: null,
linkText: linkText,
descriptionText: descriptionText,
handlerName: handlerName,
isStateChange: isStateChange,
displayed: displayed(description, isStateChange)
]
log.debug "Parse returned $results.descriptionText"
return results
}

private String parseName(String description) {
log.debug "parseName $description"
switch(description) {
case "presence: 0":
case "presence: 1":
return "presence"
case "occupancy: 0":
case "occupancy: 1":
return "occupancy"
}
null
}

private String parseValue(String description) {
log.debug "parseValue $description"
switch(description) {
case "presence: 0": return "not present"
case "presence: 1": return "present"
case "occupancy: 0": return "unoccupied"
case "occupancy: 1": return "occupied"
default: return description
}
}

private parseDescriptionText(String linkText, String value, String description) {
log.debug "parseDescriptionText $description"
switch(value) {
case "not present": return "{{ linkText }} has left"
case "present": return "{{ linkText }} has arrived"
case "unoccupied": return "{{ linkText }} has unoccupied"
case "occupied": return "{{ linkText }} has occupied"
default: return value
}
}

private getState(String value) {
log.debug "getState $value"
switch(value) {
case "not present": return "left"
case "present": return "arrived"
case "unoccupied": return "unoccupied"
case "occupied": return "occupied"
default: return value
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ metadata {

fingerprint inClusters: "0x43,0x40,0x44,0x31,0x80"
fingerprint mfr: "014F", prod: "5442", model: "5431", deviceJoinName: "Linear Z-Wave Thermostat"
fingerprint mfr: "014F", prod: "5442", model: "5436", deviceJoinName: "Go Control Z-Wave Thermostat"
fingerprint mfr: "014F", prod: "5442", model: "5436", deviceJoinName: "GoControl Z-Wave Thermostat"
}

tiles {
Expand Down
Loading

0 comments on commit 5e4eb40

Please sign in to comment.