Trying to automate a bluetooth connection (Motorbike's Bluetooth)

I’m running Home Assistant in Docker on a Raspberry Pi 4 and I have a KTM motorbike (390 Duke 2021) that has bluetooth built in, which I’m trying to add as a device tracker in HA.

The Bluetooth on my motorbike is intended to be paired to a phone or headset in order to control music, though I can’t see why I can’t connect this to my Pi or automate it through Home Assistant.

I’ve tried using the Bluetooth Tracker integration- While testing, I can get it to see my iPhone’s bluetooth MAC address, which gets added to the known_devices.yaml. It doesn’t seem to pick up my motorbike’s bluetooth however.

I’ve also tried pairing my motorbike directly to my Raspberry Pi which seems to work, though I’m unsure if there’s any way to integrate this into HA from here.

I’ve figured out the solution to this myself, using Bluetooth Tracker integration.

I had to figure out the MAC address for my motorbike’s bluetooth and manually add it into the known_devices.yaml myself. Now this runs and there’s about a 20 second delay for it to be detected by my Pi when turning on the bike, then about 1 minute delay before it’s detected as being turned off.

This is an example of my code I added to the known_devices.yaml file:

KTM_390_duke_2021:
  name: KTM 390 Duke
  mac: BT_A1:B4:C8:D2:E3:F4
  icon:
  picture:
  track: true