Skip to content

Commit

Permalink
Merge branch 'StrykerSKS-enhanced-ecobeedevice' into StrykerSKS-Ecobee3
Browse files Browse the repository at this point in the history
  • Loading branch information
StrykerSKS committed Feb 5, 2016
2 parents 167e42d + 23220a5 commit b4a960a
Show file tree
Hide file tree
Showing 9 changed files with 1,319 additions and 761 deletions.
11 changes: 6 additions & 5 deletions devicetypes/smartthings/ecobee-sensor.src/ecobee-sensor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
* 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.
*
* Current Version: 0.8.0-RC
* Release Date: 2016-01-26
* See separate Changelog for change history
* See Changelog for change history
*
* Current Version: 0.7.5
* Release Date: 20160125
* See separate Changelog for change history
*/


def getVersionNum() { return "0.9.0" }
private def getVersionLabel() { return "Ecobee Sensor Version 0.9.0-RC2" }

metadata {
definition (name: "Ecobee Sensor", namespace: "smartthings", author: "SmartThings") {
capability "Sensor"
Expand Down Expand Up @@ -178,4 +179,4 @@ private def debugEvent(message, displayEvent = false) {
]
if ( debugLevel(4) ) { log.debug "Generating AppDebug Event: ${results}" }
sendEvent (results)
}
}
459 changes: 185 additions & 274 deletions devicetypes/smartthings/ecobee-thermostat.src/ecobee-thermostat.groovy

Large diffs are not rendered by default.

Binary file added smartapp-icons/ecobee/ecobee_cool_square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added smartapp-icons/ecobee/ecobee_heat_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added smartapp-icons/ecobee/ecobee_heat_square.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added smartapp-icons/ecobee/ecobee_motion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added smartapp-icons/ecobee/ecobee_nomotion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,449 changes: 967 additions & 482 deletions smartapps/smartthings/ecobee-connect.src/ecobee-connect.groovy

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions smartapps/smartthings/ecobee-routines.src/ecobee-routines.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/**
* ecobee Routines
*
* Copyright 2015 Sean Kendall Schneyer
*
*
* 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.
*
*/
def getVersionNum() { return "0.1.0" }
private def getVersionLabel() { return "ecobee Routines Version ${getVersionNum()}-RC5" }



definition(
name: "ecobee Routines",
namespace: "smartthings",
author: "Sean Kendall Schneyer (smartthings at linuxbox dot org)",
description: "Support for changing ecobee Programs based on SmartThings Mode changes",
category: "Convenience",
parent: "smartthings:Ecobee (Connect)",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Partner/ecobee.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Partner/[email protected]",
singleInstance: false
)

preferences {
page(name: "mainPage")
}

// Preferences Pages
def mainPage() {
dynamicPage(name: "mainPage", title: "Setup Routines", uninstall: true, install: true) {
section(title: "Name for Routine Handler") {
label title: "Name this Routine Handler", required: true

}

section(title: "Select Conditions") {
if(settings.tempDisable == true) paragraph "WARNING: Temporarily Disabled as requested. Turn back on to activate handler."
input ("myThermostats", "capability.Thermostat", title: "Pick Ecobee Thermostat(s)", required: true, multiple: true, submitOnChange: true)

if (myThermostats?.size() > 0) {
// Start defining which Routine(s) to allow the SmartApp to execute in
mode(title: "Select mode(s) to use: ", required: true)
input(name: "whichProgram", title: "Select Program to use: ", type: "enum", required: true, multiple:false, description: "Tap to choose...", metadata:[values:["Away", "Home", "Sleep", "Resume Program"]], submitOnChange: true)
input(name: "fanMode", title: "Select a Fan Mode to use\n(Optional) ", type: "enum", required: false, multiple: false, description: "Tap to choose...", metadata:[values:["On", "Auto", "default"]], submitOnChange: true)
if(settings.whichProgram != "Resume Program") input(name: "holdType", title: "Select the Hold Type to use\n(Optional) ", type: "enum", required: false, multiple: false, description: "Tap to choose...", metadata:[values:["Until I Change", "Until Next Program", "default"]], submitOnChange: true)
input(name: "useSunriseSunset", title: "Also at Sunrise or Sunset?\n(Optional) ", type: "enum", required: false, multiple: true, description: "Tap to choose...", metadata:[values:["Sunrise", "Sunset"]], submitOnChange: true)
}
input(name: "tempDisable", title: "Temporarily Disable Handler? ", type: "bool", required: false, description: false, submitOnChange: true)
}

section (getVersionLabel())
}
}


// Main functions
def installed() {
LOG("installed() entered", 5)
initialize()
}

def updated() {
LOG("updated() entered", 5)
unsubscribe()
initialize()

}

def initialize() {
LOG("initialize() entered")
if(tempDisable == true) {
LOG("Teporarily Disapabled as per request.", 2, null, "warn")
return true
}

subscribe(location, "mode", changeProgramHandler)
// subscribe(app, changeProgramHandler)

if(useSunriseSunset?.size() > 0) {
// Setup subscriptions for sunrise and/or sunset as well
if( useSunriseSunset.contains("Sunrise") ) subscribe(location, "sunrise", changeProgramHandler)
if( useSunriseSunset.contains("Sunset") ) subscribe(location, "sunset", changeProgramHandler)
}

// Normalize settings data
normalizeSettings()
LOG("initialize() exiting")
}

private def normalizeSettings() {
// whichProgram
state.programParam = ""
if (whichProgram != null && whichProgram != "") {
if (whichProgram == "Resume Program") {
state.doResumeProgram = true
} else {
state.programParam = whichProgram.toLowerCase()
}
}

// fanMode
state.fanCommand = ""
if (fanMode != null && fanMode != "") {
if (fanMode == "On") {
state.fanCommand = "fanOn"
} else if (fanMode == "Auto") {
state.fanCommand = "fanAuto"
} else {
state.fanCommand = ""
}
}

// holdType
state.holdTypeParam = null
if (holdType != null && holdType != "") {
if (holdType == "Until I Change") {
state.holdTypeParam = "indefinite"
} else if (holdType == "Until Next Program") {
state.holdTypeParam = "nextTransition"
} else {
state.holdTypeParam = null
}
}
}

def changeProgramHandler(evt) {
LOG("changeProgramHander() entered with evt: ${evt}", 5)

settings.myThermostats.each { stat ->
LOG("In each loop: Working on stat: ${stat}", 4, null, "trace")
// First let's change the Thermostat Program
if(state.doResumeProgram == true) {
LOG("Resuming Program for ${stat}", 4, null, "trace")
stat.resumeProgram()
} else {
LOG("Setting Thermostat Program to programParam: ${state.programParam} and holdType: ${state.holdTypeParam}", 4, null, "trace")
stat.setThermostatProgram(state.programParam, state.holdTypeParam)
}
if (state.fanCommand != "" && state.fanCommand != null) stat."${state.fanCommand}"()
}
return true
}



// Helper Functions
private def LOG(message, level=3, child=null, logType="debug", event=true, displayEvent=true) {
message = "${app.label} ${message}"
parent.LOG(message, level, child, logType, event, displayEvent)
}

0 comments on commit b4a960a

Please sign in to comment.