Core: Unable to install Smartthings Home Assistant App

Created on 6 Aug 2019  Â·  80Comments  Â·  Source: home-assistant/core

Home Assistant release with the issue:

0.96.5

Last working Home Assistant release (if known):

Operating environment (Hass.io/Docker/Windows/etc.):

Hassbian

Component/platform:

SmartThings

Description of problem:

When installing the app via smartthings classic I get a error "Something went wrong"
It seems to have been installed but clicking on it also says Something's wrong... We can't load your screen now.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


Traceback (if applicable):


Additional information:

smartthings

All 80 comments

Hey there @andrewsayre, mind taking a look at this issue as its been labeled with a integration (smartthings) you are listed as a codeowner for? Thanks!

_This is a automatic comment generated by codeowners-mention to help ensure issues and pull requests are seen by the right people._

This error occurs when SmartThings is not able to reach Home Assistant reliably and consistently, most likely caused by your router or reverse proxy configuration. Some of the callbacks are larger or have characteristics that get blocked from reaching HA. If using NGINX, try using the recommended config from the documentation, or sign-up for Home Assistant Cloud (Nabu Casa) which doesn't require you to expose HA to the internet at all.

You can remove the orphaned/broken SmartApp through the new SmartThings mobile app, or by using this removal utility: https://pypi.org/project/hass-smartthings-remove/

New smartthings doesn't have it listed but smartthings classic does. Can't delete it via IDE either.

The pip app wouldn't install on any linux os I have...

pip install hass_smartthings_remove

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting hass_smartthings_remove
Downloading https://files.pythonhosted.org/packages/e3/8f/ec2681793b4c288a1937e5db45891b699cd2f119f02866c3ae43d78f1299/hass_smartthings_remove-1.0.1.tar.gz
Collecting aiohttp==3.5.4 (from hass_smartthings_remove)
Could not find a version that satisfies the requirement aiohttp==3.5.4 (from hass_smartthings_remove) (from versions: 0.1, 0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.0, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.10.0, 0.10.1, 0.10.2, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.14.2, 0.14.3, 0.14.4, 0.15.0, 0.15.1, 0.15.2, 0.15.3, 0.16.0, 0.16.1, 0.16.2, 0.16.3, 0.16.4, 0.16.5, 0.16.6, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.18.0, 0.18.1, 0.18.2, 0.18.3, 0.18.4, 0.19.0, 0.20.0, 0.20.1, 0.20.2, 0.21.0, 0.21.1, 0.21.2, 0.21.4, 0.21.5, 0.21.6, 0.22.0a0, 0.22.0b0, 0.22.0b1, 0.22.0b2, 0.22.0b3, 0.22.0b4, 0.22.0b5, 0.22.0b6, 0.22.0, 0.22.1, 0.22.2, 0.22.3, 0.22.4, 0.22.5, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5, 1.1.6, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 2.0.0rc1, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6.post1, 2.0.7, 2.1.0, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0a4, 2.3.0, 2.3.1, 2.3.2b2)
No matching distribution found for aiohttp==3.5.4 (from hass_smartthings_remove)

The pip app wouldn't install on any linux os I have...

Need to run it under python 3.5+ . You're running in 2.x

Yup just figured that out !

Now since I'm using the cloud does the base_url: have to used ?

Now since I'm using the cloud does the base_url: have to used ?

Nope... the integration won't even read the key if it's detecting a valid cloud subscription. Just make sure HA says your cloud subscription is active and you've removed the ST integration completely before trying to set it up again.

Still won't install

Can you enable debug logging and start over, including restarting HA? You should see in the logs a debug message saying that the integration is using the cloudhook instead of a local webhook.

Edit: To clarify: https://www.home-assistant.io/components/smartthings#debugging

2019-08-06 12:10:19 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Setup endpoint for https://hooks.nabu.casa/REMOVED
2019-08-06 12:10:21 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Created SmartApp 'homeassistant.REMOVED' (REMOVED)
2019-08-06 12:10:21 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Updated App Settings for SmartApp 'homeassistant.REMOVED' (REMOVED)
2019-08-06 12:10:21 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Updated App OAuth for SmartApp 'homeassistant.REMOVED' (REMOVED)

