DVCSMP-535

- Fix activity feed displays unformatted text
- update oauth/callback url, use getApiServerUrl() for proxying to corresponding shard
This commit is contained in:
Warodom Khamphanchai
2015-10-30 18:37:41 -07:00
parent 1b9d2fe9ce
commit c5da3fe4a0
2 changed files with 14 additions and 26 deletions

View File

@@ -139,36 +139,23 @@ def generateEvent(Map results) {
def linkText = getLinkText(device)
def isChange = false
def isDisplayed = true
def event = [name: name, linkText: linkText, descriptionText: getThermostatDescriptionText(name, value, linkText),
handlerName: name]
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
def sendValue = value? convertTemperatureIfNeeded(value.toDouble(), "F", 1): value //API return temperature value in F
isChange = isTemperatureStateChange(device, name, value.toString())
isDisplayed = isChange
sendEvent(
name: name,
value: sendValue,
unit: location.temperatureScale,
linkText: linkText,
descriptionText: getThermostatDescriptionText(name, value, linkText),
handlerName: name,
isStateChange: isChange,
displayed: isDisplayed)
} else {
event << [value: sendValue, isStateChange: isChange, displayed: isDisplayed]
} else if (name=="heatMode" || name=="coolMode" || name=="autoMode" || name=="auxHeatMode"){
isChange = isStateChange(device, name, value.toString())
event << [value: value.toString(), isStateChange: isChange, displayed: false]
} else {
isChange = isStateChange(device, name, value.toString())
isDisplayed = isChange
sendEvent(
name: name,
value: value.toString(),
linkText: linkText,
descriptionText: getThermostatDescriptionText(name, value, linkText),
handlerName: name,
isStateChange: isChange,
displayed: isDisplayed)
event << [value: value.toString(), isStateChange: isChange, displayed: isDisplayed]
}
sendEvent(event)
}
generateSetpointEvent ()
generateStatusEvent ()

View File

@@ -95,7 +95,7 @@ def oauthInitUrl() {
redirect_uri: callbackUrl //"https://graph.api.smartthings.com/oauth/callback"
]
redirect(location: "https://api.ecobee.com/authorize?${toQueryString(oauthParams)}")
redirect(location: "${apiEndpoint}/authorize?${toQueryString(oauthParams)}")
}
def callback() {
@@ -739,11 +739,12 @@ def sendJson(child = null, String jsonBody) {
def getChildName() { "Ecobee Thermostat" }
def getSensorChildName() { "Ecobee Sensor" }
def getServerUrl() { getApiServerUrl() }
def getSmartThingsClientId() { appSettings.clientId }
def getServerUrl() { return "https://graph.api.smartthings.com" }
def getShardUrl() { return getApiServerUrl() }
def getCallbackUrl() { "https://graph.api.smartthings.com/oauth/callback" }
def getBuildRedirectUrl() { "${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${atomicState.accessToken}" }
def getBuildRedirectUrl() { "${serverUrl}/oauth/initialize?appId=${app.id}&access_token=${atomicState.accessToken}&apiServerUrl=${shardUrl}" }
def getApiEndpoint() { "https://api.ecobee.com" }
def getSmartThingsClientId() { appSettings.clientId }
def debugEvent(message, displayEvent = false) {