joric / pinecil

Bluetooth client for Pinecil V2
https://joric.github.io/pinecil
MIT License
94 stars 9 forks source link

Accessing Bluetooth data with ESP32 #3

Closed TheOriginal92 closed 7 months ago

TheOriginal92 commented 1 year ago

Hey, thank you for this client. Is there any chance of implementing a similar client with an ESP32? Maybe using tasmota or esphome? My idea behind this would be telemetry integration into a smarthome Thank you!

joric commented 1 year ago

I don't have ESP32. All BLE is kind of similar (uuids+characteristics) I kind of wanted to try writing an universal plotting tool for BLE devices but I really don't know when. I have J7-C USB tester with BLE firmware, it could be the next after pinecil. Looks like there's no XML/JSON standards for BLE descriptions, the closest is probably nRFConnect XML format but it's really incomplete. I used my own JSON for tests, see #5.

TomW1605 commented 1 year ago

hi, i happen to have thought of this today too and managed to get it working. dont have time tonight but i will clean up the code and post it to github tomorow. not sure about logging to an external survice thought, from what i unserstand using BLE and WIFI at the same time on an ESP32 is a bit tricky (they cant be simultaneous so need to be scheduled) but that should be possible (i think it would be better to use the zigbee radio on the V2 to log to something like Home Assistant but no one has done any dev work for zigbee yet and thats a bit out of my league).

here is plotting a heatup cycle in the arduino serial plotter image

my code is modified from here but from what i can tell its all standard stuff

TheOriginal92 commented 1 year ago

Very good work! Next step would be to implement this code with tasmota or esphome. But I fully agree with what you said, the correct way would be to use zigbee. Is there any zigbee project using the V2s controller on GitHub? I will have a look into that. Can I assist you in getting the code to work with tasmota or esphome?

TomW1605 commented 1 year ago

Is there any zigbee project using the V2s controller on GitHub?

i dont think much progress has been made with zigbee in IronOS, i think Ralim has done some tests but not published them and wanted to focus on BLE to start with.

Can I assist you in getting the code to work with tasmota or esphome?

happy for you to try and make it work with tasmota or esphome. i have used tasmota a bunch but never written any code for it and havnt tried esphome yet (simply because i found tasmota first and havnt had a reason to use esphome instead).

i will post my code in the next hour or so, got cought up with server maintanance all day

TomW1605 commented 1 year ago

here is my code, sorry for the delay

https://github.com/TomW1605/Pinecil_ESP32_BLE

ithinkido commented 1 year ago

Can I assist you in getting the code to work with tasmota or esphome?

I have started working on two config files for ESPhome. The first one is more a brute force approach. It polls the single values separately. This is a very heavy way of doing things The second is using the bulk data value and parsing the single values out of the array. I have used the info here as a template for parsing the bulk data array. For the single data calls , this was a good place to look

esphome_pinecilyaml.txt pinecil_esphome_bulk:.yml.txt

They could use some help, as some of the bulk values do not seem to be correct. I suspect this is to do with the conversion from unit32_t to float that is required when using the publish_to method. I have not been able to find a better way to handle the parsing out of the array, but am very happy for ideas

TomW1605 commented 1 year ago

with the help of @ithinkido and some updates to IronOS here is an ESPHome config that can pull and process the data from the v2 and present it to HA https://github.com/TomW1605/esphome_pinecilv2_ble

TomW1605 commented 1 year ago

also some cool graphs 2023-02-04 23 44 58

TheOriginal92 commented 1 year ago

EDIT2: Also got MQTT working, everything working right now. Thanks!

EDIT: Found it! Now i try to use MQTT for data publishing. can you help with that?

with the help of @ithinkido and some updates to IronOS here is an ESPHome config that can pull and process the data from the v2 and present it to HA https://github.com/TomW1605/esphome_pinecilv2_ble

Thank you very much! Where can i find a compiled firmware to test? Following the link from your repo (https://github.com/Ralim/IronOS/actions/workflows/push.yml) i was not able to find any firmware files.

Thank you again!

TomW1605 commented 1 year ago

Where can i find a compiled firmware to test? Following the link from your repo (https://github.com/Ralim/IronOS/actions/workflows/push.yml) i was not able to find any firmware files.

click on the latest sucsesful run and then scroll down to find the build artifacts then download Pinecilv2

EDIT: just realised i missed your edits, great you got it working.