custom-components / ble_monitor

BLE monitor for passive BLE sensors
https://community.home-assistant.io/t/passive-ble-monitor-integration/
MIT License
1.92k stars 248 forks source link

[New Sensor]: Transducers Direct TDWLB-LC-RPPF #1386

Closed bobbeims closed 1 week ago

bobbeims commented 3 months ago

Sensor Description

TDWLB-LC-RPPF remote pool pressure monitor

Additional information

CirrusSense Wireless Pool Filter Pressure Gauge

I've been using this remote pressure sensor for a while with the Pressure Pro CirrusSense app but would really like to integrate the pressure data into my Home Assistant setup.

I've used the iOS app "BLE Scanner" to grab the basic info for my sensor. Since the linked instruction page doesn't talk about the iOS app, I'm not sure if I've given you all of the data you need.

BLE advertisements

DEVICE UUID
81632CAA-1804-5E3A-283C-3282E0B7E86F

ADVERTIMENT DATA

{length = 3, bytes = 0x0c0114}
Advertisement Manufacturer Data

10
TxPower Level

YES
Device is connectable

{length = 3, bytes = 0x0c0114}
Advertisement Manufacturer Data

Pressure Tank
Device Local Name

10
TxPower Level

SERVICES

DEVICE INFORMATION
0x180A
PRIMARY SERVICE

BATTERY SERVICE
0x180F
PRIMARY SERVICE

CUSTOM SERVICE
0x18FF
PRIMARY SERVICE

TX POWER
0x1804
PRIMARY SERVICE

CUSTOM SERVICE
CC4A6A80-51E0-11E3-B451-0002A5D5C51B
PRIMARY SERVICE
bobbeims commented 3 months ago

Here are screenshots from the BLE Scanner app image image image image image image image image image image image image image

bobbeims commented 3 months ago

Here are a couple screenshots from the iOS app: image image

bobbeims commented 2 months ago

@Ernst79 I just want to make sure I've provided the info needed correctly. If there's anything I can do to help get this sensor added in the near term, please let me know.

bobbeims commented 2 months ago

@Ernst79 I don't mean to be a pest, but is there anything I can to do help nudge this along?

Ernst79 commented 2 months ago

Hi, I’m very busy at the moment, lacking time to look into this right now. What can make it easier for me is collecting the data via the Home Assistant logs, in stead of via the BLE scanner app, as explained in method 1 here. https://custom-components.github.io/ble_monitor/sensor_request

starsoccer commented 1 month ago

+1 on this. Would be great to get added. Im looking at buying one of these sensors(not for a pool) and hopefully it will be compatible or a small tweak to make it compatible

starsoccer commented 1 month ago

Just got my sensor, @bobbeims What is the best way to pull your branch and try it locally? I ended up getting the pool sensor so I expect it will work fine, but would love to have the data in HA

starsoccer commented 1 week ago

Sorry to be a pest on this, but any update? Would gladly chip in 20$ to get this added as I really need historical data which currently isnt possible with the app

Ernst79 commented 1 week ago

Based on the info you gave in the OP, I come to the conclusion that this device needs a connection, to read the data (Characteristics). This is unfortunately not possible with BLE monitor, we only read passively send data. You can try ESPhome BLE client instead, that component is able to connect to BLE devices and “ask” for the data, by sending a request message to the device.

I’m closing the issue here, as it is not possible to implement it in BLE monitor. Y

bobbeims commented 1 week ago

Ernst,

Thanks for the update. Since I haven’t ventured into the world of ESPhome, yet, I want to make sure I’m understanding your suggested solution. I’d need to get an ESPhome board, configure it to connect to my Home Assistant instance, and configure it with the BLE monitor to pass the sensor info through to HA.

Is that correct?

Regards, Bob

On Nov 14, 2024, at 12:38 AM, Ernst Klamer @.***> wrote:

Based on the info you gave in the OP, I come to the conclusion that this device needs a connection, to read the data (Characteristics). This is unfortunately not possible with BLE monitor, we only read passively send data. You can try ESPhome BLE client instead, that component is able to connect to BLE devices and “ask” for the data, by sending a request message to the device.

I’m closing the issue here, as it is not possible to implement it in BLE monitor. Y

