4 * Copyright 2014 Yves Racine
5 * LinkedIn profile: ca.linkedin.com/pub/yves-racine-m-sc-a/0/406/4b/
7 * Developer retains all right, title, copyright, and interest, including all copyright, patent rights, trade secret
8 * in the Background technology. May be subject to consulting fees under the Agreement between the Developer and the Customer.
9 * Developer grants a non exclusive perpetual license to use the Background technology in the Software developed for and delivered
10 * to Customer under this Agreement. However, the Customer shall make no commercial use of the Background technology without
11 * Developer's written consent.
13 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
14 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * Software Distribution is restricted and shall be done only with Developer's written approval.
18 * N.B. Requires MyEcobee device available at
19 * http://www.ecomatiqhomes.com/#!store/tc3yr
23 name: "ecobeeControlPlug",
25 author: "Yves Racine",
26 description: "Control a plug attached to an ecobee device",
28 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee.png",
29 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee@2x.png"
35 paragraph "ecobeeControlPlug, the smartapp that controls your ecobee connected sensor or plug"
36 paragraph "Version 1.1.4"
37 paragraph "If you like this smartapp, please support the developer via PayPal and click on the Paypal link below "
38 href url: "https://www.paypal.me/ecomatiqhomes",
39 title:"Paypal donation..."
40 paragraph "Copyright©2014 Yves Racine"
41 href url:"http://github.com/yracine/device-type.myecobee", style:"embedded", required:false, title:"More information..."
42 description: "http://github.com/yracine/device-type.myecobee/blob/master/README.md"
45 section("For this Ecobee thermostat") {
46 input "ecobee", "device.myEcobeeDevice", title: "Ecobee Thermostat"
48 section("Control this SmartPlug Name") {
49 input "plugName", "text", title: "SmartPlug Name"
51 section("Target control State") {
52 input "plugState", "enum", title: "Control State?", metadata: [values: ["on", "off", "resume", ]]
54 section("Hold Type") {
55 input "givenHoldType", "enum", title: "Hold Type?", metadata: [values: ["dateTime", "nextTransition", "indefinite"]]
57 section("For 'dateTime' holdType, Start date for the hold (format = DD-MM-YYYY)") {
58 input "givenStartDate", "text", title: "Beginning Date", required: false
60 section("For 'dateTime' holdType, Start time for the hold (HH:MM,24HR)") {
61 input "givenStartTime", "text", title: "Beginning time", required: false
63 section("For 'dateTime' holdType, End date for the hold (format = DD-MM-YYYY)") {
64 input "givenEndDate", "text", title: "End Date", required: false
66 section("For 'dateTime' holdType, End time for the hold (HH:MM,24HR)") {
67 input "givenEndTime", "text", title: "End time", required: false
90 subscribe(app, appTouch)
93 private void sendMsgWithDelay() {
101 log.debug "ecobeeControlPlug> about to take actions"
102 def plugSettings = [holdType: "${givenHoldType}"]
105 if (givenHoldType == "dateTime") {
107 if ((!givenStartDate) || (!givenEndDate) || (!givenStartTime) || (!givenEndTime)) {
108 state?.msg="ecobeeControlPlug>holdType=dateTime and dates/times are not valid for controlling plugName ${plugName}"
110 runIn(30, "sendMsgWithDelay")
113 plugSettings = [holdType: "dateTime", startDate: "${givenStartDate}", startTime: "${givenStartTime}", endDate: "${givenEndDate}", endTime: "${givenEndTime}"]
115 log.debug("About to call controlPlug for thermostatId=${thermostatId}, plugName=${plugName}")
116 ecobee.controlPlug("", plugName, plugState, plugSettings)
121 if (sendPushMessage != "No") {
122 log.debug("sending push message")
127 log.debug("sending text message")
128 sendSms(phoneNumber, msg)