Addon Dev - Is reading json config files frowned on?

Just finishing integrating my NLU engine into HA. Will by both, Wyoming server plus optional addon + component integration. Been working on the NLU engine for about two years now, very happy with it.

This distilled HA edition will simply be compact Rust binary ~12MB, no external dependencies, works offline without internet, and will resolve the current pain point of having a versatile NLU engine that understands natural language without the compute overhead of a LLM.

Anyway, for the question. New to HA, wondering how should I be pulling areas and devices? In the addons config.yaml I have it set to map to config directory in read-only mode, so is it ok if I just read those JSON files and pull from there?

Or is that frowned upon, and I should really go the REST API and/or web socket route? It’s way easier if I can just read those JSON files during boot of the Wyoming server, but unsure if that’s frowned upon or not. Asked two different LLMs and they both gave me different answers, because of course they did.

Also, if anyone’s up for beta testing the NLU engine, let me know.

Do you have any guarantee they stay there formatted the way they are. No…

The api has a contract. Just sayin. If you can get the data from the api and it has a guaranteed contract and a security model… I’d probably use that. The other seems easier but the api also makes your solution portable and not reliant on being in a place it needs direct access to disk. Seems obvious to me which way I’d try first.

Upon thinking about this, I think I’ll just go with the reading JSON files route. Three reasons:

  1. The JSON files are version controlled, whereas the API isn’t.

  2. I also need both, custom sentences that the user has defined, and the installation uuid. These are only available by reading JSON files, so no matter what my app needs to request read only permission to config dir.

  3. This way, I don’t need to request API access meaning the app will have no ability to write / execute anything and instead will simply have read only access to the config dir. I’m assuming that’s preferable for most folks.

Then it’s just a Wyoming protocol server, so upon load can start channel that uses inotify to be pushed a notification when config is changed and needs to be reloaded.

New to HA, so was just checking in and ensuring I do this right. Unless there’s any loud objections, I think that’s the cleanest integration that requires the least amount of permission.

Awesome, will finish this up over the next couple days and get it out. It’s nice, I’m happy with it.

If you’re a Wyoming server why do you need access to MY config?

Correct me if I’m wrong, but I need to know the friendly names you defined for the areas and devices. For example, I need to know that “Boob Tube” is assigned to the TV in the area named “Man Cave”, or whatever.

Plus need any custom sentences defined that trigger custom scripts (eg. “make he living room cozy”, “run the after school drill”, etc.).