— Reply to this email directly, view it on GitHub https://github.com/custom-components/ble_monitor/issues/1386#issuecomment-2475527231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQR6DAEHJHO42HGYIEUK5T2ARAO5AVCNFSM6AAAAABNGPY5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZVGUZDOMRTGE. You are receiving this because you were mentioned.

Ernst79 commented 1 week ago

Allmost. The first steps are correct, you need an ESP device (with Bluetooth) flashed with ESPHome and you need to add it to HA with the ESPHome integration. However, you don't need to configure it in BLE monitor, as HA can directly get its data from the ESPHome device.

You will need to enable BLE client on the BLE device and configure the MAC address of your Transducer to be able to make a connection, see the instructions here.

https://esphome.io/components/ble_client.html

Read the entire page, you will need to figure out yourself which data can be read from the device. this is explained on the above page, but will most likely be a lot of trial and error. And if the data is encrypted, it becomes really hard, but in most cases, data is not encrypted, in which case you should be able to figure out what data is what.

starsoccer commented 1 week ago

Allmost. The first steps are correct, you need an ESP device (with Bluetooth) flashed with ESPHome and you need to add it to HA with the ESPHome integration. However, you don't need to configure it in BLE monitor, as HA can directly get its data from the ESPHome device.

You will need to enable BLE client on the BLE device and configure the MAC address of your Transducer to be able to make a connection, see the instructions here.

https://esphome.io/components/ble_client.html

Read the entire page, you will need to figure out yourself which data can be read from the device. this is explained on the above page, but will most likely be a lot of trial and error. And if the data is encrypted, it becomes really hard, but in most cases, data is not encrypted, in which case you should be able to figure out what data is what.

Ive looked into the data source already and the data is plain text not encrypted. The data is simply hex encoded and you just need to add a decimal point to it. For instance a characteristic will be set to 014B which when converted to decimal becomes 331 meaning the pressure is 33.1

bobbeims commented 1 week ago

Thanks for the pointers. I’ll have to dust off my microcontroller development skills (I worked in the semiconductor industry for 35 years, starting in MCU chip design and progressing through systems and network design, eventually ending up as an enterprise architect for NXP, but I retired from that about 6 years ago).

On Nov 14, 2024, at 2:59 PM, starsoccer @.***> wrote:

Allmost. The first steps are correct, you need an ESP device (with Bluetooth) flashed with ESPHome and you need to add it to HA with the ESPHome integration. However, you don't need to configure it in BLE monitor, as HA can directly get its data from the ESPHome device.

You will need to enable BLE client on the BLE device and configure the MAC address of your Transducer to be able to make a connection, see the instructions here.

https://esphome.io/components/ble_client.html

Read the entire page, you will need to figure out yourself which data can be read from the device. this is explained on the above page, but will most likely be a lot of trial and error. And if the data is encrypted, it becomes really hard, but in most cases, data is not encrypted, in which case you should be able to figure out what data is what.

Ive looked into the data source already and the data is plain text not encrypted. The data is simply hex encoded and you just need to add a decimal point to it. For instance a characteristic will be set to 014B which when converted to decimal becomes 331 meaning the pressure is 33.1

— Reply to this email directly, view it on GitHub https://github.com/custom-components/ble_monitor/issues/1386#issuecomment-2477397392, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQR6DBWKBB2UAB73QET7WT2AUFJNAVCNFSM6AAAAABNGPY5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZXGM4TOMZZGI. You are receiving this because you were mentioned.

starsoccer commented 1 week ago

I would think it should be possible to do this with bluetooth proxies in HA or just bluetooth in general on HA. I dont know python so its outside my skill set though but getting this data seems relatively straightforward. Just need to connect to the device, then just wait for updates or poll every 30 seconds and grab 1 or 2 characteristics

Ernst79 commented 1 week ago

Flashing an ESPhome device is easy, you can do it from the HA interface

bobbeims commented 1 week ago

he he … that’s what developers always say, right?

(The dev team I used to lead would throw things at me in product planning sessions when I’d say things like “sure we can do that, it’s just software” 😎.)

On Nov 14, 2024, at 4:03 PM, Ernst Klamer @.***> wrote:

Flashing an ESPhome device is easy, you can do it from the HA interface

