Connect Shelly BLU Door & Window directly to ESPHome driven ESP32 via Bluetooth

Hi all!

I recently flashed my Shelly Plus Plug S with ESPHome (this topic).

My goal is to create a washing machine monitoring plug with all the logic on this system. The device should only provide the actual status to home assistant when integrated. The ESPHome YAML file is ready and works fine. (I can share the complete code if needed. :slight_smile:)

The ESP monitors the power consumption and set the status from “Idle” to “Washing” and after this to “Ready”.

Here the Shelly BLU Door & Window comes into play. This sensor should be placed on the washing machine door. The Shelly Plus Plug S (with ESPHome on its ESP32 with Bluetooth) should connected directly to this sensor and receive the state updates. If the door is opened while the status is “Ready” the status should change back to “Idle”.

It is possible to connect the BLU Door & Window to Home Assistant and setup the logic there. But this is not what I want. Why? Aesthetics.

I spent many hours with ESPHome, the documentation, BLE logging apps but now it is time to ask for help. :slight_smile:

  • The Bluetooth Proxy is working (but not needed, I want to connect directly)
  • The esp32_ble_tracker is also working
  • The MAC address is known
  • The Service UUID is known
  • Many Service Characteristic UUIDs are known but not shure wich one is the right
  • Firmware of the BLU Door & Window is updated via Shelly BLU Debug App to “20230826-195045/v1.0.9-rc1@1fb04462”
  • ESPHome version is 2023.8.3
  • I am not able to get the information from the sensor
esp32_ble_tracker:
  scan_parameters:
    active: false
#bluetooth_proxy:
#  active: true
ble_client:
  - mac_address: 8C:6F:B9:2E:4D:80
    id: doorSensor
sensor:
  - platform: ble_client
    name: "Bullauge"
    id: frontDoor
    type: characteristic
    ble_client_id: doorSensor
    service_uuid: "180f"  # Anpassen
    characteristic_uuid: "2a19"  # Anpassen
#    service_uuid: "1D14D6EE-FD63-4FA1-BFA4-8F47B42119F0"  # Anpassen
#    characteristic_uuid: "F7BF3564-FB6D-4E53-88A4-5E37E0326063"  # Anpassen
    notify: true
    icon: "mdi:washing-machine"
    on_notify:
      then:
         - logger.log: "Notifiy sensor updated"
text_sensor:
  - platform: ble_client
    ble_client_id: doorSensor
    name: "Test"
    service_uuid: "DE8A5AAC-A99B-C315-0C80-60D4CBB51225"
    characteristic_uuid: "0BA9"
    on_notify:
      then:
         - logger.log: "Notifiy text-sensor updated"

Here is the log output if I open the configured sensor. I tried many different Service Characteristic UUIDs but the result is always the same.

[20:15:54][D][esp32_ble_client:048]: [0] [8C:6F:B9:2E:4D:80] Found device
[20:15:54][D][esp32_ble_tracker:214]: Pausing scan to make connection...
[20:15:54][I][esp32_ble_client:064]: [0] [8C:6F:B9:2E:4D:80] 0x00 Attempting BLE connection
[20:15:54][D][esp-idf:000]: W (2051537) BT_APPL: gattc_conn_cb: if=3 st=0 id=3 rsn=0x13

[20:15:54][D][esp-idf:000]: W (2051544) BT_HCI: hcif disc complete: hdl 0x0, rsn 0x13

[20:15:54][W][ble_sensor:037]: [Bullauge] Disconnected!
[20:15:54][D][sensor:094]: 'Bullauge': Sending state nan  with 0 decimals of accuracy
[20:15:54][W][ble_text_sensor:040]: [Test] Disconnected!
[20:15:54][D][text_sensor:064]: 'Test': Sending state ''
[20:15:54][W][esp32_ble_client:134]: [0] [8C:6F:B9:2E:4D:80] Connection failed, status=133
[20:15:54][D][esp32_ble_tracker:246]: Starting scan...

This is what another device with bluetooth proxy enabled is logging when the Shelly BLU Door & Window is configured directly in Home Assistant and forwards the data from the sensor to Home Assistant.

[19:35:45][W][component:204]: Component esp32_ble_tracker took a long time for an operation (0.05 s).
[19:35:45][W][component:205]: Components should block for at most 20-30ms.
[19:35:51][D][ble_adv:055]: New BLE device
[19:35:51][D][ble_adv:056]:   address: 8C:6F:B9:2E:4D:80
[19:35:51][D][ble_adv:057]:   name: SBDW-002C
[19:35:51][D][ble_adv:058]:   Advertised service UUIDs:
[19:35:51][D][ble_adv:062]:   Advertised service data:
[19:35:51][D][ble_adv:064]:     - 0xFCD2: (length 14)
[19:35:51][D][ble_adv:066]:   Advertised manufacturer data:
[19:35:51][D][ble_adv:068]:     - 0x0BA9: (length 13)
[19:35:57][D][ble_adv:055]: New BLE device
[19:35:57][D][ble_adv:056]:   address: 8C:6F:B9:2E:4D:80
[19:35:57][D][ble_adv:057]:   name: SBDW-002C
[19:35:57][D][ble_adv:058]:   Advertised service UUIDs:
[19:35:57][D][ble_adv:060]:     - DE8A5AAC-A99B-C315-0C80-60D4CBB51225
[19:35:57][D][ble_adv:062]:   Advertised service data:
[19:35:57][D][ble_adv:066]:   Advertised manufacturer data:
[19:35:57][D][ble_adv:068]:     - 0x0BA9: (length 13)
[19:35:58][D][ble_adv:055]: New BLE device
[19:35:58][D][ble_adv:056]:   address: 8C:6F:B9:2E:4D:80
[19:35:58][D][ble_adv:057]:   name: SBDW-002C
[19:35:58][D][ble_adv:058]:   Advertised service Uacturer data:
[19:35:58][D][ble_adv:068]:     - 0x0BA9: (lenUIDs:
[19:35:58][D][ble_adv:060]:     - DE8A5AAC-A99B-C315-0C80-60D4CBB51225
[19:35:58][D][ble_adv:062]:   Advertised service data:
[19:35:58][D][ble_adv:066]:   Advertised manufgth 13)
[19:35:58][D][ble_adv:055]: New BLE device
[19:35:58][D][ble_adv:056]:   address: 8C:6F:B9:2E:4D:80
[19:35:58][D][ble_adv:057]:   name: SBDW-002C
[19:35:58][D][ble_adv:058]:   Advertised service UUIDs:
[19:35:58][D][ble_adv:060]:     - DE8A5AAC-A99B-C315-0C80-60D4CBB51225
[19:35:58][D][ble_adv:062]:   Advertised service data:
[19:35:58][D][ble_adv:066]:   Advertised manufacturer data:
[19:35:58][D][ble_adv:068]:     - 0x0BA9: (length 13)