Non-UI config options for engineers :)

Hi, I understand the intent to move away from text based config files.

But, as an engineer, I would really rather not configure much via the UI

I’ve been skimming the dev docs, and I see that integrations (and other stuff?) has a nice versioned schema API for putting stuff in the core config db. Is this accessible outside an integration? Does it also let you get at other stuff like automations?

For example, I would just write my only little bit of code to find my Konnected alarm panel and name all of the entities the way I want, etc. And more code to add/update all of my automations as needed. And so on. My dream (probably not possible) would be to be able to re-build my setup exactly from a blank slate by just running my code.

Could I, in theory, write an external tool, or very weird integration where I could just configure everything that used to be in YAML in code (python if an integration, something else if there is like a REST api or something).

Is this crazy?

Its probably a losing battle to try to have a Nix like Home Assistant for everything, entities created by integrations, areas, and more and more seem just not setup for it.

But it’s very easy to use something like PyScript or Node Red to keep your automations fully in code.

Yeah, I think 100% is never going to work. But, for example, when you add an ESPHome device it’s going to discover and add and bunch of entities. Fine, makes sense. I’d like to be able to code up the customization of the entities, which I could do with a good API.

There are some examples here of what is still allowed to be configured using YAML:

Yeah, I’ve read that.

I’m asking about something different. I see why you don’t want to support YAML (or any text config system). You don’t want integration owners to have to deal with reading in the YAML and reconciling it against other state.

I’m asking about building (for myself anyway) a different configuration system. Instead of having integration code read the config, I’m looking for a (generic, not per-integration) API I can use to read and change configuration. From the POV of the integration code it would be as if a user made the changes in the UI.

These are the options available from the HA API:

Every single thing the UI/frontend interacts with in ha core is through the Home Assistant Websocket API. You are free to reimplement as much as you want of that API for your own purposes, for example you could interact with HA core via a script that calls those same API functions and creates entities, rewrites automations, etc.

It will be a lot of work, and it’s not well documented, but it’s certainly possible to build your own scriptable client in any way that you can imagine.

There was also the REST API mentioned, though that has been sort of deprecated for a while and some functionality is not available through REST anymore.