I basically want to set up a Zero W to have the built in bluetooth automatically connect a specific device - a keyboard in this case - on bootup. The idea being to run Kodi using the keyboard as control (which needs automatic connection) while leaving the single usb port free for a usb stick with media.
Is there a way to do so? There are so many things I can think of to do with the Zero W and DietPi if this can work.
Untested option (only by google-searching)
How can I auto-connect keyboard after reboot?
The keyboard can only be connected over Bluetooth and the Pi is not setup to auto-connect to on boot.
After doing the initial pairing you can setup a simple cron task to automate this by following the steps below:
1.) From command line type
and make a note of keyboard MAC address.
2.) Run crontab with the -e flag to edit the cron table:
The first time you run crontab you’ll be prompted to select an editor; if you are not sure which one to use, choose “nano” by pressing Enter.
3.) To connect bluetooth keyboard automatically every time Raspberry Pi starts up, write:
@reboot echo “connect MAC-ADDRESS-OF-KEYBOARD” | bluetoothctl
Change MAC-ADDRESS-OF-KEYBOARD with the real MAC address of your bluetooth keyboard you noted Step 1.
Save and Exit crontab.
You should now be able to auto-connect to keyboard after reboot without a need of a input.