Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions homeassistant/components/wemo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def coerce_host_port(value: str) -> HostPortTuple:
return host, port


CONF_CALLBACK_ADDRESS = "callback_address"
CONF_STATIC = "static"

DEFAULT_DISCOVERY = True
Expand All @@ -69,6 +70,7 @@ def coerce_host_port(value: str) -> HostPortTuple:
{
DOMAIN: vol.Schema(
{
vol.Optional(CONF_CALLBACK_ADDRESS): cv.string,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be provided by the Network integration instead?

Additionally:

For integrations that connect to devices or services, we no longer accept new YAML configuration or changes.

This integration needs to be refactored first to use a configuration flow and config entries first.

More information about this can be found in Architecture Decision Record:

See our developer documentation on how to get started creating a configuration flow for this integration:

https://developers.home-assistant.io/docs/config_entries_config_flow_handler

As these changes often involve a bit of work and some significant shift in the current code, we will close this PR for now.

We (and our community!) would really appreciate it if you could start on the refactoring of this integration in a new PR.

Thanks already! 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how this would go in the Network integration... it configures a pywemo-specific environment variable. Anyway, will rework after config flow is done. Beyond my current capabilities.

vol.Optional(CONF_STATIC, default=[]): vol.Schema(
[vol.All(cv.string, coerce_host_port)]
),
Expand Down Expand Up @@ -102,6 +104,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up a wemo config entry."""
config = hass.data[DOMAIN].pop("config")

# Override the callback address via environment variable
callback_address = config.get(CONF_CALLBACK_ADDRESS, '')
if callback_address:
os.environ['PYWEMO_CALLBACK_ADDRESS'] = callback_address

# Keep track of WeMo device subscriptions for push updates
registry = hass.data[DOMAIN]["registry"] = pywemo.SubscriptionRegistry()
await hass.async_add_executor_job(registry.start)
Expand Down