Update
I finally did solve the problem in my network without the DHCP OPTION i KEA. The DHCP OPTION is not needed when the controller is located on the local network. It's only needed if you have a controller outside of your local network.
I write this, to hopefully be able to help other in the same situation.
As of now I am using OPNsense v.24.7.7.
To be able to get all unifi devices to find the controller and the adoption of new devices to work I needed to define the hostname unifi in the local DNS-server (unbound for me) and in the DHCP-scope define my local domain name, so that the unifi devices were able to find the controller.
It turned out that a unifi device when it starts up it tries to find the host unifi by asking the local DNS-server. The problem is that the devices does not know the domain name. It will try to find the host with a not fully qualified domain name. That means that it will try to find just unifi and not unifi.{localdomain}.
After adding the domain name to Domain Search in the DHCP Options the unifi devices was able to find my controller and the adoption of new devices were successful.
I finally did solve the problem in my network without the DHCP OPTION i KEA. The DHCP OPTION is not needed when the controller is located on the local network. It's only needed if you have a controller outside of your local network.
I write this, to hopefully be able to help other in the same situation.
As of now I am using OPNsense v.24.7.7.
To be able to get all unifi devices to find the controller and the adoption of new devices to work I needed to define the hostname unifi in the local DNS-server (unbound for me) and in the DHCP-scope define my local domain name, so that the unifi devices were able to find the controller.
It turned out that a unifi device when it starts up it tries to find the host unifi by asking the local DNS-server. The problem is that the devices does not know the domain name. It will try to find the host with a not fully qualified domain name. That means that it will try to find just unifi and not unifi.{localdomain}.
After adding the domain name to Domain Search in the DHCP Options the unifi devices was able to find my controller and the adoption of new devices were successful.