Help me connect an ESP32 to my Bluetooth Yamaha Soundbar

I have a Yamaha CR20a soundbar. You can control it via an app using bluetooth. Somebody much cleverer than I has made a python script/web server to control theirs.

I’m using the latest BLE components of ESPHOME in an attempt to read the status of, and ultimately control, this soundbar.

I’ve got the soundbar’s mac address, and used some sample script from the ESPhome website to read out the service uuids and characteristic uuids to try and get some kind of information display as a sensor value:

esp32_ble_tracker:

  on_ble_advertise:
    - mac_address: 00:19:01:C3:26:DC
      then:
        - lambda: |-
            ESP_LOGD("ble_adv", "YAMAHA BLE device");
            ESP_LOGD("ble_adv", "  address: %s", x.address_str().c_str());
            ESP_LOGD("ble_adv", "  name: %s", x.get_name().c_str());
            ESP_LOGD("ble_adv", "  Advertised service UUIDs:");
            for (auto uuid : x.get_service_uuids()) {
                ESP_LOGD("ble_adv", "    - %s", uuid.to_string().c_str());
            }
            ESP_LOGD("ble_adv", "  Advertised service data:");
            for (auto data : x.get_service_datas()) {
                ESP_LOGD("ble_adv", "    - %s: (length %i)", data.uuid.to_string().c_str(), data.data.size());
            }
            ESP_LOGD("ble_adv", "  Advertised manufacturer data:");
            for (auto data : x.get_manufacturer_datas()) {
                ESP_LOGD("ble_adv", "    - %s: (length %i)", data.uuid.to_string().c_str(), data.data.size());
            }

ble_client:
  - mac_address: 00:19:01:C3:26:DC
    id: yamahacr20

And when I compile and run…it connects. I can see lights on my soundbar flashing (as the esp makes some sort of connection) and it spits out various bits of information:

|19:53:14|[I]|[esp32_ble_client:142]|Service UUID: 0x1801|
| --- | --- | --- | --- |
|19:53:14|[I]|[esp32_ble_client:143]|start_handle: 0x1 end_handle: 0x4|
|19:53:14|[I]|[esp32_ble_client.service:057]|characteristic 0x2A05, handle 0x3, properties 0x20|

And from that I’ve tried to make a ble characteristic sensor:

  - platform: ble_client
    type: characteristic
    ble_client_id: yamahacr20
    name: "Yamaha Value"
    service_uuid: '1801'
    characteristic_uuid: '2A05'

But…it just shows NaN. So I feel like i’m missing something fundamental. Also the ESP seems to connect and drop connection to the soundbar frequently - is that normal for ble? Any help would be appreciated!

Hello,

I’m currently working on a custom component in order to control this soundbar with Home assistant over bluetooth.

I’m already able to control volume, mute, input_source and sound mode via mediaplayer card.

I’m working now on custom services in order to control clearVoice, Bass Ext, subwoofer.and Led

I’ll let you know as soon as it’s finished.(I will create a HACS integration)

Regards

Have you managed to get it working yet? I’d love to add it to HA and test it out.

Hi,

I was just looking for a solution for my old Yamaha YSP 2500 and found this thread.
Shortly after I found this project, which might help us both:

Good luck and have fun!

edit: oh, my - this is only for network devices… sorry for the noise… :frowning: