I would recommend either making an init startup script or adding it via the "Startup Applications" program which is built in.
Since you are using a sudo command I believe you will need to edit the sudoers to allow that command without asking for a password.
This link has some additional info.
We could make a program to do it easily so that it can be run as an application?
//resetbt.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int x;
int attempts = 0;
while(attempts < 20)
{
x = system("hcitool scan");
usleep("500000"); //added a little wait state
printf("%d", x);
if(x != -1 && x == THE_CORRECT_VALUE_OF_X_FOR_SUCCESS_OF_FIRST_COMMAND) //the printf echos a number, check for when its working and when its not. Change the value to be the one it returns when its working
{
system("sudo hidd --connect AA:BB:CC:DD:EE:FF");
exit(EXIT_SUCCESS);
}
attempts++;
}
}
Compiled with gcc:
gcc resetbt.c -o reset.bin