SmartThings Community

New design interface for smartthings (diy gui) all platforms

dashboard
project_dashboard

(Dean Smith) #29

I have performed the following:

  • Updated the Home Remote Designer to version x
  • Authorised Home Remote to only access my dimmer bulbs
  • Autogenerated Variables
  • Selected “New” under Variables to be presented with none
  • Clicked “View JSON response” and the reply was []

Not sure what else to try right now.


(Bill) #31

SmartThings support is currently broken. If you have a hub added to your project you should be fine, but if you are starting from scratch you will not be able to add a new hub. The request to get the access token (or API token) is currently failing for me & at least one other user. I sent an email to the SmartThings staff a little bit ago making them aware of the issue however I received an automated response stating that they have a “sizable backlog of request”. So it could be a little while until I receive a response. This may be an issue that only a few users are seeing such as myself however it’s probably unlikely. For anyone familiar with SmartApps here is a link to the specific request that is failing in the designer software.

http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/tutorial-part2.html#get-the-api-token

Here is the JSON response I am getting from the request.
{
“error”: “invalid_request”,
“error_description”: “Remote OAuth2 token request failed with code: 401, text: Unauthorized”
}


(Michael) #32

I am having problems installing the home remote designer on Windows 10. I just sent my error log to the support email.


(Doug ) #33

Getting a error as well. So far this app is exactly what I have been looking for! I love the Cortana integration! I have s Microsoft band so Cortana it’s always right there! One of my phrases are “Lets party” Cortana reply’s. “I agree! Crack open a bud and I will take care of the rest” then after she turns on the music and flashing lights she says “Now drop it like its hot”

LMAO!


(Michael) #34


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #35

Unless this is a different issue, SmartTiles experienced the same problem last Monday/Tuesday and it was fixed 6 days ago (and SmartTiles deployed the US & UK updates on Friday).


(Bill) #36

So it’s been a week & yes, SmartThings support is still broken. I did receive an email from them 2 days ago acknowledging a brief change they made for 3rd party access. This brief change could be causing the access token error. I haven’t been given any information yet regarding what the brief change was & if there is a fix for it. I have sent them a follow up email referring them to this discussion so they know at least 3 other users that would like to see this fixed. At this time I think we need to just be patient with them. If more people are getting this error & would like to use the Home Remote app I encourage you to post in this discussion as well. They could make this a higher priority case if they know there are quite a few people that wish to use the app. Anyway I just wanted to let you guys know that this is still on my radar, & like you, am hoping it will be fixed sometime soon.


(Bill) #37

SmartThings support has been removed from the Home Remote. It will be added back in once SmartThings fixes this issue.

Now I want to show exactly why the Home Remote software is failing to get the access token. There are 2 steps outlined in the SmartThings help documentation that I will go over with you so you can see for yourself. The steps are, 1 - “Get the OAuth Authorization Code”, 2 - “Get the API token”. Now I am assuming that you’ve already created your web service (I think most of you already have). You will need your OAuth Client ID & Secret.

Here’s a link to the SmartThings documentation that describes these steps.

http://docs.smartthings.com/en/latest/smartapp-web-services-developers-guide/tutorial-part2.html#appendix-just-the-urls-please

I will go over them in a little more detail & show you exactly what I did. I myself am a Windows user & I didn’t have curl on my PC. If you are like me, you need to download it.

Here’s a link to the curl downloads.

http://curl.haxx.se/download.html

Direct link for those of you using 64-bit Windows
http://curl.askapache.com/download/curl-7.33.0-win64-ssl-sspi.zip

You will need the SSL version & I am running on a 64 bit machine so I downloaded “curl-7.33.0-win64-ssl-sspi.zip”. I extracted this to “C:\curl-7.33.0-win64-ssl-sspi”.

Here’s what I’m doing. In all of these steps please replace CLIENT_ID, CLIENT_SECRET, & CODE with your values. You will retrieve CODE in step 1. You should already have CLIENT_ID & CLIENT_SECRET.

1 - Open web browser & go to https://graph.api.smartthings.com/oauth/authorize?response_type=code&client_id=CLIENT_ID&scope=app&redirect_uri=https%3A%2F%2Fgraph.api.smartthings.com%2Foauth%2Fcallback

2 - Click authorize which will give you the CODE you need (copy that).

3 - Open the Windows Command Prompt.

4 - Send this command => cd C:\curl-7.33.0-win64-ssl-sspi

5 - Send this command => curl -k -u CLIENT_ID:CLIENT_SECRET “https://graph.api.smartthings.com/oauth/token?code=CODE&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fgraph.api.smartthings.com%2Foauth%2Fcallback&scope=app

(Please note that Windows doesn’t like single quotes. So this request in step 5 will appear slightly different than what SmartThings describes in their documentation. I also added the -k option to ignore certificate errors.)

As you can see this request fails & returns the following JSON which does not include an access token.

{
“error”: “invalid_request”,
“error_description”: “Remote OAuth2 token request failed with code: 401, text: Unauthorized”
}


Https://graph.api.smarthings.com Failed to load devices
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #38

I haven’t tested your code, but I figured I’d do some quick comparisons right “inline” here to see if there is a difference between the procedure SmartTiles has functioning.

