Skip to content

Add support for reloading of YAML configuration#79

Merged
mweinelt merged 1 commit intomweinelt:mainfrom
falconindy:main
Feb 8, 2026
Merged

Add support for reloading of YAML configuration#79
mweinelt merged 1 commit intomweinelt:mainfrom
falconindy:main

Conversation

@falconindy
Copy link
Copy Markdown
Contributor

This allows users to hot reload the configuration through Developer
Tools rather than having to fully restart Home Assistant in order for
changes to be reflected.

@mweinelt
Copy link
Copy Markdown
Owner

mweinelt commented Feb 2, 2026

Thanks, will likely get to this PR this weekend, hopefully.

Comment thread custom_components/prometheus_sensor/__init__.py Outdated

async def async_setup(hass: HomeAssistant, config: ConfigType):
"""Set up the prometheus-sensor integration."""
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why here and not in async_setup_platform for each individual platform?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

async_setup_reload_service will clear the set of known entities and then trigger the setup workflow. Calling this multiple times from within an integration introduces a race condition that could lead to a reload only exposing one platform of entities.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Fair.

This allows users to hot reload the configuration through Developer
Tools rather than having to fully restart Home Assistant in order for
changes to be reflected.
@mweinelt mweinelt merged commit cc9acd7 into mweinelt:main Feb 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants