So, like many other I use several custom components. I’ve migrated them all to the new folder format, and they are all working well. I am still not 100% sure on how to handle custom components that have the same name as an existing component.
Here is my real world example
I want to make a custom compnent for homekit controller
Here
If I understand correctly, if I copy the entire folder structrue under custom components, it still requires the folder to be named something different, like homekit_controller_custom. But then how do I add it to my config file? under
discover
homekit
?
Do I need every file (probably), every subfolder as well? Maybe this one is a bit too complex to make changes this way.
I’m new to all this and had to deal with custom components on the following occasion:
I made some changes to rflink component to be able to test it locally.
So I had to:
create a folder rflink2 inside custom_components
copy all rflink files into that folder
change rflink to rflink2 in the component’s code (something like name, don’t remember but it’s on the first scree of every source file)
change logger’s configuration (only if you debug your component and want to change its logging level)
change configuration entries to something like:
that wasn’t me saying about renaming, but when I just copied standard rflink component files into custom_components/rflink, HA didn’t seem to pick it up properly and gave errors on features I added when used in configuration until I renamed the whole thing.
I read that in the breaking changes notes for 91.x
"We finished the great migration. All built-in platforms are now in their own folder. This means that if you had a custom component or platform that had the same name as a built-in one, you have to rename it. "
I ran into this issue with pushover. I use the custom component that has support for images.
For pushover, I just changed the name and line in my config yaml, but for this it seems like it would require more. My goal is to keep from having to update code every time I update HA.
If you really want people to help you, it’s you who should give information on the issue.
If you just say “it didn’t work” and wait for questions, it might not work as you want it…
Was your comment directed to me? If so, I’m not sure what you’re speaking about.
I’m not asked for help for a specifc problem, I’m looking for confirmation on what I need to do to make an existing component (homekit_controller) a custom component.
I thought I explained it pretty well. I have a lot of custom components. All but one are components that are not the same as a HA component, so the naming convention is a non issue. As stated in the breaking changes for 91.x components that “This means that if you had a custom component or platform that had the same name as a built-in one, you have to rename it”. For me I ran into this issue with a custom pushover component. I was able to rename it, and have it work, but it was a pretty basic component with only a handful of .py files, and more importantly it was not part of the “discover:” component.
The homekit contoller component has a lot of files, subfolders, and probably a tie in to the discover component, so I guess my problem would be. Does anyone have any recommendations on the best way to make a custom component out of the homekit contoller
The manifest.json is something new, it is at the root directory of the component. The REQUIREMENTS variable and some other things were moved into this file. It’s used by some scripts to generate the requirements.txt, CODEOWNERS and probably has some other functions I am not aware of.
Thanks for the help. My question from here is will i have to update this file every time upgrade ha? This was kind of my initial question at this point i just want the ability to include some HomeKit devices and exclude others
I concur that the original description did not mention the need to rename the custom component’s directory.
If you want to share an adjusted version of a Home Assistant integration, copy over ALL the files …
My custom components are enhanced versions of MQTT HVAC and MQTT Alarm Control Panel. When I tested them in 0.89, I did not need to rename the directory. However, because I use other MQTT platforms for light, switch, binary_sensor, etc I had to copy all of the other MQTT platforms into config/custom_components/mqtt as well.
It worked well until I tried to do an automation using mqtt.publish. Then I discovered Home Assistant was also expecting to find MQTT Automation as well in config/custom_components/mqtt. That’s when I chose to rename the directory (my_mqtt) and have it contain only my two enhanced components. They are handled as a new component called my_mqtt.
I have not bothered to try overriding the mqtt components again in 0.90 or 0.91. However, I have noticed 2 or 3 threads where people have reported an inability to duplicate the success I had in 0.89 (i.e. override existing components with their custom components). Perhaps something quietly changed after 0.89. As a result, they rename the directory so HA handles it like a completely different component (and not an override).