Editing core files in docker container

Hello,
quite scared about asking questions in this section :smiley: but i can’t sort out this, quite sure i’m loosing something…
I found some bugs in an integration i’d like to fix. For this, i accessed via ssh the host system, then the docker container with HA and fixed with nano the needed files.
All ok, all working.
But is this really the only option to modify core files “online”?
I assume the vsc plugin is targeted only to .yaml files (not what i’m looking for…), is there a way to be able to modify files on my pc (vsc? notepad++ through sftp connection?) other than using vi/nano??
Or should i setup a full development environment? (definitely too much for me…)
Thanks a lot

You can override a core integration with your own copy downloaded from github (every integration documentation page contains a link to the source). Put it in config/custom_components preserving the file folder structure.

An additional action is now required. There must be a version tag in the manifest.json file for custom components. Core components do not have this so, add one to the file. It can be any number, e.g.

version: 1.0

Restart home assistant and the local copy of the integration will be used.

1 Like

Oh, this is good! but is this approach working also for core files that (i assume) are not specifically an integration?
Please let me explain with my limited technicality :slight_smile:
This is the integration → eQ-3 MAX! - Home Assistant
But the bug is in a python class used by this integration → GitHub - uebelack/python-maxcube-api
This is stored in /usr/local/lib/python…/site-packages/… something like that
Thanks!

No the method would not work in that case. As you can only change the integration files, e.g. https://github.com/home-assistant/core/tree/dev/homeassistant/components/maxcube

i expected this :frowning:
so to edit “core” files do i have any workable alternative to using nano in a ssh session?
Thanks!

Maybe set up a development environment:

That way you can submit PRs to get the class fixed too.

If the fix needs to be done on external python package, PR needs to be raised in respective repository.

Setting up the dev environment and using your own version of library would help you to validate but PR belongs to library repository. There is a section on development setup on using your own version of external libraries.

i already opened a PR to the source repository, that seems completely abandoned :slight_smile:
so i was thinking about a way of managing source code without using nano that really in 2023 is unacceptable
i understand i have to try to setup a dev environment, quite scaring…
Thanks!

You can fork it, fix it, own it and deploy it to pip via a different name maybe? And also change the dependency inside home assistant to yours one. :slight_smile:

1 Like

i like the way you blindly believe in me :smiley:

1 Like

Come on, you can do it and community is here to help you if needed

But…

wouldn’t those core files that are updated manually be reverted back to default on every monthly update to HA?

I think you would need to manually update the files on every update of HA or never update HA.

this is sure for sure :slight_smile:
i’ll probably will end up with a custom integration containing also the code of the outdated core files, can’t think about anything different…