Compare commits

..

18 Commits

Author SHA1 Message Date
Vinay Rao
eed1ced71b Merge pull request #1047 from SmartThingsCommunity/staging
Rolling up staging for production deploy
2016-07-12 14:33:19 -07:00
Vinay Rao
d080833d5c Merge pull request #1046 from SmartThingsCommunity/production
Rolling down production hotfix to staging
2016-07-12 14:26:10 -07:00
Vinay Rao
e998528e8e Merge pull request #1041 from rappleg/ProductionFixJsonSlurperHashMap
PRP-172 Fix Hue Connect parse errors on newer versions of Groovy
2016-07-11 23:49:10 -07:00
rappleg
d85566bb98 PRP-172 Fix Hue Connect parse errors on newer versions of Groovy 2016-07-10 15:35:12 -05:00
Duncan McKee
e1a5b4dd27 Merge pull request #1034 from SmartThingsCommunity/DVCSMP-1879
DVCSMP-1879 Fix error in Z-Wave Door/Window Sensor throwing exceptions on update
2016-07-06 17:43:42 -04:00
Duncan McKee
a2baa37901 DVCSMP-1879 Fix error in Z-Wave Door/Window Sensor throwing exceptions on update 2016-07-06 17:08:15 -04:00
Vinay Rao
922ab45343 Merge pull request #1033 from SmartThingsCommunity/master
Rolling up master to staging for deploy
2016-07-06 13:59:03 -07:00
Vinay Rao
962774996e Merge pull request #1032 from SmartThingsCommunity/staging
Rolling down staging hotfix to master
2016-07-06 13:57:35 -07:00
Vinay Rao
d79594cbcb Merge pull request #1031 from SmartThingsCommunity/production
Rolling down production hotfix to staging
2016-07-06 13:56:39 -07:00
Vinay Rao
bf8fe4cad7 Merge pull request #1030 from rappleg/RevertLazyMapNewerGroovyVersion
Revert "PRP-172 Fix Hue Connect parse errors on newer versions of Groovy"
2016-07-06 13:53:32 -07:00
rappleg
65752ce378 Revert "PRP-172 Fix Hue Connect parse errors on newer versions of Groovy"
This reverts commit be7f6a76a9.
2016-07-06 14:44:58 -05:00
spurohit1
95f08aeb3d Update logitech-harmony-connect.groovy (#1009)
If port is present in the callbackUrl then send command to hub else post the request through http.
Removed isIP function since it is no longer required.
2016-07-06 09:40:29 -04:00
Vinay Rao
cd7bc1b262 Merge pull request #1023 from rappleg/FixHueConnectParseErrorsGrailsUpgradeProduction
PRP-172 Fix Hue Connect parse errors on newer versions of Groovy
2016-06-30 00:46:24 -07:00
rappleg
be7f6a76a9 PRP-172 Fix Hue Connect parse errors on newer versions of Groovy 2016-06-30 02:42:24 -05:00
Vinay Rao
10e5b7e9d7 Merge pull request #1021 from SmartThingsCommunity/master
Rolling up master to staging
2016-06-28 22:57:32 -07:00
Vinay Rao
90e6dc91eb Merge pull request #1018 from SmartThingsCommunity/staging
Rolling up staging to production
2016-06-28 14:16:10 -07:00
Vinay Rao
3ee8f86aa3 Merge pull request #1004 from SmartThingsCommunity/staging
Rolling up staging to prod
2016-06-21 13:19:59 -07:00
Vinay Rao
d1a910f11f Merge pull request #992 from SmartThingsCommunity/staging
Rolling up staging to prod
2016-06-14 13:11:06 -07:00
4 changed files with 11 additions and 209 deletions

View File

@@ -28,7 +28,6 @@ metadata {
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,0x84,0x85,0x59,0x71,0x70,0x7A,0x98" // Vision door/window
}
// simulator metadata
@@ -83,12 +82,12 @@ def updated() {
cmds = [
command(zwave.manufacturerSpecificV2.manufacturerSpecificGet()),
"delay 1200",
zwave.wakeUpV1.wakeUpNoMoreInformation()
zwave.wakeUpV1.wakeUpNoMoreInformation().format()
]
} else if (!state.lastbat) {
cmds = []
} else {
cmds = [zwave.wakeUpV1.wakeUpNoMoreInformation()]
cmds = [zwave.wakeUpV1.wakeUpNoMoreInformation().format()]
}
response(cmds)
}

View File

