Fetching data via BLE

Hi

I am trying to fetch data from an Oras bathroom faucet, I have identified the service and capabilities UUID …

So in my config file, I have:

sensor:
  - platform: ble_client
    ble_client_id: Oras6160FZ_Bathroom
    id: TotalWaterConsumption
    service_uuid: '2be32db1-5f6b-4cbd-8803-38d6dfb16490'
    characteristic_uuid: '2be32db1-5f6b-4cbd-8873-8d6dfb164900'
    update_interval: 3h
    lambda: |-
      uint32_t totConsumption = x[0];
      totConsumption += ( x[1]<<8);
      totConsumption += ( x[2]<<16);
      totConsumption += ( x[3]<<24);
      return (float)totConsumption;
    icon: 'mdi:faucet'
    unit_of_measurement: 'L'

But for some reason I don’t get the value…

A readout using the “nRF Connect” connect app on my phone reveals the following output:

I 20:27:25.545 Read Response received from 2be32db1-5f6b-4cbd-8873-8d6dfb164900, value: (0x) 14-00-00-00-07-00-00-00-00-00-00-00-CA-00-00-00-00-00-00-00
A 20:27:25.545 "(0x) 14-00-00-00-07-00-00-00-00-00-00-00-CA-00-00-00-00-00-00-00" received

And the data I need are the first 4 bytes (in reverse order, as it is 32 bit value), meaning that the hexadecimal value of the reading should be 00000014

But the log from ESPhome gives me a readout of NaN …

What am I doing wrong ?

Regards
Brian

That is really over my c++ pay grade! There are three BLE projects here DIY Examples — ESPHome, they might inspire you?

I have tried - but I am unable to get any data/counters into HA …

Another question pops up - when the ble_client in esphome connects and do its queries - do it disconnect again, or does is keep the connection open ?

Not sure if you know about it, but I find the folk over on the ESPHome Discord server extremely knowledgeable and responsive for when things get a bit advanced.

Any success with this.