How to create a custom component out of an existing component?

Hi, I have a question but I am not really good in programming.

I have setup the imap sensor in Home Assistant to work with my outlook/hotmail inboxes. The component works great, though I have to change a line to make it work with Outlook/Hotmail. No problem ofcourse. However, every time I update HA the file gets overwritten (and thus the line I changed with it). So after each update I need to re-add the line to the file. Not really ideal considering that I run either beta or dev channel (depending on which features I want to test).

Now my question is, is it possible to recreate that same imap sensor as a custom component? So that after an update the component would continue to work without me having to edit that same line every time? If it is possible, I’d love to know how. Would it just be copy/pasting the component to the custom-components folder?

And wouldn’t it conflict with the existing core imap component?

Thanks for your help all.

I’m not 100% sure about this as I’ve never done it but if you put the altered file in /custom_components in your configuration directory it should not be overwritten. Editing Component Files in Hassio

That is what I thought, but didn’t know if it would conflict with the existing component as they use the same domain.

Will try this tonight, thanks.

Just copying the component in custom components will indeed just override the core component. I can safely update HA now without needing to change that line everytime.

For anyone that wants their imap sensor to work with an Outlook mailbox should take a look here.


Hey @jimz011,

Is this still supposed to be that easy? Or did this break with 0.88?

I’m trying load in a custom version of

I’ve dropped it into config/custom_components/mqtt/



This should still work yes, I still use my modified imap component on 0.117.x

Interesting. Wonder why mine is not working. Did you have to create an init file or anything?

Beginning with Version 2021.6 you have to specify a version key in the manifest.json if you copy the complete component folder to the custom_components folder (see: Custom integration changes | Home Assistant Developer Docs)
Just stumbled over this issue by copying the Homematic integration to the custom_components folder. This integration has no version key in the original folder.