In PHP code… NB: this is slightly edited to hide keys and internal variables, but I believe I haven’t made any typos. Let’s see if there’s an difference that’s obvious or if you need to debug further.

switch ($apiregion) {
	case "US":
		$apiurl = "https://graph.api.smartthings.com/";
		
	case "UK":
		$apiurl = "https://graph-eu01-euwest1.api.smartthings.com/";
} /* switch */


$url = "http://path_to_callback_script.php";

//STEP 1 - Get Access Code
if(!isset($_REQUEST['code']) && !isset($_REQUEST['access_token']))
{
	header( "Location: ${apiurl}/oauth/authorize?response_type=code&client_id=$client&scope=app&redirect_uri=".$url );
}

//STEP 2 - Use Access Code to claim Access Token
else if(isset($_REQUEST['code']))
{
	$code = $_REQUEST['code'];
	$page = "${apiurl}/oauth/token?grant_type=authorization_code&client_id=".$client."&client_secret=".$secret."&code=".$code."&scope=app"."&redirect_uri=".$url;

	$ch = curl_init();

	curl_setopt($ch, CURLOPT_URL,            $page );
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
	curl_setopt($ch, CURLOPT_POST,           0 );
	curl_setopt($ch, CURLOPT_HTTPHEADER,     array('Content-Type: application/json')); 

	$response =  json_decode(curl_exec($ch),true);

	curl_close($ch);
        $access_token = $response['access_token']

        ...
}

So the main difference I see…

We put client_id=".$client."&client_secret=".$secret directly in the URI call for the access_token; i.e., we use a GET, not a POST for those two parameters in addition to $code, etc…

It is incorrect (or perhaps just currently faulty), as far as I can tell from just reading but not testing to use the “-u” parameter to curl.

i.e., This change your code to the equivalent of this line:

$page = "${apiurl}/oauth/token?grant_type=authorization_code&client_id=".$client."&client_secret=".$secret."&code=".$code."&scope=app"."&redirect_uri=".$url;

Please let me know if this gets you closer to a solution.


Remote OAuth2 Token request failed with 401
(Bill) #39

Well that fixed it!

Funny how they recommend using Basic Authentication which no longer works & the method that’s been depreciated does. Basic Authentication definitely was working for me before so I’m not sure what they did to break that.

I’ll roll out the Designer changes in a little bit. For anyone that wants this fix they will be in version 1.2.5.11 . To get the update open, close, & then reopen the designer.

This issue has been a bit of a headache for me so thanks again for all your help. And I’m sure there are others that appreciate that as well.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #40

Glad I was able to help; looking forward to seeing the progression of your app!

(I also appreciate anything you can do to help promote SmartTiles.click, as the growth in popularity of our app is the greatest reward for the headaches we have faced due to the challenging quirks of the SmartThings platform!)


(Doug ) #41

Sweet! ill stand by. I went and created IFTT.com receipts to make the app work. but id rather not use IFTTT as a work around. I don’t think I ever emailed you back but it works great with the IFTTT.com (Maker). Now I can add “Milk” with Cortana to my shopping list:)
When can we expect UPnP to be working?

… Well look at that. I just checked and it looks like the new update has been released!!!

… And it works!! Thanks!!


(Bill) #42

Cool! Thanks for the feedback. Glad to hear it works with IFTTT & Maker as well.

UPnP is still in development but it’s very close to being wrapped up. If all goes as planned I will probably begin rolling out the update sometime next week.


(Doug ) #43

Not sure why but the auto generate only shows one item? I have 23 things…


(Bill) #44

Is this only an issue with auto generate?
Does the variable dialog also only show you one device in the drop down?


(Doug ) #45

Not 100% sure what you mean? Here is a picture. The Arrow on the left just is what happen when I did the auto generate.
Just made the same device with a 1


(Bill) #46

Yes, that dialog. Looks like there is only 1 device on there too. What other types of devices do you have?
Can you double click the SmartThings device source, click the search button, then take a screenshot of the authorization screen so I can see what other types of devices you’ve authorized?

As you can see for my hub I’ve only authorized a switch/dimmer.


(Doug ) #47

Seems snagit is having a issue getting the entire page. Here is half…

I just re-added the hub and only selected to lights(Switches) but the same thing happen. I am betting everything is selected.

… Yup. Unselecting everything did not take the “Save”. ill try removing items in the app…

… looks like items selected in the mobile app (Smartthings app) are showing the correct items selected… huummm


(Bill) #48

I think others have experienced this same sort of issue. My recommendation would be to maybe use the SmartThings app to select which devices you want to give access to. And maybe add them in small groups like Ron did. Give access to say all of your batteries, then go back to the Home Remote Designer & open that dialog to see what devices show up. That dialog grabs all available devices when it first opens & there is no way to refresh it. So just close & reopen the dialog during this process. Keep doing that until you get everything you want. There is also some suspicion that there may be a device type that the app doesn’t like. So if you get to the point when you have most of your devices available in the Designer & then they start to disappear, take note of the last device you selected. I know this sounds like kind of a pain but I’m not really sure exactly what is causing this.


(Doug ) #49

Strange. it doesn’t seem to matter what I add. It always pulls in the frontDoor.Acceleration
removing everything still results in this… HUMM…