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: "ecobeeManageGroup",
23 author: "Yves Racine",
24 description: "Allows a user to create,update, and delete an ecobee group",
26 iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee.png",
27 iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee@2x.png"
32 paragraph "ecobeeManageGroup, the smartapp that manages your ecobee groups ['creation', 'update', 'delete']"
33 paragraph "Version 1.9.4"
34 paragraph "If you like this smartapp, please support the developer via PayPal and click on the Paypal link below "
35 href url: "https://www.paypal.me/ecomatiqhomes",
36 title:"Paypal donation..."
37 paragraph "Copyright©2014 Yves Racine"
38 href url:"http://github.com/yracine/device-type.myecobee", style:"embedded", required:false, title:"More information..."
39 description: "http://github.com/yracine/device-type.myecobee/blob/master/README.md"
41 section("For this ecobee thermostat") {
42 input "ecobee", "device.myEcobeeDevice", title: "Ecobee Thermostat"
44 section("Create this group or update all groups [empty for all group]") {
45 input "groupName", "text", title: "Group Name", required: false
47 section("Or delete the group [default=false]") {
48 input "deleteGroup", "Boolean", title: "delete?", metadata: [values: ["true", "false"]], required: false
50 section("Synchronize Vacation") {
51 input "synchronizeVacation", "Boolean", title: "synchronize Vacation [default=false]?", metadata: [values: ["true", "false"]], required: false
53 section("Synchronize Schedule") {
54 input "synchronizeSchedule", "Boolean", title: "synchronize Schedule [default=false]?", metadata: [values: ["true", "false"]], required: false
56 section("Synchronize SystemMode") {
57 input "synchronizeSystemMode", "Boolean", title: "synchronize SystemMode [default=false]?", metadata: [values: ["true", "false"]], required: false
59 section("Synchronize Alerts") {
60 input "synchronizeAlerts", "Boolean", title: "synchronize Alerts [default=false]?", metadata: [values: ["true", "false"]], required: false
62 section("Synchronize QuickSave") {
63 input "synchronizeQuickSave", "Boolean", title: "synchronize QuickSave [default=false]?", metadata: [values: ["true", "false"]], required: false
65 section("Synchronize User Preferences") {
66 input "synchronizeUserPreferences", "Boolean", title: "synchronize User Preferences [default=false]?", metadata: [values: ["true", "false"]], required: false
69 section("Notifications") {
70 input "sendPushMessage", "enum", title: "Send a push notification?", metadata: [values: ["Yes", "No"]], required: false
71 input "phoneNumber", "phone", title: "Send a text message?", required: false
84 subscribe(app, appTouch)
94 subscribe(app, appTouch)
106 // by default, all flags are set to false
108 log.debug "EcobeeManageGroup> about to take actions"
109 def syncVacationFlag = (synchronizeVacation != null) ? synchronizeVacation : 'false'
110 def syncScheduleFlag = (synchronizeSchedule != null) ? synchronizeSchedule : 'false'
111 def syncSystemModeFlag = (synchronizeSystemMode != null) ? synchronizeSystemMode : 'false'
112 def syncAlertsFlag = (synchronizeAlerts != null) ? synchronizeAlerts : 'false'
113 def syncQuickSaveFlag = (synchronizeQuickSave != null) ? synchronizeQuickSave : 'false'
114 def syncUserPreferencesFlag = (synchronizeUserPreferences != null) ? synchronizeUserPreferences : 'false'
115 def deleteGroupFlag = (deleteGroup != null) ? deleteGroup : 'false'
117 def groupSettings = [synchronizeVacation: "${syncVacationFlag}", synchronizeSchedule: "${syncScheduleFlag}",
118 synchronizeSystemMode: "${syncSystemModeFlag}", synchronizeAlerts: "${syncAlertsFlag}",
119 synchronizeQuickSave: "${syncQuickSaveFlag}", synchronizeUserPreferences: "${syncUserPreferencesFlag}"
122 log.trace "ecobeeManageGroup>deleteGroupFlag=${deleteGroupFlag}, groupName = ${groupName}, groupSettings= ${groupSettings}"
124 if (deleteGroupFlag == 'true') {
125 ecobee.deleteGroup(null, groupName)
126 send("ecobeeManageGroup>groupName=${groupName} deleted")
128 } else if ((groupName != "") && (groupName != null)) {
130 ecobee.createGroup(groupName, null, groupSettings)
131 send("ecobeeManageGroup>groupName=${groupName} created")
133 ecobee.iterateUpdateGroup(null, groupSettings)
134 send("ecobeeManageGroup>all groups associated with thermostat updated with ${groupSettings}")
140 if (sendPushMessage != "No") {
141 log.debug("sending push message")
146 log.debug("sending text message")