Skip to content

Commit

Permalink
Merge pull request SmartThingsCommunity#3267 from SmartThingsCommunit…
Browse files Browse the repository at this point in the history
…y/staging

Rolling down staging to master
  • Loading branch information
workingmonk authored Jul 17, 2018
2 parents 33f6240 + c2bcf3b commit ed8dfcb
Show file tree
Hide file tree
Showing 34 changed files with 216 additions and 41 deletions.
64 changes: 24 additions & 40 deletions smartapps/curb/curb-energy-monitor.src/curb-energy-monitor.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ definition(
) {
appSetting "clientId"
appSetting "clientSecret"
appSetting "serverUrl"
}

preferences {
Expand All @@ -47,6 +48,20 @@ mappings {
}
}

def getCurbAuthUrl() { return "https://energycurb.auth0.com" }

def getCurbLoginUrl() { return "${curbAuthUrl}/authorize" }

def getCurbTokenUrl() { return "${curbAuthUrl}/oauth/token" }

def getServerUrl() { return appSettings.serverUrl ?: apiServerUrl }

def getCallbackUrl() { return "${serverUrl}/oauth/callback" }

def getBuildRedirectUrl() {
return "${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${state.accessToken}&apiServerUrl=${serverUrl}"
}

def installed() {
log.debug "Installed with settings: ${settings}"
}
Expand Down Expand Up @@ -137,24 +152,19 @@ def callback() {
client_secret: appSettings.clientSecret,
redirect_uri: callbackUrl
]
httpPostJson([uri: curbTokenUrl, body: tokenParams]) {
resp ->

state.refreshToken = resp.data.refresh_token
state.authToken = resp.data.access_token
}
if (state.authToken) {
success()
} else {
fail()
}
asynchttp_v1.post(handleTokenResponse, [uri: curbTokenUrl, body: tokenParams])
success()
} else {

log.error "callback() failed oauthState != state.oauthInitState"

}
}

def handleTokenResponse(resp, data){
state.refreshToken = resp.json.refresh_token
state.authToken = resp.json.access_token
}

