FlashiHD , registered only to thank you for your exemple of code for autoconnect bluetooth on startup.
I was looking for this trick for connecting automatically my Z407 speakers to my raspi4 which I use as a media center connected to my beamer.
No more need to manually connect the audio system for enjoying videos.
Big thumbs up to you.
Edit: I just changed the sleep 5 to sleep 15 to give enough time for the "bluetooth audio device changer" add-on to start. Then the bt connection on startup also changes the default audio device to bluetooth (instead of default hdmi).