How to get Ecobee thermostat's runtime report/sensor data within SmartThing


(Yves Racine) #1

Hello,

For those of you who are interested in getting ecobee runtime report data or sensor data within SmartThings, so that you can process them within your own smartapps(s), you can now use My Ecobee device to do so.

Refer to getReportData() function within My ecobee device type at

Basically, within a smartapp, to get report/sensor data and process them programatically,you can do the following:

(…) Your smartapp header and definition

// Get all report runtime data on the ‘auxheat1’ (i.e. furnace) component since a hour ago.

Date now = new Date()
Calendar oneHourAgoCal = new GregorianCalendar()
oneHourAgoCal.add(Calendar.HOUR, -1 )
Date oneHourAgo= oneHourAgoCal.getTime()

// getReportData(thermostatId, startDateTime, endDateTime, startInterval, endInterval, reportColumn, includeSensorData, postData)

ecobee.getReportData("", oneHourAgo, now, null, null, "auxheat1",'true','true')
def reportData = ecobee.currentReportData.toString().split(",,")
def sensorData = ecobee.currentSensorData.toString().split(",,")

// One can loop thru the reportData or sensorData with the following logic

for (i in 0..reportData.size()-1) {
      def rowDetails = reportData[i].split(',')
      def dateReportData = rowDetails[0]
      def timeReportData = rowDetails[1]
      def valueReportData = rowDetails[2]   // process reportData according to your needs....
}      

for (i in 0..sensorData.size()-1) {
     def rowDetails = sensorData[i].split(',')
     def dateSensorData = rowDetails[0]
     def timeSensorData = rowDetails[1]
     def valueSensorData = rowDetails[2] // process sensorData according to your needs....
}    

Please look at the following smartapps as examples:

https://github.com/yracine/device-type.myecobee/blob/master/smartapps/MonitorAndSetHumidityLevel.groovy
https://github.com/yracine/device-type.myecobee/blob/master/smartapps/ecobeeGenerateStats.groovy

For more details, see https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-runtime-report.shtml.

P.S.

You can also call 

generateReportRuntimeEvents(component, startDateTime, endDateTime,
    startInterval,endInterval,typeEvent) 
=> to generate daily or periodic runtime events on your HVAC components such as 
     auxHeat1, auxHeat2, compCool1, fan, humidifier, dehumidifer, ventilator, etc.

OR call 
generateSensorStatsEvents(sensorId, startDateTime, endDateTime, startInterval, endInterval, operation) 
=> to get total, min, max, avg stats on your sensor data.

N.B. For the moment, it is still not possible to get ecobee3’s remote sensor data thru the APIs… To be followed.