AskHome - Alexa/SmartThings programmers kit. Alexa can do anything

Well it nothing is crashing :slight_smile: Thatā€™s good. Look in the lower right log output box, thereā€™s an https linkā€¦open that in a web browser and tell me what you get in response.

{ā€œerrorā€:true,ā€œtypeā€:ā€œAccessDeniedā€,ā€œmessageā€:ā€œThis request is not authorized by the specified access tokenā€}

1 Like

So the token is broken. :wink: Time to double check. Are you using both the device id from the Endpoint url in the simulator and the token from the simulator? Do you have the id & token in the right variables in the lambda code, or flip flopped?

i am using those two tokens. Iā€™ll check if they are reversed

1 Like

iā€™m using the right tokensā€¦ as far as i can tell

this is what comes up on the https website now.

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<error_description>d9edca94-011f-4af2-ae67-e91edcc335a0</error_description>
invalid_token

1 Like

can you send that https link to me privately?

Keith, trying to break down the code so I can see if I am able to implement this as it looks great! My question is you have a device called ā€œallbatā€, is that an actual device? a custom device type? Is that needed for the capability response Battery All?

1 Like

Hi Chris,

Those are just handle variables that get attached to the devices you pick from a list in the inputs. I named that one allbat and put the appropriate text prompt in ā€¦so it reminded me to select all batteries for that input during the app configuration, not just one. Later in the switch case section, I use allbat as the handle that holds all the batteries selected and I call a routine that looks through all the batteries and checks to see if any of them are low, and then reports the results.

ā€“Keith

You got the right codes, just flip flop the token and appID.

Thanks Keith, just so I understand here for example:

input ā€œbasmokā€ basement smoke detector
input ā€œbabatā€ basement smoke detector battery

basmok is the actual device name in Smartthings, babat is a handle created for the battery capability of the actual device.
So for something like fdlockcon, you did not include the battery capability for the sensor so it will not be included in batteries all?

1 Like

Any work around to get the token/app ID? I cannot get the sim to run in the SmartThings IDE. Just sits and spins.

1 Like

Hey Chris,

They are totally independent (except for the fact the hardware is in the same box)

basmok is the handle for the capability.smokeDetector of the smoke detector detecting smoke
babat is the handle for the capability.battery of the smoke detector giving battery status
same device, but two different handles, one for each feature.

every input is going to be a handle that connects a device capability to a way to talk to that option in the device. later you use the handles in the switch/case subrotines to identify which capability of which device we want reported or changed.

Hi Big Jim!

No workarounds for the tokenā€¦thatā€™s where you get it. (UPDATE: the ID and token show up on the device selection screen when you install the smartApp) But use the AskHome-Bare-1-device.groovy codeā€¦it has everything but a light switched cleaned out of itā€¦when you use the simulator you have to fill in the devices, and we donā€™t have the same devices. Just pick a light from the list and install. Let me know if it works.

Thatā€™s what I was using. I canā€™t get the sim to work for any smart app. Even the ones I know work.

1 Like

I donā€™t think I can fix the simulator. :slight_smile: You might have to open a smartthings ticket for that. I have seen on the boards that others have had a problem with the sim very recently. You did turn on OAUTH in the smartapp editorā€™s app settings. You donā€™t use the numbers from there, but it does have to be on for the sim to report a token.

1 Like

Yeah, I did turn on OAuth. Just hate entering support tickets. Here goes nothingā€¦

1 Like

Awesome job Jason getting your first device working! Whoo hoo!

Well, I got two working nowā€¦ Of things Iā€™d I canā€™t get any more than that.

Taking a break for a bit lol

1 Like

Making progress! BUT now I think that I am getting the same issue with the IDE simulator. Keith, I assume I have to set the location and when the simulator populates it will give me the appid info needed for the lambda code. I tried the id info from app settings and got errors.