Hi guys,
I am trying to port over the AskHome app by Keith over at ST. in this Lamda code, he's pointing the URL to the smartapp. Not sure how we can do this on Hubitat. @chuck.schwer @mike.maxwell any thoughts?
var url = 'https://graph.api.smartthings.com/api/smartapps/installations/ ' + STappID + '/' +
Noun + '/' + Operator + '/'+ Operand + '/' + Inquisitor +'?access_token=' + STtoken;
Keo
August 15, 2018, 1:38am
2
Without knowing much about the app, it sounds like you need to call a cloud endpoint. I found this little explanation in another post that may help.
We actually have 2 oauth endpoints. There is the cloud one. which starts at https://oauth.cloud.hubitat.com/oauth/authorize
We also have a local endpoint you can use which starts at:
http://<HUB IP>/oauth/authorize
They follow the standard oauth2 flow, so you send client_id, response_type, redirect_uri and scope to the first url and go from there. (FYI response_type must be 'code' and scope must be 'app')
I have some example nodejs apps that use the local and cloud endpoints, but it uses t…
Does this help at all? Sorry if it doesn't, I just happen to stumble onto this one.
It would be like this:
var url = 'https://cloud.hubitat.com/api/ ' + HEhubId + '/apps/' + HEappID + '/' +
Noun + '/' + Operator + '/'+ Operand + '/' + Inquisitor +'?access_token=' + HEtoken;
1 Like
Thanks.. I'll give it a go.
Not sure why this is not working on HE. This was working with ST.
//capability.switch report on
def lightResponseOn(handle, noun, op){
if (handle.currentValue("switch").contains("on"))
handle.each {
def arg = it.currentValue("switch")
if (arg) {
if (arg == "on") {
state.talk2me = state.talk2me + "${it} is ${arg}. "
}
}
}
else
state.talk2me = state.talk2me + "All Lights are currently off. "
}
I'm getting the following error
java.lang.IllegalArgumentException: Command 'currentValue' is not supported by device. on line 476 (centralCommand)
handle is a list of light switches
@mike.maxwell any ideas?
We do not currently support currentValue() on a list of devices. That is an interesting use case, what does ST return from that? a String concatenation with all the values? A list?
Here is a piece of code that should achieve the same thing:
def lightResponseOn(handle, noun, op){
def switchOn = false
handle.each {
if (it.currentValue("switch") == "on") {
state.talk2me = state.talk2me + "${it} is on. "
switchOn = true
}
}
if(!switchOn)
state.talk2me = state.talk2me + "All Lights are currently off. "
}
1 Like
workaround for now. Now i can say "Alexa, Ask Home for the light status" and she'll report which light is ON in the house
//capability.switch report on
def lightResponseOn(handle, noun, op)
{
handle.each {
def arg = it.currentValue("switch")
if (arg) {
if (arg == "on") {
state.talk2me = state.talk2me + "${it} is ${arg}. "
}
}
else
state.talk2me = state.talk2me + "All Lights are currently off. "
}
}