Skip to content

Commit

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

Rolling up staging to production
  • Loading branch information
workingmonk authored Feb 27, 2018
2 parents be5180e + 46a63ef commit c084de4
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @return none
*/
metadata {
definition (name: "Fibaro Door/Window Sensor", namespace: "smartthings", author: "SmartThings") {
definition (name: "Fibaro Door/Window Sensor", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {
//capability "Temperature Measurement" //UNCOMMENT ME IF TEMP INSTALLED
capability "Contact Sensor"
capability "Sensor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @return none
*/
metadata {
definition (name: "Fibaro Motion Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.motion") {
definition (name: "Fibaro Motion Sensor", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "x.com.st.d.sensor.motion", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {
capability "Motion Sensor"
capability "Temperature Measurement"
capability "Acceleration Sensor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ def stopDimming() {
}

def controllerEvent(eventData) {
log.trace "controllerEvent"
sendEvent(eventData)
if (eventData.name == "sessionStatus") {
if (eventData.value == "running") {
//Set Switch to ON to support Samsung Connect
sendEvent(name: "switch", value: "on")
} else {
// Set Switch to OFF to support Samsung Connect
sendEvent(name: "switch", value: "off")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* Copyright 2017 SmartThings
*
* Provides a virtual dimmer switch
*
* 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: "Virtual Dimmer Switch", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {
capability "Actuator"
capability "Sensor"
capability "Switch"
capability "Switch Level"
}

preferences {}

tiles(scale: 2) {
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.Home.home30", backgroundColor:"#00A0DC", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.Home.home30", backgroundColor:"#FFFFFF", nextState:"turningOn", defaultState: true
attributeState "turningOn", label:'Turning On', action:"switch.off", icon:"st.Home.home30", backgroundColor:"#00A0DC", nextState:"turningOn"
attributeState "turningOff", label:'Turning Off', action:"switch.on", icon:"st.Home.home30", backgroundColor:"#FFFFFF", nextState:"turningOff"
}
tileAttribute ("device.level", key: "SLIDER_CONTROL") {
attributeState "level", action: "setLevel"
}
tileAttribute ("brightnessLabel", key: "SECONDARY_CONTROL") {
attributeState "Brightness", label: '${name}', defaultState: true
}
}

standardTile("explicitOn", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: "On", action: "switch.on", icon: "st.Home.home30", backgroundColor: "#ffffff"
}
standardTile("explicitOff", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: "Off", action: "switch.off", icon: "st.Home.home30", backgroundColor: "#ffffff"
}
controlTile("levelSlider", "device.level", "slider", width: 2, height: 2, inactiveLabel: false, range: "(1..100)") {
state "physicalLevel", action: "switch level.setLevel"
}

main(["switch"])
details(["switch", "explicitOn", "explicitOff", "levelSlider"])

}
}

def parse(String description) {
}

def on() {
log.trace "Executing 'on'"
turnOn()
}

def off() {
log.trace "Executing 'off'"
turnOff()
}

def setLevel(value) {
log.trace "Executing setLevel $value"
Map levelEventMap = buildSetLevelEvent(value)
if (levelEventMap.value == 0) {
turnOff()
// notice that we don't set the level to 0'
} else {
implicitOn()
sendEvent(levelEventMap)
}
}

private Map buildSetLevelEvent(value) {
def intValue = value as Integer
def newLevel = Math.max(Math.min(intValue, 100), 0)
Map eventMap = [name: "level", value: newLevel, unit: "%", isStateChange: true]
return eventMap
}
def setLevel(value, duration) {
log.trace "Executing setLevel $value (ignoring duration)"
setLevel(value)
}

private implicitOn() {
if (device.currentValue("switch") != "on") {
turnOn()
}
}

private turnOn() {
sendEvent(name: "switch", value: "on", isStateChange: true)
}

private turnOff() {
sendEvent(name: "switch", value: "off", isStateChange: true)
}

def installed() {
setLevel(100)
}
61 changes: 61 additions & 0 deletions devicetypes/smartthings/virtual-switch.src/virtual-switch.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright 2017 SmartThings
*
* Provides a virtual switch.
*
* 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: "Virtual Switch", namespace: "smartthings", author: "SmartThings", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {
capability "Actuator"
capability "Sensor"
capability "Switch"
}

preferences {}

tiles(scale: 2) {
multiAttributeTile(name:"switch", type: "lighting", width: 6, height: 4, canChangeIcon: true){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.Home.home30", backgroundColor:"#00A0DC", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.Home.home30", backgroundColor:"#FFFFFF", nextState:"turningOn", defaultState: true
attributeState "turningOn", label:'Turning On', action:"switch.off", icon:"st.Home.home30", backgroundColor:"#00A0DC", nextState:"turningOn"
attributeState "turningOff", label:'Turning Off', action:"switch.on", icon:"st.Home.home30", backgroundColor:"#FFFFFF", nextState:"turningOff"
}
}

standardTile("explicitOn", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: "On", action: "switch.on", icon: "st.Home.home30", backgroundColor: "#ffffff"
}
standardTile("explicitOff", "device.switch", width: 2, height: 2, decoration: "flat") {
state "default", label: "Off", action: "switch.off", icon: "st.Home.home30", backgroundColor: "#ffffff"
}

main(["switch"])
details(["switch", "explicitOn", "explicitOff"])

}
}

def parse(String description) {
}

def on() {
sendEvent(name: "switch", value: "on", isStateChange: true)
}

def off() {
sendEvent(name: "switch", value: "off", isStateChange: true)
}

def installed() {
on()
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ metadata {

attribute "colorName", "string"

fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0702,0B05,FC03,FC04", outClusters: "0019", manufacturer: "sengled", model: "E11-N1EA", deviceJoinName: "Sengled Element Color Plus"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0702,0B05,FC03,FC04", outClusters: "0019", manufacturer: "sengled", model: "E12-N1E", deviceJoinName: "Sengled Element Color Plus"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY Flex RGBW", deviceJoinName: "SYLVANIA Smart Flex RGBW"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "Flex RGBW", deviceJoinName: "OSRAM LIGHTIFY Flex RGBW"
fingerprint profileId: "0104", inClusters: "0000,0003,0004,0005,0006,0008,0300,0B04,FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY A19 RGBW", deviceJoinName: "SYLVANIA Smart A19 RGBW"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import groovy.transform.Field
@Field Boolean hasConfiguredHealthCheck = false

metadata {
definition (name: "ZLL Dimmer Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
definition (name: "ZLL Dimmer Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {

capability "Actuator"
capability "Configuration"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import physicalgraph.zigbee.zcl.DataType

metadata {
definition (name: "ZLL RGB Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
definition (name: "ZLL RGB Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {

capability "Actuator"
capability "Color Control"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import physicalgraph.zigbee.zcl.DataType

metadata {
definition (name: "ZLL RGBW Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
definition (name: "ZLL RGBW Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {

capability "Actuator"
capability "Color Control"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import groovy.transform.Field
@Field Boolean hasConfiguredHealthCheck = false

metadata {
definition (name: "ZLL White Color Temperature Bulb 5000K", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
definition (name: "ZLL White Color Temperature Bulb 5000K", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {

capability "Actuator"
capability "Color Temperature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import groovy.transform.Field
@Field Boolean hasConfiguredHealthCheck = false

metadata {
definition (name: "ZLL White Color Temperature Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light") {
definition (name: "ZLL White Color Temperature Bulb", namespace: "smartthings", author: "SmartThings", ocfDeviceType: "oic.d.light", runLocally: true, minHubCoreVersion: '000.021.00001', executeCommandsLocally: true) {

capability "Actuator"
capability "Color Temperature"
Expand Down
3 changes: 2 additions & 1 deletion devicetypes/smartthings/zwave-lock.src/zwave-lock.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def updated() {
if (!state.fw) {
cmds << zwave.versionV1.versionGet().format()
}
hubAction = response(delayBetween(cmds, 4200))
hubAction = response(delayBetween(cmds, 30*1000))
}
} catch (e) {
log.warn "updated() threw $e"
Expand Down Expand Up @@ -406,6 +406,7 @@ private def handleAccessAlarmReport(cmd) {
} else {
// locked by pressing the Schlage button
map.descriptionText = "Locked manually"
map.data = [ method: "keypad" ]
}
break
case 6: // Unlocked with keypad
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Virtual Device Manager
*
* Copyright 2015 Bob Florian/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.
*
*/

definition(
name: "Virtual Device Manager",
namespace: "smartthings",
author: "SmartThings",
description: "Creates virtual devices",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/[email protected]",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/[email protected]",
singleInstance: true,
pausable: false
)


preferences {
page name: "mainPage", install: true, uninstall: true
}

def mainPage() {
dynamicPage(name: "mainPage") {
section {
input "virtualDeviceType", "enum", title: "Which type of virtual device do you want to create?", multiple: false, required: true, options: ["Virtual Switch", "Virtual Dimmer Switch"]
input "theHub", "hub", title: "Select the hub (required for local execution) (Optional)", multiple: false, required: false
}
}
}

def installed() {
log.debug "Installed with settings: ${settings}"
state.nextDni = 1
}

def updated() {
log.debug "Updated with settings: ${settings}"
initialize()
}

def initialize() {
def latestDni = state.nextDni
if (virtualDeviceType) {
def d = addChildDevice("smartthings", virtualDeviceType, "virtual-$latestDni", theHub?.id, [completedSetup: true, label: "$virtualDeviceType $latestDni"])
latestDni++
state.nextDni = latestDni
} else {
log.error "Failed creating Virtual Device because the device type was missing"
}
}

0 comments on commit c084de4

Please sign in to comment.