mc0110 / inetbox2mqtt

communicate over mqtt protocol to simulate a truma inetbox
MIT License
78 stars 18 forks source link

Truma LevelControl (gas level) support? #10

Closed 7wells closed 1 year ago

7wells commented 1 year ago

Hi Magnus!

I have a Truma LevelControl attached to my gas bottle and can view the gas level in the Truma app (only when the iNet box is connected, which communicates with the LevelControl via Bluetooth) or in the LevelControl app (also from Truma) that communicates with the LevelControl also via Bluetooth, but directly from the mobile device, i.e. without the need of the iNet box.

Since the ESP32 is fitted with Bluetooth, too, I wonder what it takes to add support for the LevelControl.

Do you maybe have some advice how I could sniff the (Bluetooth) data traffic between the LevelControl and a) my mobile, or b) my ESP32? Or is there something else to be done to find out more about it?

Thanks for sharing your thoughts!

wolfganghuse commented 1 year ago

On iOS i use nRF Connect... for Android there should be similiar apps. You should try to scan with LevelControl in range to get first details like MAC, Manufacturer Data and after connecting to the device the advertised Services.

7wells commented 1 year ago

@wolfganghuse @mc0110 I have the device name (which seems to be just 11 digits) and the MAC address, which starts with A4: C1:38, which according to this is from Telink Semiconductor (Taipei) Co. Ltd. (MAC range: A4:C1:38:00:00:00 - A4:C1:38:FF:FF:FF).

I have redacted the long UUIDS. Please let me know what else I could provide. I will later post the outputs for the services (there is more info when clicking the blue buttons R, N, I, W).

LevelControl

wolfganghuse commented 1 year ago

the uuids are not secrets, on the contrary, they describe the various services offered, please provide also them...

FYI: R: Read Value W: Write Value N: Notification I: Indication

7wells commented 1 year ago

Here we go... Sorry that I can only provide a screenshot from the app instead of text that we could copy.

LevelControl2.jpg

wolfganghuse commented 1 year ago

ok, looks good... as you can see the 128bit UUIDs are quite generic chosen for the advertised services... keen to see the data behind the services... please try to read for every uuid.

P.S.: I am tomorrow on our camper yard, seems i will try to scan surroundings for LevelControls ;-)

7wells commented 1 year ago

Good idea - enjoy it! ;) I will post these within short time (not today, though).

A good evening to all of you!

7wells commented 1 year ago

@wolfganghuse Sorry, I was met yet able to scan. But I've found an Android app that looks very interesting for scanning: https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp

7wells commented 1 year ago

@wolfganghuse Below is a scan of the LevelControl. As I'm not yet so familiar with the app, not to speak of the technical details of BLE, I might have missed something. If you have some advice what else I could look for and post here, please let me know. Thanks!

LC.jpg

7wells commented 1 year ago

This was from the "client" tab.

Below is a screenshot of the "server" tab:

LC_server.jpg

wolfganghuse commented 1 year ago

Would be good to have a screenshot from the official app at the same time. I don’t know what kind of data is provided? Is it just level or maybe some more data? What can be configured in the app? There are writable services… do the value change if you change something within the app?

7wells commented 1 year ago

The app (see Google play store link I've posted before) can clone a device and use the data for a "GATT" server. The app has lots of tutorials and background information, but i haven't yet give through all of them. What I understand so far is that the GATT server can be used (with some restrictions) to communicate with the cloned device. Bit I've not done any tests with it, as I've no idea how it works. ☺️

wolfganghuse commented 1 year ago

I mean official Truma app

wolfganghuse commented 1 year ago

we will also need some more data points to see when, what data changes... Static view is quite complicated for reverse engineering

7wells commented 1 year ago

These screenshots are from the LevelControl app, which is only for the LevelControl and not to be mistaken for the other app that communicates with the iNetBox.

LC-app_init.jpg

LC-app_bottle-types_custom.jpg

LC-app_bottle-types.jpg

LC-app_status.jpg

LC-app_add.jpg

LC-app_bottle-types_custom_gas-type.jpg

LC-app_bottle-types_custom_fill.jpg

LC-app_bottle-types_custom_weight.jpg

7wells commented 1 year ago

we will also need some more data points to see when, what data changes... Static view is quite complicated for reverse engineering

Sorry that my time windows are so small for testing etc. But I know better now what to do next and will report more soon.

I'm going to change some settings in the app and will then check in the Nordic nrfConnect app (previous screenshots) which values have changed how. Does that make sense?

wolfganghuse commented 1 year ago

Yes, makes sense… if you cross check with Mopeka implementation there may be much calculation needed to do. Not sure how successful we will be

7wells commented 1 year ago

From the issue about the Duo Control:

I guess LevelControl is not using BLE GATT Services which are quite easy to handle... if there is some proprietary protocol or even encrypted traffic it fast gets ugly.

Is my understanding correct that the LevelControl is using BLE GATT services and that the traffic is not encrypted? Or how could I tell?

7wells commented 1 year ago

@wolfganghuse @mc0110 I hope my message finds you well. ☺️

Did you have time to consider whether my information posted here is useful?

andypnz commented 1 year ago

Hi. Just wondering if anyone has any update on LevelControl? That would be a nice addition to this project - to receive an alarm on low gas level with no Truma App, etc required......

7wells commented 1 year ago

@wolfganghuse Hello! Have you found out more about communication with the Truma LevelControl?