How can I create a custom component by copying another?

I’ve been frustrated by the long delays with controlling devices discovered by the ISY Component.

I’d like to create my own custom component and call it isy994x, and use the exact code from the original component in order to allow me to try and discover where the speed issues may be occurring.

How can I get started with creating the component and using the current custom code?

Here is an overview of choices available (part of a long thread) that may be of some help:
0.89 Breaking Change: Prevent partial custom component overlays

Assuming you are running the latest version, copy everything from here to config/custom_components/isy994x and then, in your configuration, refer to it as isy994x: instead of isy994:. Edit the manifest.json file and change any references to isy994 to isy994x. It think that should do it.

If you’re not running the latest version, find the existing isy994 component files on your host machine and copy them to the directory mentioned above.

Thanks. So I’ve got isy994x installed as a custom component, and it’s pulling in my ISY devices under this new component, but it’s adding each “device” as _2.

My ISY has a device named 1gaa1_1st_floor_spotlight which happens to be a light, and my entity registry shows under isy994 light.1gaa1_1st_floor_spotlight. I would like to modify the custom component so that the entity registry shows under isy994x a device named light.xxx_1gaa1_1st_floor_spotlight.

Obviously I need to modify the custom component code. The question is how? I can create a constant called prefix that equates to xxx_ that should be used for adding all devices (not just lights). However, I’m not sure if the custom component will properly map to the ISY device. I think it shouldn’t be an issue because you can rename devices in the entity registry but I’d like to know for certain.

If a device was registered, in the entity registry (config/.storage/core.entity_registry), using the platform isy994, if it finds the same device again, but now using another platform (isy994x) it will create a new device with the same name and an appended number.

  • Stop Home Assistant.
  • Make a backup copy of the entity registry.
  • Open the entity registry with a text editor. Everything is in JSON format so be careful what and how you modify things.
  • Remove all the new entities it created that have the _2 appended to their name.
  • All your old entities will be using "isy994". Change it to "isy994x".
  • Save the entity registry then start Home Assistant.

That’s certainly a manual way of doing things. I was hoping to find a way of modifying the custom component to add a prefix by default.

Perhaps I should’ve asked for clarification regarding:

it’s adding each “device” as _2

If you are seeing duplicated devices, that are differentiated only by a number tacked on the end of their name, that’s because the original devices, using the isy994 platform, are still recorded in the entity registry. The same devices configured to now use the isy994x platform will be registered as new entities (effectively duplicating the original ones) bearing the same name but with an appended number.