The mystery of Integration Domain - explain please

The developer documentation looks very comprehensive and what I followed to setup dev environment worked well.

I started with “Creating Your First Integration” and got to this line in 1st paragraph:
“The minimum is that you define a DOMAIN constant that contains the domain of the integration”

As a developer of many years, the word ‘DOMAIN’ could mean many things. So I’m looking for a definition of what Home Assistant thinks it means.
First definition is that it the part of the component name before the period. (not a definition)
Integration Architecture says this:
For a list of defined domains, see entities.
The page it points to does not mention the word Domain.

The glossary uses an example of ‘light’ as a Domain name, which suggest these are predefined and I need to use the right one.
I found a number of posts asking the same question for a list of Domains, none I found had been answered (replies are not answers).

Then I ran the script “script.scaffold integration” to what it does with Domain.
It does this:
What is the domain?
> sonnenBatterieEvo

Error: Domains cannot contain spaces or special characters.

Clearly, that name contains no spaces or special characters. There is an undocumented length limit since it accepted ‘batterie’ as a domain name.

Now I’m confused as to whether the name I choose for Domain matters or not?
Is there a predefined list of Domains and I need to choose the correct domain for a batterie? If not, I’m still confused as to what the purpose of the Domain part of the name is for.

I suspect it’s the upper-case letters. In the template editor, try:

{{ "Your Proposed Name"|slugify }}

and use that.

DOMAIN should be a lower-case string, for instance: DOMAIN = "sonnenbatterieevo".

Make sure that the DOMAIN name is unique in Home Assistant.
The DOMAIN name is a quite an important part of HA:

Pushing on not knowing what a Domain is, I find it’s the folder name under the ‘homeassistant/components’ folder.
So very important to not use a name someone else has used.

Domain must be lowercase, why it doesn’t just lowercase what is typed is a mystery to me. Confusing to refer to uppercase characters as ‘special’ adds to confusion.
Likewise with the gitbub handle. Complains it doesn’t start with an ‘@’, why doesn’t it just put the ‘@’ there if that’s what it wants?

The docs look great, but vitally important information is assumed to be known.

Admittedly the lowercase requirement is missing.

There are plenty of examples to look at in the Home Assistant Core github: look in the components folder: core/homeassistant/components at dev · home-assistant/core · GitHub