How to Read the Data from Bluetooth Device (Gran Board)?

Hi,

I have a Bluetooth device, Gran board, which is a Bluetooth dartboard that can connect to the APP.
Introduction Video
I would like to know if I can get the data while I am playing the darts?
Because I want to connect with other devices like lights when I get certain scores.
For example, when I get 110, then HA can tell the light to twinkle.
When I get 150, HA can tell the light change color accordingly.
It would be highly appreciated if someone can instruct me a direction, Many thanks!

Use the Keyboard Remote components. regardless of the name, any bluetooth device will be able connect, you just have to put proper configuration, read the docs

After you have setup the configuration, you do so any automation, as indicated in the docs

@manju-rn Many thanks for your reply

Can you give me more instructions? Because I have no idea how to start.
Should I connect my Bluetooth device with raspberry pi first?
I tried to use bluetoothctl to scan my device(dartboard), but I can’t find it (MAC address).
Instead, it is interesting that I can find my device by using BLE Scanner app.
So I didn’t connect my device with raspberry pi yet.

Although I didn’t connect my device yet, I still try to set the configuration.

keyboard_remote:
- device_descriptor: '/dev/input/event1'
  type: 'key_down'

automation: 
  alias: Keyboard all lights on
  trigger:
    platform: event
    event_type: keyboard_remote_command_received
    event_data:
      device_descriptor: "/dev/input/event1"
      key_code: 107 # inspect log to obtain desired keycode
  action:
    service: light.turn_off
    entity_id: light.study

of course, it didn’t work.
But I am curious how can I know the key_code by inspecting the log?

Thanks again for your reply

I don’t know much about these Gran board, based on your description I assumed that they connect over bluetooth. Couple of questions before we proceed:

  1. Which Pi do you have?
  2. So you are not able to connect the board with your phone via bluetooth? Generally some button needs to be pressed in any device to get into pairing mode. Also, if it is already connected to other device it would not connect to a new device unless it is unpaired from original. Try this before we jump into BLE. The probable reason that you were able to find the BLE is that BLE may not have been connected to any device and hence able to be discovered on BLE.
  3. You may have already tried it, but no harm in trying “sudo bluetoothctl” instead of just bluetoothctl. See if it finds the device

Since you are able to find the device with BLE, you can use that. However, I found PI3B+ gets super slow when connected to BLE and it is also not stable. Thatswhy all my BLE devices are paired with ESP32 instead. As I said, lets continue with Bluetooth first than move to BLE as it requires bit more tinkering than usual :slight_smile:

In your config…yaml try with device_name instead of device_descriptor, since these event* files often change. Go to /proc/bus/input and cat devices. You will find the names of the input devices, these should appear after a successful Bluetooth connection. Use that device name, there may be multiple names for single device, see which one works, ideally it should match with what you see them during scanning with sudo bluetoothctl

keyboard_remote:
  - device_name: "Namando Keypad Keyboard"
    type: 'key_down'

In order to find the keycodes do not provide any key code filter in event_data and use your notification feature to report the key codes, something like this in automation.yaml, I am using my telegram notification to report the key code as I press them in my bluetooth button

- alias: 'Keyboard all lights on'
  trigger:
    platform: event
    event_type: keyboard_remote_command_received
    event_data:
      device_name: "Namando Keypad Keyboard"
  action:
      - service: notify.telenotify
        data_template:
            message: Key code {{ trigger.event.data.key_code}}

Try this and if not successful, will guide you through BLE setup, preferably in ESP32

Hi manju,

Thanks for following up my question.

  1. I am using PI3B+
  2. Yes, I can connect the board with my phone via bluetooth. The flow is the board will automatically connect with phone while I launch its own APP, Google Play Store Link
  3. I try “sudo bluetoothctl”, but still can’t find the board device.
    This is the screenshot for BLE app find the board.

I am confused here, please correct me if I misunderstand.
I need to connect the board with phone first, then PI3B+ connect with my phone?
I also try this one, and can find my phone in the /proc/bus/input


So I start to set configuration.yaml and automation.yaml with your sample code
The result is I can’t get any message while I press the board.
BTW, I may not connect PI3B+ with my phone well, because it shows connected for audio
I am not sure if any impact for the following setting.

Would it better if I try with ESP32? (I need to buy it :laughing:)

No. The board should directly connect to RPI. What I meant earlier was that board might be connected to phone directly and hence it is not connecting to RPI. Can you not unpair the board from the phone? For testing, just switch off the bluetooth in the phone and see if the RPI discovers it. I hope that when phone is not available for connection the board will search for bluetooth host. Unless there is some fancy program which only connects to the specific app, it should discoverable by RPI.
Unless you can get the board discovered in RPI, this will not work.

For BLE, we can still try with RPI. However, you first need to understand how BLE works. Pardon if you already know it. However, no harm in reading again. Here is the random tutorial. The key is to understand the GATT and especially the UUID and services. Based on this you will be able to tap on the services offered by the board

Thanks for clarifying it.
Yes, you are right. After unpairing the board with phone, I can find the board in my RPI.
But I have another issue now, I can’t connect the board.
Specifically, it can only connect for a while and then disconnect.

Thanks for sharing the document, I will study.it.
I think I can reach my goal once I can connect the board.
Really appreciate your reply, I learn a lot from you, thank you again!!

Ah okay. This issue of not connecting, either indicates that the drivers may need update in RPI, or the board has some proprietary program. For the former, try updating the bluetooth thru raspi-config.
Otherwise, you could also try installing Bluez

@SONIC, were you able to figure this out? I’m interested in connecting to the Granboard for a similar purpose.

This is an old topic but was there any updates? This seems like a really interesting project!

I’ve got a granboard and bought their LED Matt, which gives you small control box, which connects via USB.

Dartboard > LED Control Box > LEDS
> Power

The LEDS used are normal 4 pin/wire RGB, nothing fancy. I was to hook up WLED and can intercept the signal coming out of the box and get it into MQTT. The LED box had an output for 2 LED Strips and I just wired the two together so that I have a spare connector to attempt this.

From what I understand all that is being done is electric applied to a wire (or wires) per color, if doing over wifi there is going to be some lag.

Still trying to work out the best and quickest way to capture the electrical signals and send them back to home assistant. Once in homeassistant NodeRed and even HA automations will make it easy to get the required affects.

Some kind of ACD converter is needed, just not sure the easiest way to do it.

It’s been 4 years since my original post. It is pitty that I still can’t solve it. I even change my granboard from 2 to 3s because I think I can leverage diyhue to connect all my lights and I don’t have to bother the effects. However, it fails again, but I think I am pretty close to it. This post illustrates what issues I encounter when I connect to diyhue. Hope this could be a inspiration for someone to solve this request, many thanks.

Best way to solve this is by using DIYHUE and then flashing your strip with their firmware:

https://install.diyhue.org/

Works a treat. The only downside is you have Hue lights vs WLED.

I’m working on if I can get their internal mic working etc. and seeing how much delay there would be if I collect the lights via DIYHUE and try to make the changes via MQTT.

Hi @latic,

Thank you for the kindly reply. I am with you that it works perfectly by using DIYHUE firmware. It can sync the device(granboard) with correct color and without lag. I am looking forward your solution. Because it would be great if I can have Hue lights and WLED at the same time

@SONIC is there anything you miss from WLED that needs to be brought across. My only use case so far is the music sync.