i want to reload configuration.yaml, not reatart

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.

  1. homeassistant a way to apply the entire configuration.yaml to the server without restart it?
  2. Can I add a new reload service to apply the entire configuration.yaml to the server without restarting?
1 Like

Not at this time. That’s the nature of Python.

Sure, if you write up some code, submit it for review if you get something working. This would be great.

thank you :slight_smile:

I added this code. but didn’t work.

I added the code to “… \ homeassistant \ components \ config \ __ init__.py”.
Adding reload code is very difficult to me.
please help me :sob:
please check my code :pray:

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

DOMAIN = ‘config’
DEPENDENCIES = [‘http’]
SECTIONS = (‘core’, ‘customize’, ‘group’, ‘hassbian’, ‘automation’, ‘script’)
ON_DEMAND = (‘zwave’)
RELOAD_SERVICE_SCHEMA = vol.Schema({})

CONF_RELOAD = ‘conf_reload’

@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)

hass.service.async_services(DOMAIN,CONF_RELOAD,reload_service_handler,schema='')

It’s also very difficult for the developers that have been trying to do the same thing since forever

1 Like

homeassistant a way to apply the entire configuration.yaml to the server without restart it?

Not at this time. That’s the nature of Python.

No it’s not. That’s a design decision within this project.

Python easily support dynamic operations:

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.

7 Likes