— Reply to this email directly, view it on GitHub https://github.com/custom-components/ble_monitor/issues/1386#issuecomment-2477496119, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQR6DEGXJWDLEVRNNOMMAT2AUM2LAVCNFSM6AAAAABNGPY5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZXGQ4TMMJRHE. You are receiving this because you were mentioned.

starsoccer commented 1 week ago

I didn't mean flashing was hard, I meant writing the code part to integrate with HA was beyond me. Happy to help someone else who has more experience then me

bobbeims commented 1 week ago

Gotcha … I started my career programming in assembly language and FORTRAN … moved onto C and Java … but really haven’t spent much time in Python, so I’m in the same boat as you.

On Nov 14, 2024, at 4:18 PM, starsoccer @.***> wrote:

I didn't mean flashing was hard, I meant writing the code part to integrate with HA was beyond me. Happy to help someone else who has more experience then me

— Reply to this email directly, view it on GitHub https://github.com/custom-components/ble_monitor/issues/1386#issuecomment-2477518262, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQR6DG3EQSKFYUMFPNIYQ32AUOTRAVCNFSM6AAAAABNGPY5WOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZXGUYTQMRWGI. You are receiving this because you were mentioned.

Ernst79 commented 1 week ago

You don’t need python when using an ESPHome device. it’s just configuring the YAML in the ESPHome dashboard and update the ESPHome device. Here is an config example of a sensor that connects and reads the battery data from a sensor. The docs explain how you can figure out the service_uuid and the characteristic_uuid of your sensor. https://esphome.io/components/ble_client.html#setting-up-devices

esp32_ble_tracker:

ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX
    id: itag_black

sensor:
  - platform: ble_client
    type: characteristic
    ble_client_id: itag_black
    name: "iTag battery level"
    service_uuid: '180f'
    characteristic_uuid: '2a19'
    icon: 'mdi:battery'
    unit_of_measurement: '%'

  - platform: ble_client
    type: rssi
    ble_client_id: itag_black
    name: "iTag RSSI"
starsoccer commented 1 week ago

Oh well that seems super simple actually. Any suggestions of a esphome device to get? And how does the device know to connect back to HA to report the data?

Ernst79 commented 1 week ago

Just any ESP32 with bluetooth support will be fine.

Step 1. figure out the MAC address of the device by using the esp32_ble_tracker component https://esphome.io/components/binary_sensor/ble_presence#esp32-ble-tracker-setting-up-devices Just check the logs till you see your ESPHome device. Make a note of the MAC address

esp32_ble_tracker:

Step 2. Connect to the device with the BLE client component by adding the ble_client component and specifying the MAC address of step 1 (and give it an name/id. After reflashing, check the logs for the available "characteristics" (sensor data). https://esphome.io/components/ble_client.html

esp32_ble_tracker:

ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX
    id: TDWLB-LC-RPPF

This will show you something like thin in the logs.

[18:24:56][D][ble_client:043]: Found device at MAC address [XX:XX:XX:XX:XX:XX]
[18:24:56][I][ble_client:072]: Attempting BLE connection to XX:XX:XX:XX:XX:XX
[18:24:56][I][ble_client:097]: [XX:XX:XX:XX:XX:XX] ESP_GATTC_OPEN_EVT
[18:24:57][I][ble_client:143]: Service UUID: 0x1800
[18:24:57][I][ble_client:144]:   start_handle: 0x1  end_handle: 0x5
[18:24:57][I][ble_client:305]:  characteristic 0x2A00, handle 0x3, properties 0x2
[18:24:57][I][ble_client:305]:  characteristic 0x2A01, handle 0x5, properties 0x2
[18:24:57][I][ble_client:143]: Service UUID: 0x1801

Step 3. Create a sensor by specifying the characteristic and Service UUID. This is where some trial and error kicks in, you have to figure out which characteristic is usefull, and which one is not. Note that they often follow the Bluetooth offical specs, but not always.

esp32_ble_tracker:

ble_client:
  - mac_address: XX:XX:XX:XX:XX:XX
    id: TDWLB-LC-RPPF

sensor:
  - platform: ble_client
    type: characteristic
    ble_client_id: TDWLB-LC-RPPF
    name: "sensor battery level"
    service_uuid: '180f'
    characteristic_uuid: '2a19'
    icon: 'mdi:battery'
    unit_of_measurement: '%'