diff --git a/homeassistant/components/withings/config_flow.py b/homeassistant/components/withings/config_flow.py index cce1c5ee23c..4dd123468a0 100644 --- a/homeassistant/components/withings/config_flow.py +++ b/homeassistant/components/withings/config_flow.py @@ -8,8 +8,9 @@ from typing import Any import voluptuous as vol from withings_api.common import AuthScope +from homeassistant.components.webhook import async_generate_id from homeassistant.config_entries import ConfigEntry, OptionsFlowWithConfigEntry -from homeassistant.const import CONF_TOKEN +from homeassistant.const import CONF_TOKEN, CONF_WEBHOOK_ID from homeassistant.core import callback from homeassistant.data_entry_flow import FlowResult from homeassistant.helpers import config_entry_oauth2_flow @@ -77,7 +78,7 @@ class WithingsFlowHandler( return self.async_create_entry( title=DEFAULT_TITLE, - data=data, + data={**data, CONF_WEBHOOK_ID: async_generate_id()}, options={CONF_USE_WEBHOOK: False}, ) diff --git a/tests/components/withings/test_config_flow.py b/tests/components/withings/test_config_flow.py index 52a584e2513..d5745ae9bed 100644 --- a/tests/components/withings/test_config_flow.py +++ b/tests/components/withings/test_config_flow.py @@ -73,6 +73,7 @@ async def test_full_flow( assert "result" in result assert result["result"].unique_id == "600" assert "token" in result["result"].data + assert "webhook_id" in result["result"].data assert result["result"].data["token"]["access_token"] == "mock-access-token" assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token"