Need further explanation of MQTT Device Discovery Payload

I’m creating a new add-on to provide PowerWall 3 metric reporting via MQTT. I’m specifically trying to use a Device Discovery Payload that lists all the entities for the device to minimize the duplication of information.

Going through the docs, I’m not clear on what the key names are under the “cmps” key in the Device Discovery Payload. In the example it lists “some_unique_component_id” and “some_unique_id2”, but it doesn’t say what (if anything) those keys are used for beyond “used as part of the discovery identification.”

The 4 questions I currently have are:

  1. What characters are allowed in the key name? I’m guessing [-_A-Za-z0-9] ?
  2. What scope does the uniqueness need to be? Can a name be repeated between different devices, and/or across different source add-ons?
  3. Are those key name used anywhere else?
  4. A bit further the docs say “A component config part in a device discovery payload must have the platform (p ) option set with the name of the component and also must have at least one component specific config option. Entity components must have set the unique_id option and have a device context.” What components could be listed beyond entities?

Hello. Really hoping for a response from someone that knows the mqtt integration.