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 sensor.py 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?
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
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.
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.