core icon indicating copy to clipboard operation
core copied to clipboard

Smartthings + Home Assistant Cloud: could not validate webhook

Open domeq opened this issue 1 year ago • 7 comments

The problem

My Smartthings integration has been running just fine up until today when it stopped. I deleted the integration and wanted to re-add it, but am getting an error I've never seen before. Basically with Home Assistant Cloud setting up Smartthings has always been smooth experience.

  1. I'm clicking 'Add Integration' button, select Smartthings. I get this:

    SmartThings will be configured to send push updates to Home Assistant at:

    https://hooks.nabu.casa/...

    If this is not correct, please update your configuration, restart Home Assistant, and try again.

  2. I put my token in the next step, click submit and get this error:

    SmartThings could not validate the webhook URL. Please ensure the webhook URL is reachable from the internet and try again.

This is what I get in the logs:

homeassistant    | 2022-07-14 17:19:11 ERROR (MainThread) [homeassistant.components.mqtt.climate] Could not parse temperature from
homeassistant    | 2022-07-14 17:20:35 ERROR (MainThread) [homeassistant.components.smartthings.config_flow] API error setting up the SmartApp: {'requestId': 'EF419400-C55B-4ADA-8EDB-4FE2E529A6FF', 'error': {'code': 'ConstraintViolationError', 'message': 'The request is malformed.', 'details': [{'code': 'TargetNon200Error', 'target': 'https://hooks.nabu.casa/...', 'message': 'Target did not respond with a 200 status. Upstream status code=503', 'details': []}]}}
homeassistant    | Traceback (most recent call last):
homeassistant    |   File "/usr/src/homeassistant/homeassistant/components/smartthings/config_flow.py", line 124, in async_step_pat
homeassistant    |     app, client = await create_app(self.hass, self.api)
homeassistant    |   File "/usr/src/homeassistant/homeassistant/components/smartthings/smartapp.py", line 146, in create_app
homeassistant    |     app, client = await api.create_app(app)
homeassistant    |   File "/usr/local/lib/python3.10/site-packages/pysmartthings/smartthings.py", line 110, in create_app
homeassistant    |     entity = await self._service.create_app(app.to_data())
homeassistant    |   File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 171, in create_app
homeassistant    |     return await self.post(API_APPS, data)
homeassistant    |   File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 395, in post
homeassistant    |     return await self.request("post", self._api_base + resource, data=data)
homeassistant    |   File "/usr/local/lib/python3.10/site-packages/pysmartthings/api.py", line 368, in request
homeassistant    |     raise APIResponseError(
homeassistant    | pysmartthings.errors.APIResponseError: Unprocessable Entity (422): {"requestId": "EF419400-C55B-4ADA-8EDB-4FE2E529A6FF", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "TargetNon200Error", "target": "https://hooks.nabu.casa/...", "message": "Target did not respond with a 200 status. Upstream status code=503", "details": []}]}}

If I open the webhook URL in the browser I'm getting {"statusCode":503,"message":"Unavailable"} too. It looks like the problem is rather with the webhook itself than with the integration, but that's just my best guess.

What version of Home Assistant Core has the issue?

2022.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Smartthings

Link to integration documentation on our website

https://www.home-assistant.io/integrations/smartthings/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

domeq avatar Jul 14 '22 15:07 domeq

Hey there @andrewsayre, mind taking a look at this issue as it has been labeled with an integration (smartthings) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Similar issue after upgrading to 2022.7.x

Have had my SmartThings integration running for a few years with no issue.

EDIT: I had to create a new token on the SmartThings side and reconfigured the integration. Seems to be working now.

image

dadcoachengineer avatar Jul 15 '22 14:07 dadcoachengineer

I am having the same issue as domeq above with Home Assistant 2022.7.5, Supervisor 2022.07.0, Operating System 8.2.

jgoldwein avatar Jul 19 '22 13:07 jgoldwein

Looks like the same issue as https://github.com/home-assistant/core/issues/73973 (reported on 2022.6.7)

timovd avatar Jul 21 '22 06:07 timovd

I wouldn't say it's the same issue as it's a completely different setup and even the response code from the webhook is different.

My problem is that a webhook generated by the Smarthings integration and living under https://hooks.nabu.casa/ returns 503 (unlike any other, already existing webhook which all return {} and 400 response code when I do a normal GET request). The problem lies either in the Smarthings integration that handles the webhook call or the Nabu Casa webhooks setup. Either way, I've already tried everything on my end - no fix yet :(

domeq avatar Aug 01 '22 06:08 domeq

I'm having this exact same issue and I can't figure it out.

kaiasakuro00 avatar Aug 10 '22 02:08 kaiasakuro00

I'm having this exact same issue and I can't figure it out.

What version of TLS are you using? 1.3 is not supported.

timovd avatar Aug 10 '22 06:08 timovd

I don't know where Id find that information.

kaiasakuro00 avatar Aug 10 '22 06:08 kaiasakuro00

Same problem here.....

stamandr avatar Aug 14 '22 21:08 stamandr

Same problem here...

lkoniecki avatar Aug 18 '22 17:08 lkoniecki

I contacted Nabu Casa support and while the problem was not on their side, they gave me a tip that fixed the integration.

What you need to do is go to your main configuration directory and to .storage directory in it and remove a smartthings file. Then restart Home Assistant and re-create the integration.

domeq avatar Aug 20 '22 13:08 domeq

I've deleted the file. and it still give me the same "could not validate webhook" error. If I use DuckDNS it works. If I reconfigure to use Cloudflared I get the error.

stamandr avatar Aug 20 '22 22:08 stamandr