Compare commits

..

3 Commits

Author SHA1 Message Date
Samsung DA
83c7b2dd42 MSA-809: I've updated the code. MSA-785: SleepSense Automation # 424 2016-01-14 23:06:29 -06:00
Juan Pablo Risso
56cfe9e936 Merge pull request #430 from juano2310/Wemo
PROB-537 - Fix error in line 337
2016-01-13 13:20:10 -05:00
Juan Risso
0d214b742e PROB-537 - Fix error in line 337 2016-01-11 12:10:13 -05:00
3 changed files with 1590 additions and 4 deletions

View File

@@ -0,0 +1,101 @@
/**
* Sleep Wizard
*
* Copyright 2015 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: "Smart Sleep",
namespace: "smartsolutionsv2/sleeping",
author: "SmartThings",
description: "Create rules to control devices based on a sleep sensor, including in bed, out of bed, sleeping, and not sleeping.",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/ModeMagic/Cat-ModeMagic.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/ModeMagic/Cat-ModeMagic@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/ModeMagic/Cat-ModeMagic@3x.png",
singleInstance: true
)
preferences {
page(name: "main", title: getLabel("str_Title"), install: true, uninstall: true) {
section {
app(name: "smartsleepautomation", appName: "Smart Sleep Automation", namespace: "smartsolutionsv2/sleeping", title: getLabel("str_SectionTitle"), multiple: true, uninstall: true)
}
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
initialize()
}
def initialize() {
def numChildApps = getChildApps().size();
def text = "${numChildApps} rules configured";
sendEvent(
linkText: numChildApps.toString(),
descriptionText: next,
eventType: "SOLUTION_SUMMARY",
name: "summary",
value: numChildApps,
data: [["icon": "indicator-dot-gray", "iconColor": "#878787", "value":text]],
displayed: false
);
}
cards {
card("Action History") {
tiles {
eventTile { }
}
}
}
def getLabel(value)
{
def str_Title=[
"kr": "룰",
"us": "Rules"
]
def str_SectionTitle=[
"kr": "새로운 자동화 룰 만들기",
"us": "New Smart Sleep Automation"
]
if(clientLocale?.language == "ko")
{
switch(value)
{
case "str_Title":
return str_Title["kr"]
case "str_SectionTitle":
return str_SectionTitle["kr"]
}
}
else
{
switch(value)
{
case "str_Title":
return str_Title["us"]
case "str_SectionTitle":
return str_SectionTitle["us"]
}
}
return "Unknown"
}

View File

@@ -258,8 +258,8 @@ def installed() {
def updated() {
log.trace "Updated with settings: ${settings}"
unschedule()
unsubscribe()
unschedule()
initialize()
}
@@ -325,6 +325,7 @@ def addBulbs() {
} else {
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.value.hub, ["label":newHueBulb?.value.name])
}
log.debug "created ${d.displayName} with id $dni"
} else {
log.debug "$dni in not longer paired to the Hue Bridge or ID changed"
}
@@ -333,8 +334,6 @@ def addBulbs() {
newHueBulb = bulbs.find { (app.id + "/" + it.id) == dni }
d = addChildDevice("smartthings", "Hue Bulb", dni, newHueBulb?.hub, ["label":newHueBulb?.name])
}
log.debug "created ${d.displayName} with id $dni"
d.refresh()
} else {
log.debug "found ${d.displayName} with id $dni already exists, type: '$d.typeName'"
@@ -775,4 +774,4 @@ private Boolean hasAllHubsOver(String desiredFirmware) {
private List getRealHubFirmwareVersions() {
return location.hubs*.firmwareVersionString.findAll { it }
}
}