Cool - so is it possible there are 2 "Home Assistant" SmartApps in ST that you're trying to install? I've seen the old/broken one get cached before.

Nope -- all of them I see are gone

When you use the removal utility, make sure you don't still see it as an option to install... which is different than seeing it show up in the Automations tab.

Checked and not there

So now try going through the integration setup... is it still failing?

Yes

What sucks is there is NO live logging in the IDE to see what is going on

What sucks is there is NO live logging in the IDE to see what is going on

Yeah, this doesn't go through that part of ST. Can you post a screenshot of what you see in the ST Mobile app: Automations -> + Add a SmartApp --> My Apps?

Screenshot_20190806-122223
Screenshot_20190806-122505

Hmm... let me see if I can get someone from ST to help. Can you tell me your location ID? (Log in to the ST IDE, click Locations, select Home... tell me the GUID in the URL). It's not confidential.

406e2826-40f8-474c-bf4d-19bfbd2d1cc9

There really should be a easier way to do this. Especially when it comes to debugging. I don't see why a regular smartthings app can't be installed so we can live log it.

There really should be a easier way to do this. Especially when it comes to debugging. I don't see why a regular smartthings app can't be installed so we can live log it.

It's not installing code.... the cloud-based SmartApps are entirely configuration with standard webhook callback payloads. It works for the vast majority of users... you seem to have hit an edge case and we need ST's help to see why it's failing.

@sgrayban With Andrew's patience, I was finally able to reproduce this issue. My initial assessment is that this is an Android Classic app issue but I will flag it for that team and see what they say.

I doubt it's an option but if you have an iOS device, you should be able to workaround the issue in the meantime.

Ya not a option. Those phones are out of my wallet reach.

