testo / tjf

Schema definitions of the Testo JSON format (tjf). Used in t300 / t330 / t330i / t400 / t420 / SmartProbes / t550 / t557 / t550s / t557s / testo Smart
https://www.testo.com
Apache License 2.0
7 stars 3 forks source link

Live data from Testo Smart probes #18

Open andreasharbo opened 2 years ago

andreasharbo commented 2 years ago

Hi

I have a question regarding the acquisition of live data from Testo Smart Probes.

Is it possible to retrieve data via either of the protocols (WIFI or Bluetooth) without the need for user acknowledgement? Either via the app or from the device directly.

The devices in question are specifically: Testo 115i Testo 549i

I cannot seem to find a lot of documentation on these devices, in regard to custom data acquisition :)

Thank you in advance..

gwaldvogel commented 2 years ago

Hi @andreasharbo

Is it possible to retrieve data via either of the protocols (WIFI or Bluetooth) without the need for user acknowledgement? Either via the app or from the device directly.

Yes, this is possible via the testo Smart using WIFI. There is a currently undocumented endpoint GET /api/data/live which will give you the current values displayed on screen as JSON, this will work with all testo devices compatible with the testo Smart. The testo Smart API is available on port 54000.

We are currently working on completely redoing this documentation, it will be available here in the next few weeks.

andreasharbo commented 2 years ago

Thank you for quick response.

So having the app on my phone connected to WIFI, I should be able to hit this API with something like:

´http://192.168.xx.xx:54000/api/data/live´

and get a JSON response?

gwaldvogel commented 2 years ago

Yes, that should work.

andreasharbo commented 2 years ago

If I try with Python on my computer, I get a connection error:

urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000020401334E10>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

Could it be my phone rejecting the request?

My computer is running Windows 10 and phone is Android 11.

gwaldvogel commented 2 years ago

You can first try to verify that the API is working properly by calling http://localhost:54000/api/data/live in your phones web browser while the app is in the background. If that doesn't work please provide your exact phone model and the app version you are using.

roefy commented 2 years ago

Is "Enable UDP online values" enabled? Maybe the developer mode is therefore necessary? I don't know if I may share that info.

gwaldvogel commented 2 years ago

Is "Enable UDP online values" enabled? Maybe the developer mode is therefore necessary? I don't know if I may share that info.

In earlier versions of the testo Smart this was still required, as of a few months ago these two features have been decoupled and you do not need to enable this feature anymore.

andreasharbo commented 2 years ago

I get a ERR_CONNECTION_REFUSED in my phones webbrowser.

My phone: OnePlus Nord2 5G, Android 11, OxygenOS V11.3 My testo Smart app: 6.19.0.5861

I should say that currently no devices are connected to the app, and no measurements are being made. I'm just investigating the possibilities.

Is it necessary to have devices connected, before the API is exposed?

gwaldvogel commented 2 years ago

My testo Smart app: 6.19.0.5861

Ah, this is the problem. You are using the old testo Smart Probes app. For this API you need to install the successor app which is just called testo Smart. This is the recommended app to use for most testo devices now. You can download it from Google Play: https://play.google.com/store/apps/details?id=de.testo.smartprobesappgen2&hl=en&gl=US

andreasharbo commented 2 years ago

I am sure this will help me a lot, thank you.

I will let you know what I come up with :)

andreasharbo commented 2 years ago

Hello again

I got some probes now, and it works very well. Very smooth probe/app experience so far.

{'46266212': {'DeviceId': 'T410i',
              'Serial': '46266212',
              'Temperature': '26,7°C',
              'Velocity': '0,00m/s'},
 '46323539': {'AbsHumidity': '21,42g/m³',
              'AirTemperature': '28,2°C',
              'DeviceId': 'T605i',
              'DewPointTemperature': '23,9°C',
              'Humidity': '77,8%RH',
              'Serial': '46323539',
              'WetBulbTemperature': '25,0°C'},
 'AppVersion': '15.7.13.63980'}

Now I have configured, in the app, a measurement of temperature difference between the two probes. Can I somehow retrieve this measurement with the live data as well?

Cheers

gwaldvogel commented 2 years ago

Can I somehow retrieve this measurement with the live data as well?

Currently the live endpoint only exports device data, no measurement application specific data (e.g. differential temperature, etc.) is available. Is this something you need for your application? If you give me bit more context (relevant data, measurement application, etc. - the more info the better) I can file a feature request for you and we can check if we can include this feature in a future release.

andreasharbo commented 2 years ago

Alright, I'm not exactly sure what the application is at the moment, so I cant relay more information.

We can solve the problem on our end for now, but when I know more I will make a new issue here :)

Thank you for the help so far!

andreasharbo commented 1 year ago

Hi

Coming back to this issue, due to updates in the Testo Smart app. The JSON keys have changed between versions.

So my question is how is it going with documentation of the returned data for the different porbes :) That way i can keep my app supporting your probes.

Thanks