mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
withings: don't store the webhook URL in the state. (#69191)
The webhook url should be calculated at startup, not stored in the state as otherwise a change in network requires re-configuring the integration from scratch. This is particularly important as external network configuration might change when moving HA between networks, and it's not obvious it needs to be re-added just for this.
This commit is contained in:
parent
852eaa062c
commit
cef5d6054c
@ -111,10 +111,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
const.CONF_USE_WEBHOOK
|
||||
],
|
||||
CONF_WEBHOOK_ID: webhook_id,
|
||||
const.CONF_WEBHOOK_URL: entry.data.get(
|
||||
const.CONF_WEBHOOK_URL,
|
||||
webhook.async_generate_url(hass, webhook_id),
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ from withings_api.common import (
|
||||
query_measure_groups,
|
||||
)
|
||||
|
||||
from homeassistant.components import webhook
|
||||
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
|
||||
@ -1046,7 +1047,9 @@ async def async_get_data_manager(
|
||||
config_entry.data["token"]["userid"],
|
||||
WebhookConfig(
|
||||
id=config_entry.data[CONF_WEBHOOK_ID],
|
||||
url=config_entry.data[const.CONF_WEBHOOK_URL],
|
||||
url=webhook.async_generate_url(
|
||||
hass, config_entry.data[CONF_WEBHOOK_ID]
|
||||
),
|
||||
enabled=config_entry.data[const.CONF_USE_WEBHOOK],
|
||||
),
|
||||
)
|
||||
|
@ -13,7 +13,6 @@ DOMAIN = "withings"
|
||||
LOG_NAMESPACE = "homeassistant.components.withings"
|
||||
PROFILE = "profile"
|
||||
PUSH_HANDLER = "push_handler"
|
||||
CONF_WEBHOOK_URL = "webhook_url"
|
||||
|
||||
|
||||
class Measurement(Enum):
|
||||
|
Loading…
x
Reference in New Issue
Block a user