mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-28 13:23:07 +00:00
DVCSMP-535
- Fix activity feed displays unformatted text - update oauth/callback url, use getApiServerUrl() for proxying to corresponding shard
This commit is contained in:
@@ -139,36 +139,23 @@ def generateEvent(Map results) {
|
|||||||
def linkText = getLinkText(device)
|
def linkText = getLinkText(device)
|
||||||
def isChange = false
|
def isChange = false
|
||||||
def isDisplayed = true
|
def isDisplayed = true
|
||||||
|
def event = [name: name, linkText: linkText, descriptionText: getThermostatDescriptionText(name, value, linkText),
|
||||||
|
handlerName: name]
|
||||||
|
|
||||||
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
|
if (name=="temperature" || name=="heatingSetpoint" || name=="coolingSetpoint") {
|
||||||
def sendValue = value? convertTemperatureIfNeeded(value.toDouble(), "F", 1): value //API return temperature value in F
|
def sendValue = value? convertTemperatureIfNeeded(value.toDouble(), "F", 1): value //API return temperature value in F
|
||||||
isChange = isTemperatureStateChange(device, name, value.toString())
|
isChange = isTemperatureStateChange(device, name, value.toString())
|
||||||
isDisplayed = isChange
|
isDisplayed = isChange
|
||||||
|
event << [value: sendValue, isStateChange: isChange, displayed: isDisplayed]
|
||||||
sendEvent(
|
} else if (name=="heatMode" || name=="coolMode" || name=="autoMode" || name=="auxHeatMode"){
|
||||||
name: name,
|
isChange = isStateChange(device, name, value.toString())
|
||||||
value: sendValue,
|
event << [value: value.toString(), isStateChange: isChange, displayed: false]
|
||||||
unit: location.temperatureScale,
|
} else {
|
||||||
linkText: linkText,
|
|
||||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
|
||||||
handlerName: name,
|
|
||||||
isStateChange: isChange,
|
|
||||||
displayed: isDisplayed)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
isChange = isStateChange(device, name, value.toString())
|
isChange = isStateChange(device, name, value.toString())
|
||||||
isDisplayed = isChange
|
isDisplayed = isChange
|
||||||
|
event << [value: value.toString(), isStateChange: isChange, displayed: isDisplayed]
|
||||||
sendEvent(
|
|
||||||
name: name,
|
|
||||||
value: value.toString(),
|
|
||||||
linkText: linkText,
|
|
||||||
descriptionText: getThermostatDescriptionText(name, value, linkText),
|
|
||||||
handlerName: name,
|
|
||||||
isStateChange: isChange,
|
|
||||||
displayed: isDisplayed)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
sendEvent(event)
|
||||||
}
|
}
|
||||||
generateSetpointEvent ()
|
generateSetpointEvent ()
|
||||||
generateStatusEvent ()
|
generateStatusEvent ()
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ def oauthInitUrl() {
|
|||||||
redirect_uri: callbackUrl //"https://graph.api.smartthings.com/oauth/callback"
|
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() {
|
def callback() {
|
||||||
@@ -739,11 +739,12 @@ def sendJson(child = null, String jsonBody) {
|
|||||||
|
|
||||||
def getChildName() { "Ecobee Thermostat" }
|
def getChildName() { "Ecobee Thermostat" }
|
||||||
def getSensorChildName() { "Ecobee Sensor" }
|
def getSensorChildName() { "Ecobee Sensor" }
|
||||||
def getServerUrl() { getApiServerUrl() }
|
def getServerUrl() { return "https://graph.api.smartthings.com" }
|
||||||
def getSmartThingsClientId() { appSettings.clientId }
|
def getShardUrl() { return getApiServerUrl() }
|
||||||
def getCallbackUrl() { "https://graph.api.smartthings.com/oauth/callback" }
|
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 getApiEndpoint() { "https://api.ecobee.com" }
|
||||||
|
def getSmartThingsClientId() { appSettings.clientId }
|
||||||
|
|
||||||
def debugEvent(message, displayEvent = false) {
|
def debugEvent(message, displayEvent = false) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user