It looks like after the Great Migration finished with 0.91, its no longer possible to override existing components unless you go ahead and give your custom components a new name.
Is that a correct assumption and if so, why was that changed.
I found it really convenient that you could override the existing components without having to give them a different name. Sad to see this not being an option anymore.
AFAIK, it’s still possible. You just have to override the entire component, not just pieces of it. So, e.g., if a component consists of:
homeassistant/components/xyz/__init__.py
homeassistant/components/xyz/sensor.py
homeassistant/components/xyz/switch.py
Then, even if you just want to change something in the sensor, you have to have all of these:
custom_components/xyz/__init__.py
custom_components/xyz/sensor.py
custom_components/xyz/switch.py
The idea is you copy all the files from the standard component into the appropriate place in custom_components, then modify what you want. Oh, and of course, you can add other platforms to it if you want, such as (in this example):
custom_components/xyz/light.py
even though there isn’t a corresponding file in the standard component.
Thats exactly how I had it setup and it stopped working after 0.91. When they started talking about the great migration I set it up the new way.
Only way to get it working again was calling it something else.
I had it like this:
custom_components/concord232/__init__.py
custom_components/concord232/binary_sensor.py
custom_components/concord232/alarm_control_panel.py
I had to call it something different to get it working again.
I just tried it with a 0.92 dev checkout and it still works for me. When you try it without renaming, what errors do you see?
It just doesn’t load the Custom part with the same name. I don’t get any errors. The added functionality is just not there.
I did have some extra configuration options defined in configuration.yaml only being referenced by the modified component that threw an error since they no longer existed since my custum_component no longer loaded. After I commented those out I didn’t get any further errors. But the custom part definately didn’t load anymore.
If I change the component name like this:
custom_components/concord232_2/__init__.py
custom_components/concord232_2/binary_sensor.py
custom_components/concord232_2/alarm_control_panel.py
And reference concord232_2 instead of concord232 in my configuration.yaml file it works again. I would just have preferred if I could override the built in components still.
I can confirm this behavior. I have 2 custom components, 1 unique and 1 that overrides an existing component.
I modified the directory structures and file names of both custom components after upgrading to 0.89.1. At that time, both loaded and functioned properly.
After upgrading to 0.91, the unique custom component still loaded/functioned correctly, but the component that overrode an existing one would not load. The system loaded the core version with no errors/warnings about the failure to load the custom component.
I modified the name of the directory of the component to make it unique, changed the platform name in configuration.yaml and the component loads and functions as it did before the upgrade to 0.91.
Well, FWIW, I just tried it again, but with 0.91.1, and it still works for me. In my case I’m overriding the amcrest component and my custom version is in custom_components/amcrest, no renaming of the files or the config.
Strange.
Please make sure that manifest.json file is also included in your custom component folder.
was having a bit of trouble with override in .96 but by copying the source directory exactly (input_select) and then copy and pasting the modified code into __init__.py
the override was recognized.