TLDR:
Found propane tank sensor broadcasting via Bluetooth and got it working in HA. Complete NOOB on BLE so please provide better solutions.
ESPHOME Code:
# Bluetooth for Propane tank sensor
esp32_ble_tracker:
# Sending state data: '{"timestamp":1309,"address":"C3:2E:95:XX:XX:XX","rssi":-69,"name":"level: 67.4 % horiz"}'
on_ble_advertise:
# Change MAC Address to your specific device as shown in BLE Tracker.
- mac_address: C3:2E:95:XX:XX:XX
then:
- lambda: |-
# Get the name of bluetooth device.
std::string name = x.get_name();
# Check if name begins with "level:".
if (esphome::str_startswith(name, "level:")) {
# Delete the first 7 characters from name.
name.erase(0,7);
# Extract the tank state value up to next space character.
std::string value = esphome::str_until(name.c_str(), ' ');
# Update template sensor value converting to float value.
id(propane_level).publish_state(atof(value.c_str()));
}
sensor:
# To store the propane level percentage - does nothing on its own.
- platform: template
name: Propane Level
id: propane_level
unit_of_measurement: '%'
# Reports the signal strength auto magically.
- platform: ble_rssi
# Change MAC Address to your specific device as shown in BLE Tracker.
mac_address: C3:2E:95:XX:XX:XX
name: "Propane RSSI"
Backstory:
I knew that my propane provider “Ferrellgas” installed a battery powered sensor unit, that sends data over Cell/Mobile phone connection, a few months ago. I asked the installer if I could get access to the data and he told me to contact local branch. Local branch had no clue and told me to call head office. Head office told me I could sign in to a web site that would show my tank percentage status. This did show the data but I could not find a simple way to automate the extraction/download.
A few days ago, whilst debugging connection issue to Bluetooth speaker, I discovered that the propane sensor is broadcasting on Bluetooth, so down the rabbit hole I went.
I originally started by using the ESPHOME tools to try to get info but then discovered an excellent, free, Android app called " nRF Connect for Mobile" which gave a ton of useful info such as:
- Manufacturer name
- Model
- Software and firmware version
- Service and Characteristic UUIDs
See: https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=en_US&gl=US
Android App:
My sensor is outwardly branded “Ferrellgas” but actually made by “Otodata” model “TM6030”.
Quickly found that Otodata provides and Android app to get the data called “Nee-Vo” that displays correct data. See : https://play.google.com/store/search?q=nee-vo+app&c=apps&hl=en_US&gl=US
This required registration with name, email, and unique activation code found on the sensor. It worked straight away showing current tank level, historical tank level data, and current temperature at site. App is pretty good and allows setting alerts based on tank level and when it has been refilled. Don’t know why my propane provider did not inform me about this app.
- Tank capacity: 170 gal (wrong)
- Tank percentage: 68% (correct when compared to web site)
- Tank temp: 80F (correct based on other temp sensors)
Discovery:
Started with the “ESPHome BLE Tracker” to find the MAC address using “very verbose” logger output to find the MAC address of the BLE device:
# Enable logging
logger:
level: VERY_VERBOSE
Then tried the BLE_Client to connect and get more info. This was not fruitful as I could not find a Service UUID and Characteristic UUID that reported data I was looking for.
I did find out that the BLE device name rotates through 3 iterations showing data I can extract. Here is some of the summary data just in case anyone can help finding a better method. I have annotated output with [my info].
[09:47:55][I][ble_client:085]: Attempting BLE connection to c3:2e:95:XX:XX:XX
[09:48:05][I][ble_client:161]: Service UUID: 0x1800 [Always there]
[09:48:05][I][ble_client:162]: start_handle: 0x1 end_handle: 0x9
[09:48:05][I][ble_client:347]: characteristic 0x2A00, handle 0x3, properties 0xa [READ,WRITE: Device Name: 'TM6030 20341387', 'unit sleeping', '310260.3|1|0']
[09:48:05][I][ble_client:347]: characteristic 0x2A01, handle 0x5, properties 0x2 [READ: Appearance: '[512] Generic Tag (Generic category)']
[09:48:05][I][ble_client:347]: characteristic 0x2A04, handle 0x7, properties 0x2 [READ: Preferred Connection Parameters: '\x90 ' which kills HA communication when read]
[09:48:05][I][ble_client:347]: characteristic 0x2AA6, handle 0x9, properties 0x2 [READ: Central Address Resolution: 'Address resolution supported']
[09:48:05][I][ble_client:161]: Service UUID: 0x1801 [Generic Attribute]
[09:48:05][I][ble_client:162]: start_handle: 0xa end_handle: 0xd
[09:48:05][I][ble_client:347]: characteristic 0x2A05, handle 0xc, properties 0x20 [INDICATE: Service Changed? ]
[09:48:05][I][ble_client:347]: characteristic 0x2902, handle , properties [Client Characteristic Configuration? ]
[09:48:05][I][ble_client:161]: Service UUID: 6E400001-B5A3-F393-E0A9-E50E24DCCA9E
[09:48:05][I][ble_client:162]: start_handle: 0xe end_handle: 0x13
[09:48:05][I][ble_client:347]: characteristic 6E400003-B5A3-F393-E0A9-E50E24DCCA9E, handle 0x10, properties 0x10 [NOTIFY: nothing]
[09:48:05][I][ble_client:347]: characteristic 6E400002-B5A3-F393-E0A9-E50E24DCCA9E, handle 0x13, properties 0xc [WRITE, WRITE NO RESPONSE: '\xaa']
[16:07:50][I][ble_client:161]: Service UUID: 0x180A [Device info]
[16:07:50][I][ble_client:162]: start_handle: 0x14 end_handle: 0x20
[16:07:50][I][ble_client:347]: characteristic 0x2A24, handle 0x18, properties 0x2 [READ: Model Number: 'MEP3AD']
[16:07:50][I][ble_client:347]: characteristic 0x2A25, handle 0x1a, properties 0x2 [READ: Serial Number: '20341387']
[16:07:50][I][ble_client:347]: characteristic 0x2A26, handle 0x1e, properties 0x2 [READ: Firmware Revision: '1806.1.236.2.26']
[16:07:50][I][ble_client:347]: characteristic 0x2A27, handle 0x1c, properties 0x2 [READ: Hardware Revision: 'C018_1R0']
[16:07:50][I][ble_client:347]: characteristic 0x2A28, handle 0x20, properties 0x2 [READ: Software Revision: '0059.08.0091']
[16:22:32][I][ble_client:347]: characteristic 0x2A29, handle 0x16, properties 0x2 [READ: Manufacturer name: 'Otodata Inc.']
[16:07:50][I][ble_client:161]: Service UUID: 0xFE59 [Secure DFU]
[16:07:50][I][ble_client:162]: start_handle: 0x21 end_handle: 0xffff
[16:07:50][I][ble_client:347]: characteristic 8EC90003-F315-4F60-9FB8-838830DAEA50, handle 0x23, properties 0x28 [INDICATE, WRITE: Buttonless DFU]
The useful info, for me, was the changing BLE name:
[esp32_ble_tracker:746]: Name: 'TM6030 2034XXXX'
[esp32_ble_tracker:517]: Name: 'level: 68.2 % horiz'
[esp32_ble_tracker:687]: Name: 'unit sleeping'
The name rotated without discernible pattern but I could scrape it using the MAC address.
Questions/Help:
- Is a better way to do this?
- I found BLE “characteristics” that use “notify” and was wondering is this could get more usable data?
- Will I cause excessive drain on the battery powered device by reading the values?
- Let me know what other data is useful?
Thanks for any help.