core: Withings initialisation failed after migration to 2023.10 release

The problem

the Withings integration now fails after upgrading to 2023.10. I have Nabu Casa Cloud. I had webhooks working with it. I installed the update, got a warning I should remove the old config form configuration.yaml and reboot. I did. But the integration reports initialisation failed. When I look at the cloud integration, the webhooks are no longer listed. However, the log says all fail because the webhook is already enabled

What version of Home Assistant Core has the issue?

2023.10

What was the last working version of Home Assistant Core?

latest before that

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Withings

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:399 
First occurred: 20:26:25 (5 occurrences) 
Last logged: 20:27:57

Error setting up entry person1 for withings
Error setting up entry person2 for withings
Error setting up entry person3 for withings
Error setting up entry person4 for withings
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/withings/__init__.py", line 189, in async_setup_entry
    await register_webhook(None)
  File "/usr/src/homeassistant/homeassistant/components/withings/__init__.py", line 150, in register_webhook
    webhook_url = await async_cloudhook_generate_url(hass, entry)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/withings/__init__.py", line 217, in async_cloudhook_generate_url
    webhook_url = await cloud.async_create_cloudhook(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/cloud/__init__.py", line 185, in async_create_cloudhook
    hook = await cloud.cloudhooks.async_create(webhook_id, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/hass_nabucasa/cloudhooks.py", line 40, in async_create
    raise ValueError("Hook is already enabled for the cloud.")
ValueError: Hook is already enabled for the cloud.

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 9
  • Comments: 19 (6 by maintainers)

Most upvoted comments

I did not have time to do post a separate bugreport yet. But seeing there are quite some changes in the .2 release, I’ll first see what happens. I’ll ignore one reconnect for all users, assuming the connection from the previous release may not have been fully correct. And should it keep happening, I’ll post a new issue. Thanks for your effort!

They still work.

Previously, you would toggle a switch in yaml to say, I want to use webhooks. If you did, it would create webhooks for you and register them.

Some people don’t expose their instance to the internet so they use home assistant cloud. Previously, people would have to manually convert their webhooks to cloudhooks and then it magically worked. I did not know about this option since wednesday, since that causes this issue.

The big difference that 2023.10 brings for webhooks, is that we automatically detect if we can do webhooks. Since people with a technical background know what a webhook is, some others don’t. Since we have the ability to detect if a setup is suitable for webhooks, why not detect it and automatically create webhooks or cloudhooks based on their setup.

So, long story short: If you have a nabu casa subscription, it will create cloudhooks and use them. If you dont have a subscription but have a publicly available HA instance running on https and port 443, it will automatically register that. If you don;t have a subscription and don’t expose your instance to the public, the integration will fallback to polling. This will provide you with every statistic except for the in bed sensor.

Does this answer your question and concern?

I also ran into this problem on the migration. I was using the webhooks for the bed sensor set up previously through Nabu Casa.

Confirming though that reinstalling the integration did work for me though to fix it.