Compare commits

..

1 Commits

Author SHA1 Message Date
Will Cole
801944e689 MSA-1733: This application allows a user to set up from 1 to 5 lighting scenes, controlled by momentary switches. The switches could be physical momentary wall switches, or virtual switches created in the IDE.
The lighting scene options include setting color hue and saturation for color-changing bulbs, & lighting level and color temperature for color temperature bulbs (which includes color-changing bulbs as well). A 'scene' can change any or all of the parameters. As an example, 'Movie Scene' could set the lighting level on all lights to 25%, the color temperature for color temp bulbs to 2700k, and leave the colors alone; while 'Full Bright' could set the color temperature to 5500k and brightness to 100% for all bulbs. 'Green' mode could set the hue/saturation of color bulbs to full green, while leaving brightness levels as is, or could set the brightness to a different level at the same time.
2017-01-23 14:41:25 -08:00
9 changed files with 552 additions and 113 deletions

View File

@@ -17,7 +17,6 @@ metadata {
capability "Refresh"
capability "Sensor"
capability "Health Check"
capability "Light"
command "setAdjustedColor"
command "reset"

View File

@@ -18,7 +18,6 @@ metadata {
capability "Refresh"
capability "Sensor"
capability "Health Check"
capability "Light"
command "setAdjustedColor"
command "reset"

View File

@@ -14,8 +14,7 @@ metadata {
capability "Switch"
capability "Refresh"
capability "Sensor"
capability "Health Check"
capability "Light"
capability "Health Check"
command "refresh"
}

View File

@@ -16,7 +16,6 @@ metadata {
capability "Switch"
capability "Refresh"
capability "Health Check"
capability "Light"
command "refresh"
}

View File

@@ -12,7 +12,7 @@
*
*/
metadata {
definition (name: "Simulated Switch", namespace: "smartthings/testing", author: "bob") {
capability "Switch"
capability "Relay Switch"
@@ -39,7 +39,9 @@ metadata {
}
}
def parse(description) {
def parse(String description) {
def pair = description.split(":")
createEvent(name: pair[0].trim(), value: pair[1].trim())
}
def on() {

View File

@@ -28,10 +28,6 @@ metadata {
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B05", outClusters: "0019", manufacturer: "OSRAM SYLVANIA", model: "iQBR30", deviceJoinName: "Sylvania Ultra iQ"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY PAR38 ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart PAR38 Soft White"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0B04, FC0F", outClusters: "0019", manufacturer: "OSRAM", model: "LIGHTIFY BR ON/OFF/DIM", deviceJoinName: "SYLVANIA Smart BR30 Soft White"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008, 0702, 0B05", outClusters: "0019", manufacturer: "sengled", model: "E11-G13", deviceJoinName: "Sengled Element Classic"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL6HD", deviceJoinName: "Leviton Dimmer Switch"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL3HL", deviceJoinName: "Leviton Lumina RF Plug-In Dimmer"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006, 0008", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL1KD", deviceJoinName: "Leviton Lumina RF Dimmer Switch"
}
tiles(scale: 2) {

View File

@@ -22,7 +22,6 @@ metadata {
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"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0006", outClusters: "000A", manufacturer: "HAI", model: "65A21-1", deviceJoinName: "Leviton Wireless Load Control Module-30amp"
fingerprint profileId: "0104", inClusters: "0000, 0003, 0004, 0005, 0006", outClusters: "0003, 0006, 0008, 0019, 0406", manufacturer: "Leviton", model: "DL15A", deviceJoinName: "Leviton Lumina RF Plug-In Appliance Module"
}
// simulator metadata

View File

@@ -0,0 +1,547 @@
/**
* Switches Control Light Scenes
*
* Copyright 2017 Will Cole
*
* 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: "Control Light Scenes",
namespace: "triosniolin",
author: "Will Cole",
description: "Using switches, control scenes for light(s).",
category: "Convenience",
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")
preferences {
page(name: "page1")
page(name: "page2")
page(name: "page3")
page(name: "page4")
page(name: "page5")
page(name: "page6")
}
def page1() {
dynamicPage(name: "page1", title: "Select devices:", nextPage: "page2", uninstall:true) {
section("Number of Scenes (such as on, off, movie, party)") {
input "scenes", "number",
title: "Number of Scenes (1-5)",
range: "1..5",
defaultValue: "3",
required: true,
submitOnChange: true
}
section("Device(s) to control") {
input "colors", "capability.colorControl",
multiple: true,
title: "Slave Color bulb(s)...",
required: false,
hideWhenEmpty: true
input "slaves", "capability.colorTemperature",
multiple: true,
title: "Slave Temp bulb(s)...",
required: true
}
}
}
def page2() {
def i = 1
if (scenes > i) {
dynamicPage(name: "page2", title: "Select Scene $i", nextPage: "page3") {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
} else {
dynamicPage(name: "page2", title: "Select Scene $i", install:true) {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
}
}
def page3() {
def i = 2
if (scenes > i) {
dynamicPage(name: "page3", title: "Select Scene $i", nextPage: "page4") {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
} else {
dynamicPage(name: "page3", title: "Select Scene $i", install:true) {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
}
}
def page4() {
def i = 3
if (scenes > i) {
dynamicPage(name: "page4", title: "Select Scene $i", nextPage: "page5") {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
} else {
dynamicPage(name: "page4", title: "Select Scene $i", install:true) {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
}
}
def page5() {
def i = 4
if (scenes > i) {
dynamicPage(name: "page5", title: "Select Scene $i", nextPage: "page6") {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
} else {
dynamicPage(name: "page5", title: "Select Scene $i", install:true) {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
}
}
def page6() {
def i = 5
dynamicPage(name: "page6", title: "Select Scene $i", install:true) {
section("Scene $i") {
input "switch$i", "capability.switch",
multiple: false,
title: "Switch To Enable Scene $i",
required: true
}
section("Scene $i Color Temp") {
input "Temp$i", "number",
title: "Scene $i Color Temp (Kelvin) (2700-6500)",
range: "2700..6500",
defaultValue: "",
required: false
}
section("Scene $i Level") {
input "Dim$i", "number",
title: "Scene $i Dim Level (0-100%)",
range: "0..100",
defaultValue: "",
required: false
}
if (colors) {
section("Scene $i Hue") {
input "Hue$i", "number",
title: "Scene $i Hue (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
section("Scene $i Saturation") {
input "Sat$i", "number",
title: "Scene $i Saturation (0-100)",
range: "0..100",
defaultValue: "",
required: false
}
}
}
}
def installed()
{
if (switch1) {
subscribe (switch1, "switch.on", switch1Handler)
}
if (switch2) {
subscribe (switch2, "switch.on", switch2Handler)
}
if (switch3) {
subscribe (switch3, "switch.on", switch3Handler)
}
if (switch4) {
subscribe (switch4, "switch.on", switch4Handler)
}
if (switch5) {
subscribe (switch5, "switch.on", switch5Handler)
}
}
def updated()
{
unsubscribe()
if (switch1) {
subscribe (switch1, "switch.on", switch1Handler)
}
if (switch2) {
subscribe (switch2, "switch.on", switch2Handler)
}
if (switch3) {
subscribe (switch3, "switch.on", switch3Handler)
}
if (switch4) {
subscribe (switch4, "switch.on", switch4Handler)
}
if (switch5) {
subscribe (switch5, "switch.on", switch5Handler)
}
log.info "subscribed to all of switches events"
}
def switch1Handler(evt){
log.info "switch1Handler Event: ${evt.value}"
if (colors) {
if (Temp1) { slaves?.setColorTemperature(Temp1)
colors?.setColorTemperature(Temp1) }
if (Dim1) { slaves?.setLevel(Dim1)
colors?.setLevel(Dim1) }
if (Hue1) { colors?.setHue(Hue1) }
if (Sat1) { colors?.setSaturation(Sat1) }
} else {
if (Temp1) { slaves?.setColorTemperature(Temp1) }
if (Dim1) { slaves?.setLevel(Dim1) }
}
}
def switch2Handler(evt){
log.info "switch2Handler Event: ${evt.value}"
if (colors) {
if (Temp2) { slaves?.setColorTemperature(Temp2)
colors?.setColorTemperature(Temp2) }
if (Dim2) { slaves?.setLevel(Dim2)
colors?.setLevel(Dim2) }
if (Hue2) { colors?.setHue(Hue2) }
if (Sat2) { colors?.setSaturation(Sat2) }
} else {
if (Temp2) { slaves?.setColorTemperature(Temp2) }
if (Dim2) { slaves?.setLevel(Dim2) }
}
}
def switch3Handler(evt){
log.info "switch3Handler Event: ${evt.value}"
if (colors) {
if (Temp3) { slaves?.setColorTemperature(Temp3)
colors?.setColorTemperature(Temp3) }
if (Dim3) { slaves?.setLevel(Dim3)
colors?.setLevel(Dim3) }
if (Hue3) { colors?.setHue(Hue3) }
if (Sat3) { colors?.setSaturation(Sat3) }
} else {
if (Temp3) { slaves?.setColorTemperature(Temp3) }
if (Dim3) { slaves?.setLevel(Dim3) }
}
}
def switch4Handler(evt){
log.info "switch4Handler Event: ${evt.value}"
if (colors) {
if (Temp4) { slaves?.setColorTemperature(Temp4)
colors?.setColorTemperature(Temp4) }
if (Dim4) { slaves?.setLevel(Dim4)
colors?.setLevel(Dim4) }
if (Hue4) { colors?.setHue(Hue4) }
if (Sat4) { colors?.setSaturation(Sat4) }
} else {
if (Temp4) { slaves?.setColorTemperature(Temp4) }
if (Dim4) { slaves?.setLevel(Dim4) }
}
}
def switch5Handler(evt){
log.info "switch5Handler Event: ${evt.value}"
if (colors) {
if (Temp5) { slaves?.setColorTemperature(Temp5)
colors?.setColorTemperature(Temp5) }
if (Dim5) { slaves?.setLevel(Dim5)
colors?.setLevel(Dim5) }
if (Hue5) { colors?.setHue(Hue5) }
if (Sat5) { colors?.setSaturation(Sat5) }
} else {
if (Temp5) { slaves?.setColorTemperature(Temp5) }
if (Dim5) { slaves?.setLevel(Dim5) }
}
}

View File

@@ -1,101 +0,0 @@
/**
* Xandem Home Integration
*
* Copyright 2017 Derek Twaddle
*
* 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.
*
* README
*
* Hello, after purchsing Xandem Home for a rental property I noticed there were no SmartApps yet developed. This is my
* first attempt at integrating Xandem with SmartThings out of personal need and decided to share with the community.
*
* Depending on your ISP and setup, there are some preliminary steps that need to be performed before installing this app. Xandem is initially
* accessible only via local network so you will need to make some minor rule changes to your firewall / router.
*
* If you have a static IP assignment from your ISP, you may forgo the following step. If your ISP assigns an IP Address to you Dynamically
* which is what most do at Resedential installations, you will need a Dynamic DNS service. Dynamic DNS will map your randomly assigned IP
* address to a static name like (Ex: myhome.dyndns.com). No matter what your IP changes to, it will always be resolved using the same name you chose.
*
* Once the above is completed, you will need to configure your router to pass or port forward to your internal Xandem Hub. You will
* want to statically assign a local IP to the mac address of the Xandem Hub. This way you will always assign the same local IP to the Xandem Hub which can be mapped
* and used in port forwarding rules. After the IP has been assigned (Ex: 192.168.1.25) add a rule on your rounter to pass incoming Port 80 request
* to your Xandem Hub IP address on the same port. This effectively lets your router listen for and pass data from SmarthThings to your Xandem Hub.
*
* Once the above networking steps are completed, create a Xandem API key on your local Xandem Hub. Instructions can
* found here: http://documentation.xandem.com/api/#api-keys-and-authorization-header
*
* This SmartApp is a personal project you are free to use.
*/
definition(
name: "Xandem Home Integration",
namespace: "Xandem",
author: "Derek Twaddle",
description: "Integrates Xandem Home to SmartThings. Detects motion, if above a user set threshold, turn on light.",
category: "Safety & Security",
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"
)
preferences {
section("Network Configuration") {
input "ddns", "text", title: " External Hostname or Static IP", required: true
paragraph "Example: mynetwork.dyndns.org or 64.102.0.1"
input "apikey", "text", title: "API Key", required: true
paragraph "Enter the Xandem API Key generated on your local Hub"
}
section("Turn on when motion detected and at or above level:") {
input "thelevel", "text", title: "1 - 10", required: true
paragraph "Motion Level: 1 Minimal Motion - 10 High Motion"
}
section("Turn on this light") {
input "theswitch", "capability.switch", required: true
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
runEvery5Minutes(updateStatus)
}
def updateStatus() {
def params = [
uri: "http://${ddns}/v1/data",
headers: [Authorization: "${apikey}"],
body: [data_fields: ["motion_score", "is_motion"]]
]
try {
httpPostJson(params) { resp ->
resp.headers.each {
}
// If motion detected and motion level is at or above chosen level, Light On
if (resp.data.is_motion != 0 && resp.data.motion_score >= thelevel){
theswitch.on()
log.debug "Motion detected, light on"
}
}
} catch (e) {
log.debug "something went wrong: $e"
}
}