@@ -1,178 +0,0 @@
/**
* Timer Light
*
* Copyright 2016 Kevin Hill
*
* 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.
*
*/
import groovy.time.*
definition(
name: "Timer Light",
namespace: "gr8gitsby",
author: "Kevin Hill",
description: "This puts outside lights on a timer",
category: "Convenience",
iconUrl: "https://source.unsplash.com/category/nature/60x60",
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 {
// Use a light swtich
section("Light Switch") {
// Capabilities link: http://docs.smartthings.com/en/latest/capabilities-reference.html
// Input data types: http://docs.smartthings.com/en/latest/device-type-developers-guide/device-preferences.html?highlight=input#supported-input-types
input "theSwitch", "capability.switch", title: "Pick your light switch"
input "confirmationSwitch", "capability.switch", title: "Pick the notification switch"
input "minutes", "number", title: "Enter the number of minutes you'd like the lights on"
input "person", "capability.presenceSensor", title: "When who arrives?"
// When arrival is detected, if it is dark, turn on the outside lights
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
subscribe(theSwitch, "switch", switchHandler)
subscribe(confirmationSwitch, "switch", confirmationSwitchHandler)
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
// This method sets up the app
subscribe(person, "presence", presenceChange)
state.Flashes = 4
initialSunPosition()
}
def presenceChange(evt){
log.debug("presenceChange")
// if someone arrives at night the lights will turn on
if("present" == evt.value){
timerLight()
}
}
// Function to set lights on timer for person arriving
def timerLight() {
log.debug(state.sunPosition)
if(state.sunPosition == "down"){
light.on()
runIn(60 * minutes, turnOff)
}
}
def turnOff(){
// This method turns off the ligt
theSwitch.off()
confirmationSwitch.off()
}
def initialSunPosition() {
// This method determines if sun is down at time of initializtion and run sunsetHandler() if so
def s = getSunriseAndSunset(zipCode: "98052")
def now = new Date()
def riseTime = s.sunrise
def setTime = s.sunset
if(setTime.before(now)) {
sunsetHandler()
log.info "Sun is already down, run sunsetHandler"
}
else
{ if (riseTime.after(now)) {
sunriseHandler()
log.info "Sun is up, run sunriseHandler"
}
}
}
def sunriseHandler() {
// method to set the sun position when the sun rises
state.sunPosition = "up"
}
def sunsetHandler() {
// method to set the sun position when the sunsets
state.sunPosition = "down"
}
/*
def switchHandler(evt) {
log.debug("switch Handler Fired")
}
*/
def confirmationSwitchHandler(evt) {
state.Flashes = state.Flashes - 1
log.debug("Flashes: ${state.Flashes}")
log.debug("Event State: ${evt.value}")
if(evt.value == "on" && state.Flashes > 0) {
runIn(2, turnOffConfirmationSwitch)
} else if(evt.value == "off" && state.Flashes > 0) {
runIn(2, turnOnConfirmationSwitch)
}
if(state.Flashes == 0){
state.Flashes = 4
}
}
def turnOnConfirmationSwitch(){
confirmationSwitch.on()
}
def turnOffConfirmationSwitch(){
confirmationSwitch.off()
}
def switchHandler(evt){
log.debug("light Event handler fired")
// use Event rather than DeviceState because we may be changing DeviceState to only store changed values
def recentStates = theSwitch.eventsSince(new Date(now() - 4000), [all:true, max: 10]).findAll{it.name == "switch"}
log.debug "${recentStates?.size()} STATES FOUND, LAST AT ${recentStates ? recentStates[0].dateCreated : ''}"
//sendPush("Attempting to check light presses")
if (evt.value == "on") {
log.debug("==== ON ====")
}
log.debug(recentStates.size())
//if (evt.isPhysical()) {
if (recentStates.size() >= 2) {
log.debug "Outside light timer mode engaged"
def switchattr = confirmationSwitch.currentValue("switch")
log.debug "confirmationSwitch: $switchattr"
confirmationSwitch.on()
//alternativeSwitch.off()
//def message = "${location.name} executed ${settings.onPhrase} because ${evt.title} was tapped twice."
runIn(60 * minutes, turnOff)
} else {
log.trace "Skipping digital on/off event"
}
//log.debug("switch is on, turn off in $minutes")
//runIn(60*minutes, turnOff)
//}
}

View File

@@ -689,7 +689,7 @@ def parse(childDevice, description) {
log.warn "Parsing Body failed - trying again..."
poll()
}
if (body instanceof java.util.HashMap) {
if (body instanceof java.util.Map) {
//poll response
def bulbs = getChildDevices()
for (bulb in body) {
@@ -830,22 +830,22 @@ def setColorTemperature(childDevice, huesettings) {
def setColor(childDevice, huesettings) {
log.debug "Executing 'setColor($huesettings)'"
def value = [:]
def hue = null
def sat = null
def xy = null
if (huesettings.hex != null) {
value.xy = getHextoXY(huesettings.hex)
} else {
if (huesettings.hue != null)
value.hue = Math.min(Math.round(huesettings.hue * 65535 / 100), 65535)
if (huesettings.saturation != null)
if (huesettings.saturation != null)
value.sat = Math.min(Math.round(huesettings.saturation * 255 / 100), 255)
}
// Default behavior is to turn light on
// Default behavior is to turn light on
value.on = true
if (huesettings.level != null) {
@@ -853,7 +853,7 @@ def setColor(childDevice, huesettings) {
value.on = false
else if (huesettings.level == 1)
value.bri = 1
else
else
value.bri = Math.min(Math.round(huesettings.level * 255 / 100), 255)
}
value.alert = huesettings.alert ? huesettings.alert : "none"

View File

@@ -823,8 +823,8 @@ def deviceHandler(evt) {
}
def sendToHarmony(evt, String callbackUrl) {
def callback = new URI(callbackUrl)
if(isIP(callback.host)){
def callback = new URI(callbackUrl)
if (callback.port != -1) {
def host = callback.port != -1 ? "${callback.host}:${callback.port}" : callback.host
def path = callback.query ? "${callback.path}?${callback.query}".toString() : callback.path
sendHubCommand(new physicalgraph.device.HubAction(
@@ -852,25 +852,6 @@ def sendToHarmony(evt, String callbackUrl) {
}
}
public static boolean isIP(String str) {
try {
String[] parts = str.split("\\.");
if (parts.length != 4) return false;
for (int i = 0; i < 4; ++i) {
int p
try {
p = Integer.parseInt(parts[i]);
} catch (Exception e) {
return false;
}
if (p > 255 || p < 0) return false;
}
return true;
} catch (Exception e) {
return false;
}
}
def listHubs() {
location.hubs?.findAll { it.type.toString() == "PHYSICAL" }?.collect { hubItem(it) }
}