Custom component of existing integration

I have several custom components/integrations in my /config/custom_components folder of my RPi (running Home Assistant OS).
One of these is a replacement for the existing modbus integration with some additional files
(e.g. cover.py, light.py).

But it looks like this integration isn’t loaded correctly:

Platform error light.modbus - No module named 'homeassistant.components.modbus.light'
Platform error cover.modbus - No module named 'homeassistant.components.modbus.cover'

Any idea what’s the problem?

Regards,
Daniel.

My recollection is that this type of code modification (taking a system component and changing or adding files and calling it a custom component) was disallowed in a past HA release a year or so ago. This was done because it was causing confusion in development and defect fixing.

I’m pretty sure that’s not correct.

Right now I’m using a custom sun component from pnbruckner to replace the built-in sun component and it’s working just fine as far as I know.

According to the recent discussion on the future of yaml thread it was stated there that the correct way of maintaining yaml configuration options was to use the old component as a custom component.

I found the reference I was half remembering from Mar 6 2019. @finity maybe I misinterpreted the topic but it sure sounds like the situation being talked about here. https://www.home-assistant.io/blog/2019/03/06/release-89/ under the Noteworthy Breaking Changes section.

That was what was referred to as “The great migration”. Before that change you could create a partial custom component (as in the example from that post you could create a custom hue light component) but not need to create the entire hue component. But that was causing confusion and breaking things so the decision was made to only allow creating a custom component to override a built-in component if tgat custom component overrode the entire built-in component, not just a portion of it.

To clarify, before the custom_component directory would contain top level folders thast were platforms (sensor, light, switch, etc) now the top level folders need to be complete integrations (hue, sun, mqtt, etc) and those folders would then contain the domain files of the integration (sensor.py, switch.py…).

So, yes, you can override integrations with custom stuff but it has to be the entire integration not a portion of it.

Thanks for the clarification. So how does that apply here because the error messages seem to indicate that the extensions are invalid because they are not part of the original component definition?

Rather strange behaviour, but after updating Home Assistant to 0.112.4 it’s working …