koenvervloesem / ESPHome-Heart-Rate-Display

ESPHome configuration for a Bluetooth Low Energy heart rate display on an M5Stack Core or LilyGO TTGO T-Display ESP32
MIT License
26 stars 4 forks source link

send a value to the bt-Device #2

Closed wettermann32 closed 2 years ago

wettermann32 commented 2 years ago

Hi, i am using your example for a Radon sensor (Radoneye). So far i can read the last value from the sensor with this. But my sensor needs to write a value to a characteristic in order to send a produce an updated value. Any idea how i could manage this with BLETracker?

The code would be:

BLERemoteCharacteristic* p2RemoteCharacteristic; ... p2RemoteCharacteristic = pRemoteService->getCharacteristic(char24UUID); if(p2RemoteCharacteristic->canWrite()) { p2RemoteCharacteristic->writeValue(0x50);

After this a new sensor value is send on a second characteristic.

Thaks for your help,

Michi

koenvervloesem commented 2 years ago

Sorry, I don't have an idea how to do this. I guess this functionality will be added sometime as a native component, and it will probably already be possible now with the right lambda. Maybe try asking on the ESPHome forum?

koenvervloesem commented 2 years ago

Coincidentally, I just found this: https://github.com/esphome/esphome/pull/2200#issuecomment-962559276

This looks like you could use it for your purpose too.

wettermann32 commented 2 years ago

Thanks for your help, in between somebody wrote an integration for my sensor direct. https://esphome.io/components/sensor/radon_eye_ble.html