Smartthings + Nabu Casa

Maybe I have been looking at the instructions too much, but I’m not having much success with connecting Smartthings to my HA.

I’m using Naba Casa to implement the connection to my HA.

  1. Confirm the callback URL is correct. If using Home Assistant Cloud, it will start with https://hooks.nabuca.casa. If the URL is not correct, update your Home Assistant configuration, restart, and try again.

Enter your Personal Access Token.
Enter the token from the Smartthings app

With that error, I went down the troubleshooting path by increasing the verbosity of the logging around Smartthings.

The only things that I found an error around in the home-assistant.log was:

2023-07-28 21:55:06.351 ERROR (MainThread) [frontend.js.latest.202304111] https://bqxu80gzhm8j48aachxbrs7ugr898wvf.ui.nabu.casa/config/integrations:0:0 ResizeObserver loop completed with undelivered notifications.
2023-07-28 21:55:14.311 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Setup endpoint for https://hooks.nabu.casa/gAAAAABke-3xkWxdiZaRSO_IgHNoEastcpOpVGhOVKuaVS6Uc2_AIEhhKTY6Hu5ZEGyTDuWxKaPrU7E6m7TQfBkv-Jy_z_0HzNQY3yKZ5F_F9lz4x0YGWw9CK9N5TkcVzxp8BDJvBz-Nmqu7k73rXPet_ftemU3CODysipDJNjvporBXskaEfIY=
2023-07-28 21:55:23.982 ERROR (MainThread) [homeassistant.components.smartthings.config_flow] API error setting up the SmartApp: {'requestId': '7292349150713668401', 'error': {'code': 'ConstraintViolationError', 'message': 'The request is malformed.', 'details': [{'code': 'TargetNon200Error', 'target': 'https://hooks.nabu.casa/gAAAAABke-3xkWxdiZaRSO_IgHNoEastcpOpVGhOVKuaVS6Uc2_AIEhhKTY6Hu5ZEGyTDuWxKaPrU7E6m7TQfBkv-Jy_z_0HzNQY3yKZ5F_F9lz4x0YGWw9CK9N5TkcVzxp8BDJvBz-Nmqu7k73rXPet_ftemU3CODysipDJNjvporBXskaEfIY=', 'message': 'Target did not respond with a 200 status. Upstream status code=404', 'details': []}]}}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py", line 126, in async_step_pat
    app, client = await create_app(self.hass, self.api)
  File "/usr/src/homeassistant/homeassistant/components/smartthings/smartapp.py", line 145, in create_app
    app, client = await api.create_app(app)
  File "/usr/local/lib/python3.10/site-packages/pysmartthings/smartthings.py", line 110, in create_app
    entity = await self._service.create_app(app.to_data())
  File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 171, in create_app
    return await self.post(API_APPS, data)
  File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 395, in post
    return await self.request("post", self._api_base + resource, data=data)
  File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 368, in request
    raise APIResponseError(
pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "7292349150713668401", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "TargetNon200Error", "target": "https://hooks.nabu.casa/gAAAAABke-3xkWxdiZaRSO_IgHNoEastcpOpVGhOVKuaVS6Uc2_AIEhhKTY6Hu5ZEGyTDuWxKaPrU7E6m7TQfBkv-Jy_z_0HzNQY3yKZ5F_F9lz4x0YGWw9CK9N5TkcVzxp8BDJvBz-Nmqu7k73rXPet_ftemU3CODysipDJNjvporBXskaEfIY=", "message": "Target did not respond with a 200 status. Upstream status code=404", "details": []}]}}

Any ideas on where I went wrong?

Any thoughts?

It seems that the nabu casa URL is not reachable from internet.

Is your HA available from internet using the nabu casa URL?

Thanks for the response @makai

What is a bit weird is that I will connect Nabu Casa to my home assistant instance via the Remote UI

image

But, within several hours it is no longer connected (the URL disappears from Nabu Casa. When I look at my HA instance, it shows as connected below:

image

I’m at a loss for what is going on

Any help would be appreciated since all of my Z-Wave connections are through Smartthings

Any ideas?

Trying to get this to work leveraging the nabu casa documentation and I’m receiving a 404 Not Found error when linking on the nabucasa link shown below

image

When I go into nabu casa to see if I can access the Remote UI, I am able to reach the login page and access home assistant which seems to be the troubleshooting path suggested in the docs.

image

Does anyone know why I’d be able to access the HA instance from the Remote UI but not able to confirm the callback URL for Smartthings?

I increased the verbosity of the logging and received the following from homeassistant.log

2023-08-29 16:52:51.338 DEBUG (MainThread) [homeassistant.components.smartthings.smartapp] Setup endpoint for https://hooks.nabu.casa/xxxxxxxx
2023-08-29 16:56:09.507 ERROR (MainThread) [homeassistant.components.smartthings.config_flow] API error setting up the SmartApp: {'requestId': '340400239944354801', 'error': {'code': 'ConstraintViolationError', 'message': 'The request is malformed.', 'details': [{'code': 'TargetNon200Error', 'target': 'https://hooks.nabu.casa/xxxxxxxxx', 'message': 'Target did not respond with a 200 status. Upstream status code=404', 'details': []}]}}
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py", line 126, in async_step_pat
    app, client = await create_app(self.hass, self.api)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/smartthings/smartapp.py", line 145, in create_app
    app, client = await api.create_app(app)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pysmartthings/smartthings.py", line 110, in create_app
    entity = await self._service.create_app(app.to_data())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 171, in create_app
    return await self.post(API_APPS, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 395, in post
    return await self.request("post", self._api_base + resource, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pysmartthings/api.py", line 368, in request
    raise APIResponseError(
pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "340400239944354801", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "TargetNon200Error", "target": "https://hooks.nabu.casa/xxxxxxxxxx=", "message": "Target did not respond with a 200 status. Upstream status code=404", "details": []}]}}

