Help porting over AskHome

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;

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.

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 :slight_smile:

//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.  "
   	 	}
}