mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-18 05:10:52 +00:00
Compare commits
21 Commits
MSA-1434-1
...
PROD_2016.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c0c050b3a | ||
|
|
a1b375c929 | ||
|
|
929f8e1a44 | ||
|
|
4f97d1a3ef | ||
|
|
255185ee8c | ||
|
|
ad50582e92 | ||
|
|
6de6704502 | ||
|
|
a5bc475cc1 | ||
|
|
4fd5cc5d70 | ||
|
|
236c37290e | ||
|
|
d17bc1869f | ||
|
|
534118a47a | ||
|
|
842f39e9ff | ||
|
|
dd308f6d8f | ||
|
|
1a72158a9a | ||
|
|
94ab309335 | ||
|
|
f2d635ab44 | ||
|
|
a7cd9e072b | ||
|
|
b5843acc38 | ||
|
|
4e5d1f6ad0 | ||
|
|
ef29820fa1 |
@@ -64,8 +64,10 @@ metadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
|
standardTile("switch", "device.switch", width: 1, height: 1, canChangeIcon: true) {
|
||||||
state "off", label: '${name}', action: "switch.on", icon: "st.Electronics.electronics16", backgroundColor: "#ffffff"
|
state "on", label: '${name}', action: "switch.off", icon: "st.Electronics.electronics16", backgroundColor: "#79b821", nextState:"turningOff"
|
||||||
state "on", label: '${name}', action: "switch.off", icon: "st.Electronics.electronics16", backgroundColor: "#79b821"
|
state "turningOff", label:'TURNING OFF', icon:"st.Electronics.electronics16", backgroundColor:"#ffffff"
|
||||||
|
state "off", label: '${name}', action: "switch.on", icon: "st.Electronics.electronics16", backgroundColor: "#ffffff", nextState:"turningOn"
|
||||||
|
state "turningOn", label:'TURNING ON', icon:"st.Electronics.electronics16", backgroundColor:"#79b821"
|
||||||
}
|
}
|
||||||
valueTile("1", "device.station1", decoration: "flat", canChangeIcon: false) {
|
valueTile("1", "device.station1", decoration: "flat", canChangeIcon: false) {
|
||||||
state "station1", label:'${currentValue}', action:"preset1"
|
state "station1", label:'${currentValue}', action:"preset1"
|
||||||
@@ -747,8 +749,16 @@ def cb_boseSetInput(xml, input) {
|
|||||||
*/
|
*/
|
||||||
def boseSetPowerState(boolean enable) {
|
def boseSetPowerState(boolean enable) {
|
||||||
log.info "boseSetPowerState(${enable})"
|
log.info "boseSetPowerState(${enable})"
|
||||||
queueCallback('nowPlaying', "cb_boseSetPowerState", enable ? "POWERON" : "POWEROFF")
|
// Fix to get faster update of power status back from speaker after sending on/off
|
||||||
return boseRefreshNowPlaying()
|
// Instead of queuing the command to be sent after the refresh send it directly via sendHubCommand
|
||||||
|
// Note: This is a temporary hack that should be replaced by a re-design of the
|
||||||
|
// DTH to use sendHubCommand for all commands
|
||||||
|
sendHubCommand(bosePOST("/key", "<key state=\"press\" sender=\"Gabbo\">POWER</key>"))
|
||||||
|
sendHubCommand(bosePOST("/key", "<key state=\"release\" sender=\"Gabbo\">POWER</key>"))
|
||||||
|
sendHubCommand(boseGET("/now_playing"))
|
||||||
|
if (enable) {
|
||||||
|
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", 5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -787,10 +797,11 @@ def cb_boseSetPowerState(xml, state) {
|
|||||||
*/
|
*/
|
||||||
def cb_boseConfirmPowerOn(xml, tries) {
|
def cb_boseConfirmPowerOn(xml, tries) {
|
||||||
def result = []
|
def result = []
|
||||||
log.warn "boseConfirmPowerOn() attempt #" + tries
|
def attempt = tries as Integer
|
||||||
if (xml.attributes()['source'] == "STANDBY" && tries > 0) {
|
log.warn "boseConfirmPowerOn() attempt #$attempt"
|
||||||
|
if (xml.attributes()['source'] == "STANDBY" && attempt > 0) {
|
||||||
result << boseRefreshNowPlaying()
|
result << boseRefreshNowPlaying()
|
||||||
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", tries-1)
|
queueCallback('nowPlaying', "cb_boseConfirmPowerOn", attempt-1)
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ metadata {
|
|||||||
capability "Switch"
|
capability "Switch"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006"
|
||||||
|
fingerprint profileId: "0104", inClusters: "0000, 0003, 0006", outClusters: "0003, 0006, 0019, 0406", manufacturer: "Leviton", model: "ZSS-10", deviceJoinName: "Leviton Switch"
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2015 SmartThings
|
* Copyright 2016 SmartThings
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
* 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:
|
* in compliance with the License. You may obtain a copy of the License at:
|
||||||
@@ -11,100 +11,133 @@
|
|||||||
* for the specific language governing permissions and limitations under the License.
|
* for the specific language governing permissions and limitations under the License.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* Capabilities
|
|
||||||
* - Battery
|
|
||||||
* - Configuration
|
|
||||||
* - Refresh
|
|
||||||
* - Switch
|
|
||||||
* - Valve
|
|
||||||
*/
|
|
||||||
|
|
||||||
metadata {
|
metadata {
|
||||||
definition (name: "Zigbee Valve", namespace: "smartthings", author: "SmartThings") {
|
definition (name: "ZigBee Valve", namespace: "smartthings", author: "SmartThings") {
|
||||||
capability "Battery"
|
capability "Actuator"
|
||||||
capability "Configuration"
|
capability "Battery"
|
||||||
capability "Refresh"
|
capability "Configuration"
|
||||||
capability "Switch"
|
capability "Power Source"
|
||||||
capability "Valve"
|
capability "Refresh"
|
||||||
|
capability "Valve"
|
||||||
|
|
||||||
fingerprint profileId: "0104", inClusters: "0000,0001,0003,0004,0005,0020,0006,0B02", outClusters: "0003"
|
fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0006, 0020, 0B02, FC02", outClusters: "0019", manufacturer: "WAXMAN", model: "leakSMART Water Valve v2.10", deviceJoinName: "leakSMART Valve"
|
||||||
}
|
fingerprint profileId: "0104", inClusters: "0000, 0001, 0003, 0004, 0005, 0006, 0008, 000F, 0020, 0B02", outClusters: "0003, 0019", manufacturer: "WAXMAN", model: "House Water Valve - MDL-TBD", deviceJoinName: "Waxman House Water Valve"
|
||||||
|
}
|
||||||
|
|
||||||
// simulator metadata
|
// simulator metadata
|
||||||
simulator {
|
simulator {
|
||||||
// status messages
|
// status messages
|
||||||
status "on": "on/off: 1"
|
status "on": "on/off: 1"
|
||||||
status "off": "on/off: 0"
|
status "off": "on/off: 0"
|
||||||
|
|
||||||
// reply messages
|
// reply messages
|
||||||
reply "zcl on-off on": "on/off: 1"
|
reply "zcl on-off on": "on/off: 1"
|
||||||
reply "zcl on-off off": "on/off: 0"
|
reply "zcl on-off off": "on/off: 0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// UI tile definitions
|
tiles(scale: 2) {
|
||||||
tiles {
|
multiAttributeTile(name:"valve", type: "generic", width: 6, height: 4, canChangeIcon: true){
|
||||||
standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
|
tileAttribute ("device.contact", key: "PRIMARY_CONTROL") {
|
||||||
state "off", label: 'closed', action: "switch.on", icon: "st.Outdoor.outdoor16", backgroundColor: "#e86d13"
|
attributeState "open", label: '${name}', action: "valve.close", icon: "st.valves.water.open", backgroundColor: "#53a7c0", nextState:"closing"
|
||||||
state "on", label: 'open', action: "switch.off", icon: "st.Outdoor.outdoor16", backgroundColor: "#53a7c0"
|
attributeState "closed", label: '${name}', action: "valve.open", icon: "st.valves.water.closed", backgroundColor: "#e86d13", nextState:"opening"
|
||||||
}
|
attributeState "opening", label: '${name}', action: "valve.close", icon: "st.valves.water.open", backgroundColor: "#53a7c0", nextState:"closing"
|
||||||
main "switch"
|
attributeState "closing", label: '${name}', action: "valve.open", icon: "st.valves.water.closed", backgroundColor: "#e86d13", nextState:"opening"
|
||||||
details(["switch"])
|
}
|
||||||
}
|
tileAttribute ("powerSource", key: "SECONDARY_CONTROL") {
|
||||||
|
attributeState "powerSource", label:'Power Source: ${currentValue}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
valueTile("battery", "device.battery", inactiveLabel:false, decoration:"flat", width:2, height:2) {
|
||||||
|
state "battery", label:'${currentValue}% battery', unit:""
|
||||||
|
}
|
||||||
|
|
||||||
|
standardTile("refresh", "device.refresh", inactiveLabel: false, decoration: "flat", width: 2, height: 2) {
|
||||||
|
state "default", label:"", action:"refresh.refresh", icon:"st.secondary.refresh"
|
||||||
|
}
|
||||||
|
|
||||||
|
main(["valve"])
|
||||||
|
details(["valve", "battery", "refresh"])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getCLUSTER_BASIC() { 0x0000 }
|
||||||
|
private getBASIC_ATTR_POWER_SOURCE() { 0x0007 }
|
||||||
|
private getCLUSTER_POWER() { 0x0001 }
|
||||||
|
private getPOWER_ATTR_BATTERY_PERCENTAGE_REMAINING() { 0x0021 }
|
||||||
|
private getTYPE_U8() { 0x20 }
|
||||||
|
private getTYPE_ENUM8() { 0x30 }
|
||||||
|
|
||||||
// Parse incoming device messages to generate events
|
// Parse incoming device messages to generate events
|
||||||
def parse(String description) {
|
def parse(String description) {
|
||||||
log.info description
|
log.debug "description is $description"
|
||||||
if (description?.startsWith("catchall:")) {
|
def event = zigbee.getEvent(description)
|
||||||
def value = name == "switch" ? (description?.endsWith(" 1") ? "on" : "off") : null
|
if (event) {
|
||||||
def result = createEvent(name: name, value: value)
|
if(event.name == "switch") {
|
||||||
def msg = zigbee.parse(description)
|
event.name = "contact" //0006 cluster in valve is tied to contact
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
if(event.value == "on") {
|
||||||
return result
|
event.value = "open"
|
||||||
log.trace msg
|
}
|
||||||
log.trace "data: $msg.data"
|
else if(event.value == "off") {
|
||||||
}
|
event.value = "closed"
|
||||||
else {
|
}
|
||||||
def name = description?.startsWith("on/off: ") ? "switch" : null
|
}
|
||||||
def value = name == "switch" ? (description?.endsWith(" 1") ? "on" : "off") : null
|
sendEvent(event)
|
||||||
def result = createEvent(name: name, value: value)
|
}
|
||||||
log.debug "Parse returned ${result?.descriptionText}"
|
else {
|
||||||
return result
|
def descMap = zigbee.parseDescriptionAsMap(description)
|
||||||
}
|
if (descMap.clusterInt == CLUSTER_BASIC && descMap.attrInt == BASIC_ATTR_POWER_SOURCE){
|
||||||
}
|
def value = descMap.value
|
||||||
|
if (value == "01" || value == "02") {
|
||||||
// Commands to device
|
sendEvent(name: "powerSource", value: "Mains")
|
||||||
def on() {
|
}
|
||||||
log.debug "on()"
|
else if (value == "03") {
|
||||||
sendEvent(name: "switch", value: "on")
|
sendEvent(name: "powerSource", value: "Battery")
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 1 {}"
|
}
|
||||||
}
|
else if (value == "04") {
|
||||||
|
sendEvent(name: "powerSource", value: "DC")
|
||||||
def off() {
|
}
|
||||||
log.debug "off()"
|
else {
|
||||||
sendEvent(name: "switch", value: "off")
|
sendEvent(name: "powerSource", value: "Unknown")
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 0 {}"
|
}
|
||||||
|
}
|
||||||
|
else if (descMap.clusterInt == CLUSTER_POWER && descMap.attrInt == POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) {
|
||||||
|
event.name = "battery"
|
||||||
|
event.value = Math.round(Integer.parseInt(descMap.value, 16) / 2)
|
||||||
|
sendEvent(event)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
log.warn "DID NOT PARSE MESSAGE for description : $description"
|
||||||
|
log.debug descMap
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def open() {
|
def open() {
|
||||||
log.debug "on()"
|
zigbee.on()
|
||||||
sendEvent(name: "switch", value: "on")
|
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 1 {}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def close() {
|
def close() {
|
||||||
log.debug "off()"
|
zigbee.off()
|
||||||
sendEvent(name: "switch", value: "off")
|
|
||||||
"st cmd 0x${device.deviceNetworkId} 1 6 0 {}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def refresh() {
|
def refresh() {
|
||||||
log.debug "sending refresh command"
|
log.debug "refresh called"
|
||||||
"st rattr 0x${device.deviceNetworkId} 1 6 0"
|
zigbee.onOffRefresh() +
|
||||||
|
zigbee.readAttribute(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE) +
|
||||||
|
zigbee.readAttribute(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING) +
|
||||||
|
zigbee.onOffConfig() +
|
||||||
|
zigbee.configureReporting(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING, TYPE_U8, 600, 21600, 1) +
|
||||||
|
zigbee.configureReporting(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE, TYPE_ENUM8, 5, 21600, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
def configure() {
|
def configure() {
|
||||||
|
log.debug "Configuring Reporting and Bindings."
|
||||||
"zdo bind 0x${device.deviceNetworkId} 1 1 6 {${device.zigbeeId}} {}"
|
zigbee.onOffConfig() +
|
||||||
|
zigbee.configureReporting(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING, TYPE_U8, 600, 21600, 1) +
|
||||||
|
zigbee.configureReporting(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE, TYPE_ENUM8, 5, 21600, 1) +
|
||||||
|
zigbee.onOffRefresh() +
|
||||||
|
zigbee.readAttribute(CLUSTER_BASIC, BASIC_ATTR_POWER_SOURCE) +
|
||||||
|
zigbee.readAttribute(CLUSTER_POWER, POWER_ATTR_BATTERY_PERCENTAGE_REMAINING)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,17 +24,24 @@ definition(
|
|||||||
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
iconX3Url: "http://www.gidjit.com/appicon@3x.png",
|
||||||
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
oauth: [displayName: "Gidjit", displayLink: "www.gidjit.com"])
|
||||||
|
|
||||||
|
preferences(oauthPage: "deviceAuthorization") {
|
||||||
|
// deviceAuthorization page is simply the devices to authorize
|
||||||
|
page(name: "deviceAuthorization", title: "Device Authorization", nextPage: "instructionPage",
|
||||||
|
install: false, uninstall: true) {
|
||||||
|
section ("Allow Gidjit to have access, thereby allowing you to quickly control and monitor your following devices. Privacy Policy can be found at http://priv.gidjit.com/privacy.html") {
|
||||||
|
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
||||||
|
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
||||||
|
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
preferences {
|
page(name: "instructionPage", title: "Device Discovery", install: true) {
|
||||||
section ("Allow Gidjit to have access, there by allowing you to quickly control and monitor the following devices") {
|
section() {
|
||||||
input "switches", "capability.switch", title: "Control/Monitor your switches", multiple: true, required: false
|
paragraph "Now the process is complete return to the Devices section of the Detected Screen. From there and you can add actions to each of your device panels, including launching SmartThings routines."
|
||||||
input "thermostats", "capability.thermostat", title: "Control/Monitor your thermostats", multiple: true, required: false
|
}
|
||||||
input "windowShades", "capability.windowShade", title: "Control/Monitor your window shades", multiple: true, required: false //windowShade
|
}
|
||||||
//input "bulbs", "capability.colorControl", title: "Control your lights", multiple: true, required: false //windowShade
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mappings {
|
mappings {
|
||||||
path("/structureinfo") {
|
path("/structureinfo") {
|
||||||
action: [
|
action: [
|
||||||
|
|||||||
Reference in New Issue
Block a user