New design interface for smartthings (diy gui) all platforms

I just published a couple updates to the designer software to help address this issue with the Device drop down not populating. To install this update please open & close the designer & then reopen it. When it reopens it should find the update & begin installing it. Here are the 2 changes introduced in this update:

  1. The initial dialog that is used to configure your connection will no longer let you proceed if it doesn’t find any devices. After you click OK on that dialog it will make a call to the “GetCurrentValuesWithDisplayName” function in the web service. If that request returns an empty list you will see the message “Failed to retrieve any devices…”. If you see this message please click that search button to run the authorization process again. The assumption is that there is some device type that the SmartApp web service doesn’t like which is causing that method to fail. If you can determine what type that is please let me know so this issue can be fixed.

  2. If you were able to add your device without it showing you the message “Failed to retrieve any devices…”, you should be good to go. However, if your Device drop down still isn’t populated please click the “View JSON response from hub button”. This will show you the exact response string that was returned from the web service. It’s possible that dialog is having a problem parsing the response into a device list. When this happens please email me that response so I can see exactly what it is that the dialog does not like.

I am able to see all my ST devices and build a UI with the limited devices I have installed. Everything works well in the simulator. However, I am IOS, and I don’t see anyway to publish the UI to any of my IOS mobile devices. I am guessing that they would have to be jail broken in order to do this?

To publish all you have to do is open the “.hrp” project file on your iOS mobile device. I usually just email the file to myself & then open the email within the Gmail app on my iPad. Click the file & then click that button in the top right with the up arrow (see below). Then click “Open in Home Remote”. This process should be similar for most email clients & file browser apps. I have been told it doesn’t work with Google Drive though so there may be some applications that won’t show the “Open in Home Remote” option.

Thanks Bill, that did the trick.

Now I will have to spend some time putting this all together. One thing that would be nice, would be to have more HA icons available in app to setup for different devices. OnImage and OffImage. My photoshop skills are really lacking.

Take a look at https://thenounproject.com/

A majority of the icons in the example projects came from there. They have a lot of really good icons to choose from.

1 Like

Bill,

i solved my issue although not sure how. When I stated to use the designer and SmartApps I loaded all devices. Once I removed them and added them back in smaller groups the issue is not present. I do see a new issue with “Three Axis Sensors” giving an error. I will upgrade the builder as suggested above and see if the issue still exists.

On another topic, Within the builder wouldn’t it be possible to query IDE for devices and capabilities and auto populate the variables?

regards,
Ron

The designer has been updated so that when you add a new SmartThings Hub to the project it will automatically create your variables. You can also do this on demand by right-clicking the hub & clicking the “Auto-Generate Variables” menu item. This was added in version 1.2.5.2. To get this update open, close, & reopen the designer program.

1 Like

Outstanding addition. I’ll be sure to take care of this tomorrow.

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.

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”
}

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

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!

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).

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.

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”
}

1 Like

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.

2 Likes

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.

2 Likes

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!)

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!!

2 Likes