SmartThings integration and IPv6 during onboarding

FYI, to document an IPv6 issue and solution with the SmartThings integration.

If possible I prefer to use IPv6 addresses for all inbound access to my home network. So during the onboarding of the SmartThings integration I assigned an AAAA (IPv6) dns record to the webhook URL. However it appears IPv6 address are not compatible with the method that validates the webhook URL during installation. This is the error after URL validation failed during onboarding:

023-03-16 23:55:28.864 ERROR (MainThread) [homeassistant.components.smartthings.config_flow] API error setting up the SmartApp: {'requestId': 'FA555ECF-5555-5F55-AB5F-DF5FFFB0F555', 'error': {'code': 'ConstraintViolationError', 'message': 'The request is malformed.', 'details': [{'code': 'TargetTimeoutError', 'target': 'https://ipv6.example.com/api/webhook/eaffb90eff905f64ab78ffec1308bffce742ff151ff8a417c8549ffc04abffff', 'message': 'Upstream target timed out', '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": "FA555ECF-5555-5F55-AB5F-DF5FFFB0F555", "error": {"code": "ConstraintViolationError", "message": "The request is malformed.", "details": [{"code": "TargetTimeoutError", "target": "https://ipv6.example.com/api/webhook/eaffb90eff905f64ab78ffec1308bffce742ff151ff8a417c8549ffc04abffff", "message": "Upstream target timed out", "details": []}]}}

The solution is to temporarily assign an IPv4 address to the DNS record used with the webhook URL and after the URL is validated and the SmartThing integration is up and running, the webhook URL DNS record can be switched to an AAAA (IPv6) DNS without any issues.

1 Like