2 * Copyright 2014 Yves Racine
3 * LinkedIn profile: ca.linkedin.com/pub/yves-racine-m-sc-a/0/406/4b/
5 * Developer retains all right, title, copyright, and interest, including all copyright, patent rights, trade secret
6 * in the Background technology. May be subject to consulting fees under the Agreement between the Developer and the Customer.
7 * Developer grants a non exclusive perpetual license to use the Background technology in the Software developed for and delivered
8 * to Customer under this Agreement. However, the Customer shall make no commercial use of the Background technology without
9 * Developer's written consent.
11 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
12 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * Software Distribution is restricted and shall be done only with Developer's written approval.
15 * Manage Vacation events at Ecobee Thermostat(s)
16 * N.B. Requires MyEcobee device available at
17 * http://www.ecomatiqhomes.com/#!store/tc3yr
20 // Automatically generated. Make future change here.
22 name: "ecobeeManageVacation",
24 author: "Yves Racine",
25 description: "manages your ecobee vacation settings ['creation', 'update', 'delete']",
27 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee.png",
28 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee@2x.png"
33 paragraph "ecobeeManageVacation, the smartapp that manages your ecobee vacation settings ['creation', 'update', 'delete']"
34 paragraph "Version 1.9.3"
35 paragraph "If you like this smartapp, please support the developer via PayPal and click on the Paypal link below "
36 href url: "https://www.paypal.me/ecomatiqhomes",
37 title:"Paypal donation..."
38 paragraph "Copyright©2014 Yves Racine"
39 href url:"http://github.com/yracine/device-type.myecobee", style:"embedded", required:false, title:"More information..."
40 description: "http://github.com/yracine/device-type.myecobee/blob/master/README.md"
43 section("For the Ecobee thermostat(s)") {
44 input "ecobee", "device.myEcobeeDevice", title: "Ecobee Thermostat", multiple:true
46 section("Create this Vacation Name") {
47 input "vacationName", "text", title: "Vacation Name"
50 section("Or delete the vacation [default=false]") {
51 input "deleteVacation", "Boolean", title: "delete?", metadata: [values: ["true", "false"]], required: false
53 section("Cool Temp for vacation, [default = 80°F/27°C]") {
54 input "givenCoolTemp", "decimal", title: "Cool Temp", required: false
56 section("Heat Temp for vacation [default= 60°F/14°C]") {
57 input "givenHeatTemp", "decimal", title: "Heat Temp", required: false
59 section("Start date for the vacation, [format = DD-MM-YYYY]") {
60 input "givenStartDate", "text", title: "Beginning Date"
62 section("Start time for the vacation [HH:MM 24HR]") {
63 input "givenStartTime", "text", title: "Beginning time"
65 section("End date for the vacation [format = DD-MM-YYYY]") {
66 input "givenEndDate", "text", title: "End Date"
68 section("End time for the vacation [HH:MM 24HR]") {
69 input "givenEndTime", "text", title: "End time"
79 subscribe(app, appTouch)
88 subscribe(app, appTouch)
98 log.debug "ecobeeManageVacation> about to take actions"
99 def minHeatTemp, minCoolTemp
100 def scale = getTemperatureScale()
102 minHeatTemp = givenHeatTemp ?: 14 // by default, 14°C is the minimum heat temp
103 minCoolTemp = givenCoolTemp ?: 27 // by default, 27°C is the minimum cool temp
105 minHeatTemp = givenHeatTemp ?: 60 // by default, 60°F is the minimum heat temp
106 minCoolTemp = givenCoolTemp ?: 80 // by default, 80°F is the minimum cool temp
108 def vacationStartDateTime = null
109 String dateTime = null
111 dateTime = givenStartDate + " " + givenStartTime
112 log.debug("Start datetime= ${datetime}")
113 vacationStartDateTime = new Date().parse('d-M-yyyy H:m', dateTime)
115 dateTime = givenEndDate + " " + givenEndTime
116 log.debug("End datetime= ${datetime}")
117 def vacationEndDateTime = new Date().parse('d-M-yyyy H:m', dateTime)
119 if (deleteVacation == 'false') {
120 // You may want to change to ecobee.createVacation('serial number list',....) if you own EMS thermostat(s)
122 log.debug("About to call iterateCreateVacation for ${vacationName}")
124 it.createVacation("", vacationName, minCoolTemp, minHeatTemp, vacationStartDateTime,
127 send("ecobeeManageVacation> vacationName ${vacationName} created at ${ecobee}")
130 it.deleteVacation("", vacationName)
132 send("ecobeeManageVacation> vacationName ${vacationName} deleted at ${ecobee}")
140 if (sendPushMessage != "No") {
141 log.debug("sending push message")
146 log.debug("sending text message")
147 sendSms(phoneNumber, msg)