mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Remove extra inner function for mqtt reload service (#118211)
This commit is contained in:
parent
872e9f2d5e
commit
5b608bea01
@ -364,12 +364,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
)
|
||||
|
||||
# setup platforms and discovery
|
||||
|
||||
async def async_setup_reload_service() -> None:
|
||||
"""Create the reload service for the MQTT domain."""
|
||||
if hass.services.has_service(DOMAIN, SERVICE_RELOAD):
|
||||
return
|
||||
|
||||
async def _reload_config(call: ServiceCall) -> None:
|
||||
"""Reload the platforms."""
|
||||
# Fetch updated manually configured items and validate
|
||||
@ -387,9 +381,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
new_config: list[ConfigType] = config_yaml.get(DOMAIN, [])
|
||||
platforms_used = platforms_from_config(new_config)
|
||||
new_platforms = platforms_used - mqtt_data.platforms_loaded
|
||||
await async_forward_entry_setup_and_setup_discovery(
|
||||
hass, entry, new_platforms
|
||||
)
|
||||
await async_forward_entry_setup_and_setup_discovery(hass, entry, new_platforms)
|
||||
# Check the schema before continuing reload
|
||||
await async_check_config_schema(hass, config_yaml)
|
||||
|
||||
@ -416,11 +408,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
# Fire event
|
||||
hass.bus.async_fire(f"event_{DOMAIN}_reloaded", context=call.context)
|
||||
|
||||
async_register_admin_service(hass, DOMAIN, SERVICE_RELOAD, _reload_config)
|
||||
|
||||
await async_forward_entry_setup_and_setup_discovery(hass, entry, platforms_used)
|
||||
# Setup reload service after all platforms have loaded
|
||||
await async_setup_reload_service()
|
||||
if not hass.services.has_service(DOMAIN, SERVICE_RELOAD):
|
||||
async_register_admin_service(hass, DOMAIN, SERVICE_RELOAD, _reload_config)
|
||||
# Setup discovery
|
||||
if conf.get(CONF_DISCOVERY, DEFAULT_DISCOVERY):
|
||||
await discovery.async_start(
|
||||
|
Loading…
x
Reference in New Issue
Block a user