private removeChildDevices(delete) {
delete.each {
deleteChildDevice(it.deviceNetworkId)
Expand Down Expand Up @@ -192,7 +202,7 @@ def getCurbLocations() {
resp ->
resp.data.each {
log.debug "Found location: ${it}"
allLocations[it.id] = it.name
allLocations[it.id] = it.label
}
state.locations = allLocations
}
Expand Down Expand Up @@ -264,7 +274,7 @@ def processData(resp, data, create=false, energy=false)
all += numValue
if (!it.main && !it.production && it.label != null && it.label != "") {
if (create) { createChildDevice("${it.id}", "${it.label}") }
energy ? getChildDevice("${it.id}")?.handleKwhBilling(numValue) : updateChildDevice("${it.id}", numValue)
energy ? getChildDevice("${it.id}")?.handleKwhBilling(numValue.floatValue()) : updateChildDevice("${it.id}", numValue)
}
if (it.grid) {
hasMains = true
Expand Down Expand Up @@ -418,29 +428,3 @@ def connectionStatus(message, redirectUrl = null) {
def isOK(response) {
response.status in [200, 201]
}

def getCurbAuthUrl() {
return "https://energycurb.auth0.com"
}
def getCurbLoginUrl() {
return "${curbAuthUrl}/authorize"
}
def getCurbTokenUrl() {
return "${curbAuthUrl}/oauth/token"
}
def getServerUrl() {
return "https://graph.api.smartthings.com"
}
def getShardUrl() {
return getApiServerUrl()
}
def getCallbackUrl() {
return "https://graph.api.smartthings.com/oauth/callback"
}
def getBuildRedirectUrl() {

return "${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${state.accessToken}&apiServerUrl=${shardUrl}"
}
def getApiEndpoint() {
return "https://api.energycurb.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''={{deviceName}} متصل بـ SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=تم قطع اتصال {{deviceName}} بـ SmartThings، لأن بيانات اعتماد الوصول قد تغيرت أو فُقدت. يُرجى الانتقال إلى التطبيق الذكي Ecobee (Connect)‎ وإعادة إدخال بيانات اعتماد تسجيل الدخول إلى حسابك.
'''Your Ecobee thermostat '''=ثرموستات Ecobee
'''Select your ecobee devices'''=تحديد أجهزة ecobee لديك
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=انقر أدناه لإضافة أجهزة الثرموستات المتوفرة في حساب ecobee لديك أو إزالتها. سيتم توصيل أجهزة الثرموستات المحددة بـ SmartThings.
'''Log In'''=تسجيل الدخول
'''Tap Next to continue to set up your ecobee thermostats.'''=انقر فوق ”التالي“ لمتابعة إعداد أجهزة الثرموستات ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=انقر أدناه لإضافة المستشعرات عن بُعد المتوفرة في حساب ecobee لديك أو إزالتها منه. سيتم توصيل المستشعرات المحددة بـ SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=انقر أدناه لإضافة مفاتيح التبديل المتوفرة في حساب ecobee لديك أو إزالتها. سيتم توصيل مفاتيح التبديل المحددة بـ SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=е свързан към SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=е прекъснат от SmartThings, тъй като идентификационните данни за достъп са променени или изгубени. Отидете в Ecobee (Connect) SmartApp и въведете отново идентификационните си данни за влизане в акаунта.
'''Your Ecobee thermostat '''=Вашият термостат Ecobee
'''Select your ecobee devices'''=Избор на ecobee устройства
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Докоснете по-долу, за да добавите или премахнете термостатите, налични във вашия ecobee акаунт. Избраните термостати ще се свържат със SmartThings.
'''Log In'''=Влизане
'''Tap Next to continue to set up your ecobee thermostats.'''=Докоснете Next (Напред), за да продължите с настройването на термостатите ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Докоснете по-долу, за да премахнете отдалечените сензори, налични във вашия ecobee акаунт. Избраните сензори ще се свържат със SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Докоснете по-долу, за да добавите или премахнете превключвателите, налични във вашия ecobee акаунт. Избраните превключватели ще се свържат със SmartThings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'''Select your ecobee devices'''=Selecciona os teus dispositivos de ecobee
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Toca a continuación para engadir ou eliminar termóstatos dispoñibles na túa conta de ecobee. Os termóstatos seleccionados conectaranse a SmartThings.
'''Log In'''=Iniciar sesión
'''Tap Next to continue to set up your ecobee thermostats.'''=Toca Seguinte para continuar coa configuración dos teus termóstatos de ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Toca a continuación para engadir ou eliminar sensores remotos dispoñibles na túa conta de ecobee. Os sensores seleccionados conectaranse a SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Toca a continuación para engadir ou eliminar interruptores dispoñibles na túa conta de ecobee. Os interruptores seleccionados conectaranse a SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=je připojen ke SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=byl odpojen od systému SmartThings, protože přístupové přihlašovací údaje byly změněny nebo ztraceny. Přejděte do Ecobee (Connect) SmartApp a znovu zadejte své přihlašovací údaje k účtu.
'''Your Ecobee thermostat '''=Termostat Ecobee
'''Select your ecobee devices'''=Vyberte zařízení ecobee
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Klepnutím na následující tlačítko přidáte nebo odeberete termostaty dostupné na účtu ecobee. Vybrané termostaty budou připojeny k aplikaci SmartThings.
'''Log In'''=Přihlásit
'''Tap Next to continue to set up your ecobee thermostats.'''=Klepněte na tlačítko Next (Další) a pokračujte nastavením termostatů ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Klepnutím na následující tlačítko přidáte nebo odeberete vzdálené termostaty dostupné na účtu ecobee. Vybrané senzory budou připojeny k aplikaci SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Klepnutím na následující tlačítko přidáte nebo odeberete spínače dostupné na účtu ecobee. Vybrané spínače budou připojeny k aplikaci SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=er forbundet med SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=er koblet fra SmartThings, fordi adgangslegitimationsoplysningerne er ændret eller gået tabt. Gå til Ecobee (Connect (Forbind)) SmartApp, og indtast dine kontologinoplysninger igen.
'''Your Ecobee thermostat '''=Din Ecobee-termostat
'''Select your ecobee devices'''=Vælg dine ecobee-enheder
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Tryk herunder for at tilføje eller fjerne termostater, der er tilgængelige på din ecobee-konto. De valgte termostater bliver forbundet til SmartThings.
'''Log In'''=Log ind
'''Tap Next to continue to set up your ecobee thermostats.'''=Tryk på Næste for at fortsætte med at konfigurere dine ecobee-termostater.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Tryk herunder for at tilføje eller fjerne eksterne sensorer, der er tilgængelige på din ecobee-konto. De valgte sensorer bliver forbundet til SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Tryk herunder for at tilføje eller fjerne kontakter, der er tilgængelige på din ecobee-konto. De valgte kontakter bliver forbundet til SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=ist mit SmartThings verbunden
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=ist von SmartThings getrennt, da die Zugangsdaten für den Zugriff geändert wurden oder verloren gingen. Wechseln Sie zur ecobee (Connect)-SmartApp und geben Sie Ihre Kontozugangsdaten erneut ein.
'''Your Ecobee thermostat '''=Ihr ecobee-Thermostat
'''Select your ecobee devices'''=Wählen Sie Ihre ecobee-Geräte aus
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Tippen Sie unten, um Thermostate hinzuzufügen oder zu entfernen, die in Ihrem ecobee-Konto verfügbar sind. Ausgewählte Thermostate werden mit SmartThings verbunden.
'''Log In'''=Anmelden
'''Tap Next to continue to set up your ecobee thermostats.'''=Tippen Sie auf „Next“ (Weiter), um die Einrichtung Ihrer ecobee-Thermostate fortzusetzen.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Tippen Sie unten, um Remote-Sensoren hinzuzufügen oder zu entfernen, die in Ihrem ecobee-Konto verfügbar sind. Ausgewählte Sensoren werden mit SmartThings verbunden.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Tippen Sie unten, um Schalter hinzuzufügen oder zu entfernen, die in Ihrem ecobee-Konto verfügbar sind. Ausgewählte Schalter werden mit SmartThings verbunden.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=συνδέθηκε στο SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=αποσυνδέθηκε από το SmartThings, επειδή τα διαπιστευτήρια πρόσβασης άλλαξαν ή έχουν χαθεί. Μεταβείτε στην εφαρμογή Ecobee (Connect) SmartApp και καταχωρήστε ξανά τα διαπιστευτήρια σύνδεσης για το λογαριασμό σας.
'''Your Ecobee thermostat '''=Θερμοστάτης Ecobee
'''Select your ecobee devices'''=Επιλέξτε τις συσκευές σας ecobee
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Πατήστε παρακάτω για να προσθέσετε ή να καταργήσετε τους θερμοστάτες που είναι διαθέσιμοι στο λογαριασμό σας ecobee. Οι επιλεγμένοι θερμοστάτες θα συνδεθούν στο SmartThings.
'''Log In'''=Σύνδεση
'''Tap Next to continue to set up your ecobee thermostats.'''=Πατήστε «Επόμενο» για να συνεχίσετε τη ρύθμιση των θερμοστατών ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Πατήστε παρακάτω για να προσθέσετε ή να καταργήσετε τους απομακρυσμένους αισθητήρες που είναι διαθέσιμοι στο λογαριασμό σας ecobee. Οι επιλεγμένοι αισθητήρες θα συνδεθούν στο SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Πατήστε παρακάτω για να προσθέσετε ή να καταργήσετε τους διακόπτες που είναι διαθέσιμοι στο λογαριασμό σας ecobee. Οι επιλεγμένοι διακόπτες θα συνδεθούν στο SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=está conectado a SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=está desconectado de SmartThings porque se han cambiado o perdido las credenciales de acceso. Vaya a la aplicación inteligente de Ecobee (Conectar) y vuelva a introducir las credenciales de inicio de sesión de su cuenta.
'''Your Ecobee thermostat '''=Su termostato Ecobee
'''Select your ecobee devices'''=Selecciona tus dispositivos ecobee
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Pulsa a continuación para añadir o eliminar los termostatos disponibles en tu cuenta de ecobee. Los termostatos seleccionados se conectarán a SmartThings.
'''Log In'''=Iniciar sesión
'''Tap Next to continue to set up your ecobee thermostats.'''=Pulsa Siguiente para continuar con la configuración de tus termostatos ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Pulsa a continuación para añadir o eliminar los sensores remotos disponibles en tu cuenta de ecobee. Los sensores seleccionados se conectarán a SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Pulsa a continuación para añadir o eliminar los interruptores disponibles en tu cuenta de ecobee. Los interruptores seleccionados se conectarán a SmartThings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'''Select your ecobee devices'''=Seleccione sus dispositivos ecobee
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Pulse a continuación para añadir o eliminar los termostatos disponibles en su cuenta de ecobee. Los dispositivos seleccionados se conectarán a SmartThings.
'''Log In'''=Iniciar sesión
'''Tap Next to continue to set up your ecobee thermostats.'''=Pulse Siguiente para continuar con la configuración de los termostatos ecobee.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Pulse a continuación para añadir o eliminar los sensores remotos disponibles en su cuenta de ecobee. Los sensores seleccionados se conectarán a SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Pulse a continuación para añadir o eliminar los interruptores disponibles en su cuenta de ecobee. Los interruptores seleccionados se conectarán a SmartThings.
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@
'''is connected to SmartThings'''=on ühendatud teenusega SmartThings
'''is disconnected from SmartThings, because the access credential changed or was lost. Please go to the Ecobee (Connect) SmartApp and re-enter your account login credentials.'''=on teenusest SmartThings lahti ühendatud, kuna juurdepääsu volitus muutus või kadus. Avage rakendus Ecobee (Connect) SmartApp ja sisestage uuesti oma konto sisselogimisandmed.
'''Your Ecobee thermostat '''=Teie Ecobee termostaat
'''Select your ecobee devices'''=Valige oma ecobee seadmed
'''Tap below to add or remove thermostats available in your ecobee account. Selected thermostats will connect to SmartThings.'''=Toksake allpool, et lisada või eemaldada ecobee konto all olevaid termostaate. Valitud termostaadid ühendatakse teenusega SmartThings.
'''Log In'''=Sisselogimine
'''Tap Next to continue to set up your ecobee thermostats.'''=Toksake käsku Edasi, et jätkata oma ecobee termostaatide seadistamist.
'''Tap below to add or remove remote sensors available in your ecobee account. Selected sensors will connect to SmartThings.'''=Toksake allpool, et lisada või eemaldada ecobee konto all olevaid kaugandureid. Valitud andurid ühendatakse teenusega SmartThings.
'''Tap below to add or remove switches available in your ecobee account. Selected switches will connect to SmartThings.'''=Toksake allpool, et lisada või eemaldada ecobee konto all olevaid lüliteid. Valitud lülitid ühendatakse teenusega SmartThings.
Loading

0 comments on commit ed8dfcb

Please sign in to comment.