A few other things I have tried:

  • I’m able to curl from the server to access the internet
  • Used SSL checker to confirm the certificate is valid. It is.

I’m running a docker based version of HA on a Ubuntu OS

Try removing smartthings file from config/.storage. Then restart HA.

1 Like

This fixed the Smartthings for myself. It’s like the Smartthings integration installed prior to Home Assistant Cloud was ready. The removal and second install worked as expected.

Any Ideas on how to update the web hook when you add a smart things integration back in?

I had everything working before, but had to delete the smart things integration out of HA. Trying to add it back in, but HA keeps trying to use the local IP and not the Nabu Casa address web hook.

-I delete the token from smart things.
-Delete the smart things file from config/.storage
-Restarted HA and can see the smart things file is not there and the webhook is no longer listed under the Home assistant cloud settings in HA after a restart, but when I go to add the integration in it keeps coming up with the local IP and not hooks.nabu.casa…

I even tried to configure the integration from outside the network so I know the remote access through Nabu Casa is working fine.

Do not know what else to try, have tried logging in and out of Nabu Casa from the instance of HA. Any ideas would be appreciated.

1 Like

Hi Michael
I had the same issue, on my installation after having the Smartthings integration removed for some time.
It seems that having the external URL set as ‘automatic’ enabled for “Use Home Assistant Cloud” did not work for my HA (Settings->System->Network).
I added my Nabu Casa URL manually and that solved the wrong Webhook URL displayed under the Smartthings integration setup wizard, and it now works again

I am having the same issue here. Running HomeAssistant as a container. I am trying to reinstall following some of the debug suggestions. I don’t see the config/.storage file to delete. I also don’t see how to setup the remote access to not be setup automatically.

Any suggestions or other ideas?

-----Update-----
I’m not sure exactly what I did, but I used the nuba casa link to my home assistant instance instead of my local link and it showed the correct webhook. I could have sworn I used the nuba casa link when I attempted this yesterday as well and got the error.

Hi. I have spent hours unsuccessfully troubleshooting the same issue. (I’m also attempting to reinstall the Smartthings integration.) Would you be willing to share how you added the Nabu Casa URL manually?

Thank you

Hi there
Sure, you need to disable the “Use Home Assistant Cloud” setting found in HA menu Settings->System->Network.
image

When setting is disabled you can add your Nabu Casa URL manually. The Smartthings integration reinstall should then be able to catch the correct Nabu URL.
I have left my setting disabled for “Use Home Assistant Cloud” even though you may be able to change it to enable after ST integration reinstall
Regards

1 Like

Thank you very much.

In the end, this is what worked for me, plus deleting the “smartthings” file in the \config.storage folder and adding the following the the configuration.yaml file:

homeassistant:
  allowlist_external_dirs:
    - /tmp
  external_url: "https://##################################.ui.nabu.casa"
  internal_url: "http://192.168.#.##:8123"

The external_url is obtained at Settings > Home Assistant Cloud > Remote Control > Nabu Casa url.

1 Like

You are welcome
Just a comment, you could try to remove the external_url & internal_url from your configuration.yaml, as the webhook should be updated correctly in the /config/.storage file
image
Cross check webhook in Settings->Home Assistant Cloud->“Your selected ST SmartApp name”

Regards

1 Like

But if you disable the cloud then i wont be able to use alexa integration?

Just out of curiosity to anybody here who set the external url to your NabuCasa one manually. Did you get a proper cloud webhook or one including your NabuCasa address?

The proper cloud webhook should be like: https://hooks.nabu.casa/

@cmariegaard, @Hendre, @superbad_dad

Just leaving this here as a note to anybody who will come across this topic and facing the same issue, that the integration is not offering a cloud hook (Home Assistant Cloud with Nabu Casa), but a local one only.

You might have a Hub on your network and you did ignore the Smartthings integration before.

Go to Settings / Devices and Services and on the Integrations page display the ignored integrations.

And click on the STOP IGNORE button for Smartthings.

When the integration was ignored, it created a config_entry with a "source": "ignore", config. The setup of the integration has a specific line which looks for an already existing config_entry with the "domain": "smartthings", if that exists then it will not create a cloud hook.

So, stop ignoring and try to set up the integration again, now it should offer a proper cloud hook with Nabu Casa without altering your internal or external address settings.

Edit: And at this stage, you might going to see another issue, which is really the beginning of this topic. The solution for that is this post: