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.
17 * N.B. Requires MyEcobee device available at
18 * http://www.ecomatiqhomes.com/#!store/tc3yr
21 name: "ecobeeManageClimate",
23 author: "Yves Racine",
24 description: "Allows a user to manage ecobee's climates",
26 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee.png",
27 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee@2x.png"
33 paragraph "ecobeeManageClimate, the smartapp that manages your ecobee climates ['creation', 'update', 'delete']"
34 paragraph "Version 1.9.5"
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 this ecobee thermostat") {
44 input "ecobee", "device.myEcobeeDevice", title: "Ecobee Thermostat"
46 section("Create (if not present) or update this climate") {
47 input "climateName", "text", title: "Climate Name"
49 section("Or delete the Climate [default=false]") {
50 input "deleteClimate", "Boolean", title: "delete?", metadata: [values: ["true", "false"]], required: false
52 section("Substitute Climate name in schedule (used for delete)") {
53 input "subClimateName", "text", title: "Climate Name", required: false
55 section("Cool Temp [default = 75°F/23°C]") {
56 input "givenCoolTemp", "decimal", title: "Cool Temp", required: false
58 section("Heat Temp [default=72°F/21°C]") {
59 input "givenHeatTemp", "decimal", title: "Heat Temp", required: false
61 section("isOptimized [default=false]") {
62 input "isOptimizedFlag", "Boolean", title: "isOptimized?", metadata: [values: ["true", "false"]], required: false
64 section("isOccupied [default=false]") {
65 input "isOccupiedFlag", "Boolean", title: "isOccupied?", metadata: [values: ["true", "false"]], required: false
67 section("Cool Fan Mode [default=auto]") {
68 input "givenCoolFanMode", "enum", title: "Cool Fan Mode ?", metadata: [values: ["auto", "on"]], required: false
70 section("Heat Fan Mode [default=auto]") {
71 input "givenHeatFanMode", "enum", title: "Heat Fan Mode ?", metadata: [values: ["auto", "on"]], required: false
73 section("Notifications") {
74 input "sendPushMessage", "enum", title: "Send a push notification?", metadata: [values: ["Yes", "No"]], required: false
75 input "phoneNumber", "phone", title: "Send a text message?", required: false
85 subscribe(app, appTouch)
95 subscribe(app, appTouch)
106 def scale = getTemperatureScale()
107 def heatTemp, coolTemp
109 heatTemp = givenHeatTemp ?: 21 // by default, 21°C is the heat temp
110 coolTemp = givenCoolTemp ?: 23 // by default, 23°C is the cool temp
112 heatTemp = givenHeatTemp ?: 72 // by default, 72°F is the heat temp
113 coolTemp = givenCoolTemp ?: 75 // by default, 75°F is the cool temp
116 def isOptimized = (isOptimizedFlag != null) ? isOptimizedFlag : false // by default, isOptimized flag is false
117 def isOccupied = (isOccupiedFlag != null) ? isOccupiedFlag : false // by default, isOccupied flag is false
118 def coolFanMode = givenCoolFanMode ?: 'auto' // By default, fanMode is auto
119 def heatFanMode = givenHeatFanMode ?: 'auto' // By default, fanMode is auto
120 def deleteClimateFlag = (deleteClimate != null) ? deleteClimate : 'false'
122 log.debug "ecobeeManageClimate> about to take actions"
125 log.trace "ecobeeManageClimate>climateName =${climateName},deleteClimateFlag =${deleteClimateFlag},subClimateName= ${subClimateName}, isOptimized=${isOptimized}" +
126 ",isOccupied=${isOccupied},coolTemp = ${coolTemp},heatTemp = ${heatTemp},coolFanMode= ${coolFanMode}, heatFanMode= ${heatFanMode}"
128 if (deleteClimateFlag == 'true') {
129 send("ecobeeManageClimate>about to delete climateName = ${climateName}")
130 ecobee.deleteClimate("", climateName, subClimateName)
134 send("ecobeeManageClimate>about to create or update climateName = ${climateName}")
135 ecobee.updateClimate("", climateName, deleteClimateFlag, subClimateName,
136 coolTemp, heatTemp, isOptimized, isOccupied, coolFanMode, heatFanMode)
142 if (sendPushMessage != "No") {
143 log.debug("sending push message")
148 log.debug("sending text message")