Not sure if this is related or not but I was attempting to redo my integration today and I'm getting this in the logs
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/webhook/__init__.py", line 77, in async_handle_webhook
response = await webhook"handler"
File "/usr/src/app/homeassistant/components/smartthings/smartapp.py", line 473, in smartapp_webhook
result = await manager.handle_request(data, request.headers)
File "/usr/local/lib/python3.7/site-packages/pysmartapp/smartapp.py", line 174, in handle_request
resp = await req.process(smartapp, headers, validate_signature)
File "/usr/local/lib/python3.7/site-packages/pysmartapp/request.py", line 70, in process
raise SignatureVerificationError
pysmartapp.errors.SignatureVerificationError`

I've downgraded HA all the way back to 0.96 with the same results each time. At this time I'm on 0.97. I do have a neighbor with an iphone if needed to set back up. When attempting to install the app it just goes to a darker screen then the same errors as posted above.

Any news on the fix ?

@TheFuzz4 Do you have a screenshot? When does the screen go dark? Is it when tapping Home Assistant in the Marketplace of the Classic app?

@sgrayban No updates but I do think I have a workaround. I'll need you to attempt to reinstall it first though.

Sounds good to me. Let's give it another go.

@dbradmit ready when you are

@dbradmit it goes dark during the point that I think its attempting to ask for permissions to be granted. It goes dark so quick I don't know if I could get a screenshot

Oh and it happens when I'm attempting to install the app from the marketplace.

@sgrayban Can you try installing it again? It will likely fail but I need you to try so I can grab an app id.

@dbradmit I'm also using postman to remove the rogue apps after the install fails. So I do have the current appid of the current install attempt if you need it.

@dbradmit Ok installing now.

@dbradmit ok installed but fails also.

I sent you both URLs which should allow you to manually install the app.

If the app id changes, you can swap it out. Let me know if that still fails.

I get a Page Not found

Sorry - that was my fault. The appType should be "ENDPOINTAPP":

https://strongman-regional.api.smartthings.com/?appId=&locationId=&appType=ENDPOINTAPP&language=en

ok

Worked ! TY

Is this a issue within the classic app that isnt drawing the app window correctly ?

Andrew was asking the same thing. I'm not sure but it seems limited to the Classic app for Android users.

That's exactly what I'm using. Can I use a link too?

On Fri, Aug 9, 2019, 7:25 PM dbradmit notifications@github.com wrote:

Andrew was asking the same thing. I'm not sure but it seems limited to the
Classic app for Android users.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/home-assistant/issues/25723?email_source=notifications&email_token=AACPSRMLGJRMI2WOEKQGMULQDYKIVA5CNFSM4IJU3ZA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4ADFJA#issuecomment-520106660,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACPSRKGHHIUQIAETIRIVHDQDYKIVANCNFSM4IJU3ZAQ
.

@dbradmit OT but why do we have a classic app and the new app when the new app still isnt mature enough ?

@TheFuzz4 Yes. Sign into a browser at https://account.smartthings.com. Insert your appId and locationId and then go here:

https://strongman-regional.api.smartthings.com/?appId=<appId>&locationId=<locationId>&appType=ENDPOINTAPP&language=en

Thank you @dbradmit giving that a go right now.

ENDPOINTAPP !!!

https://strongman-regional.api.smartthings.com/?appId=&locationId=&appType=ENDPOINTAPP&language=en

I"m getting a 404 with that, is that expected?

Read my post above

oh haha change the endpoint spelling

Dang now I'm getting a popup that says ERROR: Something went wrong. Please try to install the SmartApp again. when I go to the URL with the info.

Nothing is showing up in the logs this go around either in regards to the signature.

Did you install it before you did the url thingy ? You need to make sure its installed even though it fails first.

Yeah I have it installed but still getting a signature failure I just missed it in my tail of the logs but went back through the logs and found it
2019-08-09 20:23:47 ERROR (MainThread) [homeassistant.components.webhook] Error processing webhook 88954c4357f9966a761f97fc4acc8dcd8d16247b35b8c5ce9274d53dddb570b0
Traceback (most recent call last):
File "/usr/src/app/homeassistant/components/webhook/__init__.py", line 77, in async_handle_webhook
response = await webhook"handler"
File "/usr/src/app/homeassistant/components/smartthings/smartapp.py", line 473, in smartapp_webhook
result = await manager.handle_request(data, request.headers)
File "/usr/local/lib/python3.7/site-packages/pysmartapp/smartapp.py", line 174, in handle_request
resp = await req.process(smartapp, headers, validate_signature)
File "/usr/local/lib/python3.7/site-packages/pysmartapp/request.py", line 70, in process
raise SignatureVerificationError
pysmartapp.errors.SignatureVerificationError

signature error... sounds like the app didn't install correctly

@andrewsayre

@TheFuzz4 you’ve got some other issues going on. Remove the integration from HA and use the removal utility to fully clean up the ST side. If you were manually removing through the API, you probably missed the installedapp. You’re getting callbacks that HA can’t validate because they validation key is gone.

ok let me get pip to install the cleanup tool and I'll let it run and I'll report back what it does.

Also if you removed the app, but not the installedapp, the removal utility won’t find it... so you’ll have to manually remove those too via the api.

Ok ran the tool hass_smartthings_remove
Removed installed app 'Home Assistant' (f1095c93-02e9-45ea-a23f-8c1d07349c61)
Removed app 'homeassistant.830f462f-19f4-4a30-b948-6ad43393bff4' (fb326087-7498-4e1e-9a9f-162844ecfe42) so looks like it cleaned up a good bit of things now time to try and start from the beginning lets first see what the api shows
OK API shows clean
{
"items": [],
"_links": {
"next": null,
"previous": null
}
}
Now to install it
Ok installed the app and it failed now to go collect my appid and locationid from the api
{
"items": [
{
"installedAppId": "7d08c4a3-1ed8-4f4c-bd3b-0681ab6b3578",
"installedAppType": "WEBHOOK_SMART_APP",
"installedAppStatus": "PENDING",
"displayName": "Home Assistant",
"appId": "099caf20-4b3b-4cf9-89c6-414daf73c1d0",
"referenceId": null,
"locationId": "LOCATIONID",
"owner": {
"ownerType": "USER",
"ownerId": "dfdc0588-c19f-deef-975a-843513b94517"
},

        "notices": [],
        "createdDate": "2019-08-10T02:36:05Z",
        "lastUpdatedDate": "2019-08-10T02:36:05Z",
        "ui": {
            "pluginId": null,
            "pluginUri": null,
            "dashboardCardsEnabled": false,
            "preInstallDashboardCardsEnabled": false
        },
        "iconImage": {
            "url": null
        },
        "classifications": [
            "AUTOMATION"
        ],
        "singleInstance": true
    }
],
"_links": {
    "next": null,
    "previous": null
}

Ok attempted to hit that URL again with the installedappid and the locationid that I pulled from the api and still failed.

delete you API key !!!!

ok so delete my current key and recreate it?

In your posting above.... anyone can get control of your hub

My current api key is not in that posting.

I don’t see his API key in what he posted. False alarm.

I think Brads URL takes the appId not installedAppId

Yeah I tried both of those and same response. Let me delete and retry and see what it does.

yes paranoid... i have seen way to many people just output and not realize it

Yeah no love, it takes like 5 seconds for the url to reply and then bomb. Wondering if I should curl the URL instead eithe rway I'm here to work this thing till it works again lol.

Did anything change in your HA/reverse proxy side? What set you out on trying to reinstall in the first place? I wonder if the callbacks aren’t reaching HA reliably.

So the steps I did
configuration -> Integrations -> Install SmartThings
Input api key -> submit
Left that window open that says "I installed app"
Then used the URL given after logging into the IDE
once done with the authorization go back to HA and click on fininish

So it’s working now?

So I wondered that today as well so I removed cloud foundry from in front of me and tried that. My reverse proxy is HAProxy running on PFSense that I haven't updated anytime recently. The reason why I redid my integration was this morning it wasn't communicating with any of my devices. It did this the other day and I just redid the integration and all was right in the world. The weird thing though this morning was that suddendly I had 3 instances of the app installed. I opened a ticket with ST to get them to clear it up before I realized I could use postman with some api calls and your tool to clean them. The tool didn't clean up all of them so I cleaned up the rest with the api call through postman.
Anyways I removed CF from in front of it and no love same errors. So I put CF back in front. My baseURL looks like it has I even stuck a :443 on the end for good measure. Its just weird that nothing in my infrastructure has changed and now its having issues.

At you updating the base_url and restarting HA after taking CF out/putting it back in? It still sounds like something is wonky with ST reaching your HA.

Try using Nabu Casa to confirm or rule it out.

Oh that new external service thing.

OMG OMG OMG, my cloud connectivity was not signed in. Signed that back in and viola everything works. I am now going to bang my head several times into my desk. But on the other hand I hope that this issue helps someone in the future.

In going to close this out since you’re both up and running. Brad has an issue opened on the ST side for the suspected android issue.

In going to close this out since you’re both up and running. Brad has an issue opened on the ST side for the suspected android issue.

Well something has gone wrong yet again...

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/config_entries.py", line 179, in async_setup
    hass, self
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/smartthings/__init__.py", line 111, in async_setup_entry
    entry.data[CONF_REFRESH_TOKEN],
  File "/srv/homeassistant/lib/python3.7/site-packages/pysmartthings/smartthings.py", line 202, in generate_tokens
    client_id, client_secret, refresh_token)
  File "/srv/homeassistant/lib/python3.7/site-packages/pysmartthings/api.py", line 417, in generate_tokens
    raise APIInvalidGrant(data.get('error_description'))
pysmartthings.errors.APIInvalidGrant: Invalid refresh token: REMOVED

@andrewsayre busted now.....

@sgrayban Please see #22529.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piitaya picture piitaya  Â·  3Comments

kirichkov picture kirichkov  Â·  3Comments

i-am-shodan picture i-am-shodan  Â·  3Comments

moskovskiy82 picture moskovskiy82  Â·  3Comments

arangates picture arangates  Â·  3Comments