i think homeassistant reload_core_cofig command does not setting change configuration.yaml.
i want to flexible modify the configuration.yaml.
If you add or delete a device to the configuration.yaml file, and change the value in the configutation.yaml file, it will not take effect until you restart the server.
homeassistant a way to apply the entire configuration.yaml to the server without restart it?
Can I add a new reload service to apply the entire configuration.yaml to the server without restarting?
I added the code to “… \ homeassistant \ components \ config \ __ init__.py”.
Adding reload code is very difficult to me.
please help me
please check my code
import asyncio
import os
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.const import EVENT_COMPONENT_LOADED, CONF_ID, SERVICE_RELOAD
from homeassistant.setup import (
async_prepare_setup_platform, ATTR_COMPONENT)
from homeassistant.components.http import HomeAssistantView
from homeassistant.util.yaml import load_yaml, dump
from homeassistant.loader import bind_hass
@bind_hass
def reload(hass):
“”“Reload the automation from config.”""
hass.services.call(DOMAIN, CONF_RELOAD)
@bind_hass
def async_reload(hass):
“”"Reload the automation from config.
Returns a coroutine object.
"""
return hass.services.async_call(DOMAIN, CONF_RELOAD)
@asyncio.coroutine
def reload_service_handler(service_call):
“”“Remove all automations and load new ones from config.”""
conf = yield from component.async_prepare_reload()
if conf is None:
return
yield from async_hass_config_yaml(hass, conf, component)
unloading: import sys; del sys.modules['module']; del module
The big question is how the rest of the code handles that but it’s far from impossible and has been for a long time (I remember writing something like this roughly 15 years ago). It could be a large undertaking within this project however, I’m not yet sure how the core of Home Assistant is written but if things are strongly intertwined it could be incredibly difficult to dynamically reload without breaking everything.