core: Withings webhook for in_bed state not working

The problem

After setting up the new use_webhook: true YAML value and trying to get the in_bed state of my Withings Sleep, it’s not working, and I’m getting an error in the logs that look related.

Environment

  • Home Assistant Core release with the issue: 0.112.0
  • Last working Home Assistant Core release (if known): N/A
  • Operating environment (OS/Container/Supervised/Core): OS
  • Integration causing this issue: Withings
  • Link to integration documentation on our website:

Problem-relevant configuration.yaml

withings:
  client_id: redacted
  client_secret: redacted
  use_webhook: true

Traceback/Error logs

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 136, in async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 124, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 652, in async_subscribe_webhook
    return await self._do_retry(self._async_subscribe_webhook)
  File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 648, in _do_retry
    raise exception
  File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 641, in _do_retry
    return await func()
  File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 699, in _async_subscribe_webhook
    self._api.notify_subscribe, self._webhook_config.url, appli
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/withings_api/__init__.py", line 285, in notify_subscribe
    self.request(path=self.PATH_NOTIFY, params=params)
  File "/usr/local/lib/python3.7/site-packages/withings_api/__init__.py", line 82, in request
    self._request(method=method, path=path, params=params)
  File "/usr/local/lib/python3.7/site-packages/withings_api/common.py", line 896, in response_body_or_raise
    raise InvalidParamsException(status=status)
withings_api.common.InvalidParamsException: Error code 293

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 48 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Just a reminder that after restarting home assistant and/or re-configuring the integration, the bed sensor will show “Unavailable” until it is sat upon – if all else is configured correctly and the stars are aligned.

The non-bed sensors have never worked for me… ever

My in_bed sensor is not working at all any more and I am getting the same error within the logs. Uninstalling and reinstalling the integration didn’t help. I’m running HA with Nabu Casa cloud.

Ah, that’s got it working!

I’ve set my external URL to Nabu Casa, left my internal URL as my remote.subdomain.com:8123.

Resetup my Withings integration and it now all seems to be working!

done the above and still doesnt work now i get this error “Retrying setup: ‘Arrow’ object has no attribute ‘int_timestamp’”

Yeah - sat, layed down on, or otherwise put pressure on. That’s been my experience so far. Alternatively you could go with an IFTTT webhook via the Withings plugin for IFTTT. It works, but I didn’t like the lag or noise I got from it.

What finally worked for me was inspecting that .storage/core.config_entries file and seeing that the callback was using a local IP address. I HAVE nabu casa, but I typically use my local address when I’m at home adding integrations and configuring things.

I removed the integration, then went to Settings > General and explicitly set my external (nabu casa) and internal (local LAN IP) addresses, re-added the integration, restarted, and the bed sensor started working again.

However, the rest of the sensors are still “Unknown” …

Just did the exact same thing; webhook_url was using the local IP address and only after manually setting the external/internal addresses did the config change to use my nabu casa address. Nevertheless, the sensor is still displaying as unavailable and now the logs don’t show any errors. Does anyone have any tips on what to check?

Seems I have a similar problem. Shouldn’t the subscription URL be nabu casa, and not my local IP? I have no local domain name. Just using Nabu Casa and default, raw IP to access HA.

I set my Withings dev app callback to the fully qualified, external Nabu Casa callback URL.

Jan 16 18:53:26 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:26 DEBUG (MainThread) [homeassistant.components.withings] Attempt 2 of 3
Jan 16 18:53:26 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:26 DEBUG (MainThread) [homeassistant.components.withings] Configuring withings webhook
Jan 16 18:53:26 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:26 DEBUG (MainThread) [homeassistant.components.withings] Subscribing http://192.168.86.36:8123/api/webhook/9735374f52d5cbb0fa54c9fa008a566a5f36401e5ae6fc2d8197632ec3fa1bb6 for NotifyAppli.WEIGHT in 5.0 seconds
Jan 16 18:53:32 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:32 DEBUG (MainThread) [homeassistant.components.withings] Attempt 3 of 3
Jan 16 18:53:32 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:32 DEBUG (MainThread) [homeassistant.components.withings] Configuring withings webhook
Jan 16 18:53:32 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:32 DEBUG (MainThread) [homeassistant.components.withings] Subscribing http://192.168.86.36:8123/api/webhook/9735374f52d5cbb0fa54c9fa008a566a5f36401e5ae6fc2d8197632ec3fa1bb6 for NotifyAppli.WEIGHT in 5.0 seconds
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]: 2021-01-16 13:53:38 ERROR (MainThread) [homeassistant.components.withings] Unexpected error fetching subscription_update_coordinator data: Error code 293
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 658, in async_subscribe_webhook
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 654, in _do_retry
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 647, in _do_retry
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/src/homeassistant/homeassistant/components/withings/common.py", line 704, in _async_subscribe_webhook
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/local/lib/python3.8/site-packages/withings_api/__init__.py", line 285, in notify_subscribe
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/local/lib/python3.8/site-packages/withings_api/__init__.py", line 81, in request
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]:   File "/usr/local/lib/python3.8/site-packages/withings_api/common.py", line 896, in response_body_or_raise
Jan 16 18:53:38 homeassistant caabe0ebfceb[373]: withings_api.common.InvalidParamsException: Error code 293

You should create a separate issue for that @DiederikvandenB

Is there anything that needs to be provided to fix the issue, perhaps, @vangorra could have a look?