I updated and then couldn’t connect Blue Connect to phone or extender. Ended up opening it up and disconnected and reconnected the battery. All good now. Integration works fine.
Did anyone confirm the bluetooth direct integration still works after the firmware upgrade?
How did you update it? In the app I can´t see how to update firmware.
It is a very interesting information. I tried to implement the code on my Raspberry Pi and it´s works perfectly. I have two questions, when you run the code, the information is obtained from make a new measure(in those moment) from my device (blue connect plus) or is obtained from last measure that be have on the app? and the second question is that my device (that read salt) it´s possible that be a calculated variable?
Thanks very much for make the code and your effort.
Hello ggggg,
I updated mu BlueConnect Go a couple of days ago.
I casually opened the official App and it told me there was a firmware update and to keep my phone near the device during the update. All went ok, the device rebooted and made a couple of beeps.
Now it is running v2.3.0
My python code above still gets measurements without any issue, as before the update.
Any other code should work equally well.
Regards.
Jose
Hi molinem,
when you run the code, the information is obtained from make a new measure(in those moment) from my device (blue connect plus) or is obtained from last measure that be have on the app?
The python code I posted above communicates with the device at that moment. In fact, the usual 8 seconds it takes to respond, is the time it takes to perform the measurement (power up the sensors, take a few samples of the analog signal of the sensors, average them, compose the reply packet, etc.). I guess that, if it just returned that last cached measurement, it wouldn’t take it 8 seconds to reply.
the second question is that my device (that read salt) it´s possible that be a calculated variable?
I don’t have a BlueConnect Plus, so for that, I’d love to have a few pairs of samples, taken with a sampling interval of a few hours, e.g.
- Sample 1
** raw measurement data taken by the python code
** screenshot, or copied values as shown, of a (new) sample taken with the official App, right afterwards, showing the decoded values (temperature, ph, orp, salinity, conductivity) - wait a few hours
… - Sample 5
Could you take and post them here?
With these samples and their corresponding values displayed by the App, we can probably find the way to decode them.
Regards
Jose
Update about new firmware:
My BlueConnect Go had firmware v2.2.3 and the App upgraded it to v2.3.0
Reading the data I gather with the python code every hour, I just noticed that they have changed a little the raw measurement data frame:
- it now starts with the byte 0x33 (was 0x23) → frame format v3.2, now v3.3?
- they have added one byte at the end → battery level? Sigfox local RSSI?
With v2.2.3:
23 a9 0b ff 07 aa 08 01 00 25 0e
^^-^^---------------------------- TEMP 0x0ba9 = 2985 / 100 = 29.85 ºC
^^-^^---------------------- PH (0x0800 - 0x07ff) / 232 + 7 = 7.0043
^^-^^---------------- ORP 0x08aa = 2218 / 4 = 554.50 mV
^^-^^---------- SAL 0x0001 = 1 / 25 = 0.04 ? (not supported in BlueConnectGo)
^^-^^---- COND 0x0e25 = 3621 / K 0.4134 = 8759 uS ? (not supported in BlueConnectGo)
With v2.3.0:
33 a5 0a b0 07 bc 0a 01 00 2c 0e 22
^^-^^---------------------------- TEMP 0x0aa5 = 2725 / 100 = 27.25 ºC
^^-^^---------------------- PH (0x0800 - 0x07b0) / 232 + 7 = 7.3448
^^-^^---------------- ORP 0x0abc = 2748 / 4 = 687.00 mV
^^-^^---------- SAL 0x0001 = 1 / 25 = 0.04 ? (not supported in BlueConnectGo)
^^-^^---- COND 0x0e2c = 3628 / K 0.4134 = 8776 uS ? (not supported in BlueConnectGo)
^^- UNKNOWN 0x22 = 34% battery ?
It seems that the positions for the TEMPerature, PH, ORP, SALinity, CONDuctivity values within the data frame have not changed, only the starting byte (that wasn’t being used anyway), and the additional byte at the end.
They have added a new BLE characteristic (UUID: F3300012) but it is enumerated as handle 0x0029, way beyond the handles 0x0014 (reply notification) and 0x0012 (command) that we need.
If you want, I take and post measurement samples. My blue connect plus has version v2.2.1 (v0.2 2019-11-12/e1aead1fdc0f4be) and it doesn’t update(I haven´t got any notification about this)
Since I changed the battery, sigfox doesn’t work and the support team can’t fix it, in this moment they don´t answer me. For this reason, I want to take action when I prefer . I will customize and improve your python script(I´m developer) for publish this information on mqtt.
Molinem, yes, it’d be very useful to have a few raw samples from your device and their corresponding data displayed by the App.
With the samples vampcp posted in this thread on Oct 18, 2021, I think the salinity calculation is straightforward:
23ab093207ab0a7800240e
"salinity":4.9,"conductivity":8742,"temperature":24.8,"ph":7.93,"orp":685
23a6093007b70a78001e0e
"salinity":4.9,"conductivity":8742,"temperature":24.7,"ph":7.94,"orp":688,
23ab093407980a7b00240e
"salinity":4.8,"conductivity":8528,"temperature":24.8,"ph":7.92,"orp":680
…you just divide the raw value by 25 and you get the value in g/l with 0.04 resolution, displayed by the App with just 1 decimal place.
23 ab 09 32 07 ab 0a 78 00 24 0e
^^-^^---------- SAL 0x0078 = 120 / 25 = 4.80 <-- MOSTLY OK
^^-^^---- COND 0x0e24 = 3620 / 8742 = K 0.4140 ?
23 a6 09 30 07 b7 0a 78 00 1e 0e
^^-^^---------- SAL 0x0078 = 120 / 25 = 4.80 <-- MOSTLY OK
^^-^^---- COND 0x0e1e = 3614 / 8742 = K 0.4134
23 ab 09 34 07 98 0a 7b 00 24 0e
^^-^^---------- SAL 0x007b = 123 / 25 = 4.92 <-- MOSTLY OK
^^-^^---- COND 0x0e24 = 3620 / 8528 = K 0.4244
For the conductivity, assuming a linear relationship, we can calculate a constant of approx K=0.4134, yielding a value in uS/cm with 2.4 resolution. The app seems to display it discarding the decimal part.
We need some more samples to try to calculate an accurate value for this constant. I wonder if some of the BLE characteristics of the device may provide the values for these constants (calibration data), but that would be another decoding nightmare.
I’m a little confused. According to some screenshots of the App found on Google, the Android one displays the conductivity in uS, and the iOS one displays the salinity in g/l, but none of them show both magnitudes at the same time:
Do recent versions of the App display both Salinity and Conductivity for the BlueConnect Plus?
Tomorrow I will try to get 5 samples, this is a screenshot of my blue connect plus.
The information that you write is very interesting.
By using the post of @JosePortillo i managed to get ESPHome32 to get the raw data back.
Last step is to get the data from ESPHome to HomeAssistent. Whenever I try to send the raw (hex) value the esp device boots or gets in some sort of error loop.
I use a button to send 0x01 to the BlueConnect and i receive a notification (10 sec later) on a text_sensor:
text_sensor:
- platform: ble_client
id: ${bleclient_id_prefix}_reading_data
name: ${bleclient_name_prefix} reading data
internal: true
ble_client_id: ble_client_${bleclient_id_prefix}
service_uuid: ${bleclient_recieve_service_uuid}
characteristic_uuid: ${bleclient_recieve_characteristic_uuid}
notify: true
update_interval: never
on_notify:
then:
lambda: |-
ESP_LOGD("${bleclient_id_prefix}", "%s", format_hex_pretty((uint8_t *) x.c_str(), x.size()).c_str());
the response is like this:
[ble_text_sensor:096]: [BLE Client reading data] ESP_GATTC_NOTIFY_EVT: handle=0x14, value=0x33
[text_sensor:016]: 'BLE Client reading data': Received new state 3aea\xc6
[text_sensor:067]: 'BLE Client reading data': Sending state '3aea\xc6
[ble-id:147]: 33.03.07.65.07.C6.09.00.00.25.0E.14 (12)
how can i transfer the hex value to Home Assistant?
Hi, I have managed to get the hex string back using ESPHome.
(see post 203 in this thread). I don’t know how to do the calculation in the lambda part.
Do you or @vampcp know how to do this?
ESPHome->HA does not support text at the moment, if the lampda function could do the calculation we can then send the output to HA sensors.
At the moment I am sending it to MQTT and want NodeRed do the math. That adds some unneeded part, for me the only option at the moment
HI Jose,
I managed to get ESPHome to get the raw data out of the sensor. With your calculations it’s translated.
33.08.07.B0.07.3B.08.00.00.23.0E.13
APP – raw
temp: 18.0 – 18.0
ph: 7.3 – 7.3
orp: 553 – 526.75
33.A4.06.AF.07.F1.08.00.00.21.0E.13
app - raw
temp: 17.1 – 17.0
ph: 7.3 – 7.3
orp 600 – 572.25
Values are pretty close
Based on raw-app readings, that were off by 72mv, I had to adjust the orp divider from 4 to 3.86.
I took 4 measurements across 2 days and used the python code from Jose to calculate the divider
Next days I will see if the result is closer to the app value. If so then I will upload my esphome config and the script to calculate/calibrate the orp divider to github and post the link here
And then wait for next year as the swimming time is over
Hi,
thanks Jose for your code. I implemented it in my fhempy solution.
Furthermore I think the last 2 bytes might be the battery state.
e.g. 36 0e => 0x0e36 => 3638 => 3.638 volt
It’s just an assumption, I’ll check it for the next days.
My implementation can be found here:
Can you help me please, I can’t do it
I don’t see anything coming in on my hass.
i installed ifttt on my hass
HI @Peerke
Would you mind sharing your esphome config input to have a look how do the conversion and send to MQTT.
Then I am confortable with NodeRed doing the rest or making template mqtt sensor…
Hi @Nordicfastware,
As the pool is stored I didn’t do anything with it. The code is fully working and the data looks good.
I added the config to github:
The calculation I use (with the work from Jose) are at the end of the config file.
Thanks a lot @Peerke . Implemented it and worked right away. Added also BLE proxy function in the same ESP32 to read air quality data off an airthings Wave +.
Water quality readings are quite close to what quasi simultaneous app readings say. I will see and tweak formulas as needed.
I have to say, it is quite elegant with the internal button press and BLE client switch.
I would like to add a sensor to notify whether the measurement was successful, and a last mearsurement date (even if I will automate to make a query every x hours). How would you recommend to go about that ?
I fiddle with them and found that they where pretty close too, please let me know when you get them closer. I need to add the battery suggestion from fhempy
I use an automation to enable the ‘switch.prefix_sensor_enable’ every 2 hours. Once the reading is done BLE sends a notify that is picked up by the text_sensor. I would add a date function in the lamda part to that and add that to a new template sensor to show it. Besides that the last_updated info from the text_sensor can be shown as secondary info. I think this could be useful: Time Component — ESPHome
@JosePortillo amazing reverse engineering work. regarding the salt and conductivity doubts, I found this in the manual:
@Peerke Peter, great job implementing Jose findings in ESPHome. If I understand correctly (never used ESPHome before) once having the device configured with that code, it would automatically create the entities in HA, right? I hope it won’t be too difficult to add the conductivity/salt sensors once it will be clearer how to interpret them from raw data.
Thanks again to both of you.