walthowd / ha-constant-modifier Goto Github PK
View Code? Open in Web Editor NEWCustom component for Home Assistant to modify constants
Custom component for Home Assistant to modify constants
Seems the last change to this is quite old and it causes configuration load exceptions for the home assistant object since it has now mandatory arguments as described here:
https://developers.home-assistant.io/blog/2023/08/29/homeassistant-changed-signature?_highlight=homeassistant%28
With following changes I could get the ha-constant-modifier to work with HA 2023.10:
Updated imports:
from homeassistant.core import HomeAssistant
from homeassistant.config import load_yaml_config_file, YAML_CONFIG_FILE
from homeassistant.__main__ import get_arguments
from homeassistant.util.yaml import SECRET_YAML, Secrets, load_yaml
here is the updated def get_ha_config() to use the required config file parameter and the secrets parameter.
PS: From the code it appears that Secret is optional and defaults to Null, but since I use Secrets includes in my config I guess this must be specified as well when you want to duplicate the changed HA startup sequence
def get_ha_config():
"""
Duplicate enough of the HA startup sequence to extract the config *really* early.
"""
args = get_arguments()
try:
hass = HomeAssistant() # pylint: disable=no-value-for-parameter
hass.config.config_dir = os.path.abspath(os.path.join(os.getcwd(), args.config))
except TypeError:
hass = HomeAssistant(os.path.abspath(os.path.join(os.getcwd(), args.config))) # pylint: disable=too-many-function-args
return load_yaml_config_file(hass.config.path(YAML_CONFIG_FILE),Secrets(hass.config.path(hass.config.config_dir)))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.