Is it possible to clone a HA integration, modify it and put it into the custom_components?
What is necessary for this to work?
Yes, it is possible. In fact you don’t have to clone it, just install it (e.g. via HACS).
Be aware that the next update of the integration will overwrite your modifications (e.g. when installed via HACS). You may prevent this by copying the integration directory to under a different name and remove the original integration (if installed via e.g. HACS).
I asked a similar question about a built-in integration, and got a pretty good answer here.
You mention modifying the cloned integration. If you put it in the custom_components directory, that will get picked up by HA instead of the built-in integration. If you don’t want to replace the existing integration, but actually make a new integration that works a little differently, you’d have to give it a different name.
My answer (installing via HACS) was on custom integrations indeed.
For standard integration it’s easier to clone it, make the custom_components/<integration_name> directory and copy the type of files into that directory (e.g. for a sensor type integration the sensor.py and all the other python dependency files the integration uses).
Yes, and then add a version key to manifest.json.