-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathBetterLaundryMonitor_Parent.groovy
102 lines (81 loc) · 3.13 KB
/
BetterLaundryMonitor_Parent.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
* Hubitat Import URL: https://raw.githubusercontent.com/HubitatCommunity/Hubitat-BetterLaundryMonitor/master/BetterLaundryMonitor_Parent.groovy
*/
/**
* Alert on Power Consumption
*
* Copyright 2015 Kevin Tierney, C Steele
*
* 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.
*
*
*
* csteele: v1.5.0 Add Contact sensor child
* Remove UpdateCheck, rely on HPM to check for a new version.
*
*/
public static String version() { return "v1.5.0" }
definition(
name: "Better Laundry Monitor",
namespace: "tierneykev",
author: "Kevin Tierney, CSteele",
description: "Using a switch with powerMonitor capability, monitor the laundry cycle and alert when it starts or done.",
category: "Green Living",
iconUrl: "",
iconX2Url: "",
iconX3Url: "",
)
preferences {
page name: "mainPage", title: "", install: true, uninstall: true // ,submitOnChange: true
}
def mainPage() {
dynamicPage(name: "mainPage") {
section {
paragraph title: "<Better Laundry Monitor",
"<b>This parent app is a container for all:</b><br> Better Laundry Monitor - Power Switch child apps"
}
section (){app(name: "BlMpSw", appName: "Better Laundry Monitor - Power Switch", namespace: "tierneykev", title: "New Better Laundry Monitor - Power Switch App", multiple: true)}
section (title: "<b>Name/Rename</b>") {label title: "Enter a name for this parent app (optional)", required: false}
section ("Other preferences") {
input "debugOutput", "bool", title: "<b>Enable debug logging?</b>", defaultValue: true
input "descTextEnable","bool", title: "<b>Enable descriptionText logging?</b>", defaultValue: true
}
display()
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unschedule()
unsubscribe()
if (debugOutput) runIn(1800,logsOff)
initialize()
}
def initialize() {
log.info "There are ${childApps.size()} child smartapps"
childApps.each {child ->
child.setDebug(debugOutput, descTextEnable)
log.info "Child app: ${child.label}"
}
}
def logsOff() {
log.warn "debug logging disabled..."
app?.updateSetting("debugOutput",[value:"false",type:"bool"])
}
def display() {
section{
paragraph "\n<hr style='background-color:#1A77C9; height: 1px; border: 0;'></hr>"
paragraph "<div style='color:#1A77C9;text-align:center;font-weight:small;font-size:9px'>Developed by: Kevin Tierney, ChrisUthe, C Steele<br/>Version Status: $state.Status<br>Current Version: ${version()} - ${thisCopyright}</div>"
}
}
def getThisCopyright(){"© 2019 C Steele "}