ESPHome and BLE devices

Hi

I am trying to create an ESPhome device, that can gather data from my Oras 6150FZ faucet, so I can track battery status, amount of water that has passed through the faucet, and the number of valve openings by the electronic valve in the faucet.

I have been able to track/decode some of the information - but from what I see, it looks like the ble_client doesn’t disconnect once it has connected - and this “locks” the BLE connection, so that I am unable to use the vendor-supplied app for my phone to read the numbers (I need to power off the ESPhome device in order to be able to connect).

Next, I have a challenge with the device changing MAC address if power-cycled (change of battery) - and that operation even affects the guids on the services/characteristics (as far as I remember).

Using the ble_tracker, I have tried the example code:

esp32_ble_tracker:
  on_ble_advertise:
    - then: 
      - lambda: |-
          ESP_LOGD("ble_adv", "New 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());
          }

But for some reason, the service uuid’s are not listed… I expected to ble_tracker to be able to fetch the list, so that I could dump the different uuid’s - but maybe that is not possible, if the device isn’t “supported” ?

Using nrf logger on my Android phone it is possible to fetch a list of services and the characteristics under each service - would that be possible in the ble_tracker ?

Also - since the mac and guids can change on powercycle of the device, I can in principle only rely on 2 “fixed” parameters - the manufacturer name, and the serial number of the device. The rest will have to be figured out from the list of services and characteristics…

I am wondering if there is a way (or how-to guide/example) to create a custom component, that utilizes the ble_tracker and ble_client (preferably with an option to disconnect once all queries have been done) ?

Regards
Brian

Hi Brian

Have you succede in connecting esphome to this faucet? I myself have a 4814FZ. Its the same hardware inside.

Torben

I tweaked another custom component, so I via BLE announcements could get the battery status.

I need to figure out how to connect to the faucet with minimum e.g. 6 hour intervals to fetch additional info…

I can try to post my custom component that can fetch the battery state via BLE (proxy).