Page 1 of 1

Get temperature

Posted: Fri Feb 04, 2022 3:41 pm
by matteolucarelli
Hi,
with Scarlet and libvisiontransfer how can I read the temperatures available in the web interface?

Re: Get temperature

Posted: Mon Feb 07, 2022 11:19 am
by k.schauwecker
Unfortunately the device temperature is currently not accessible through libvisiontransfer but only through the web interface. Would it be an option for you to automatically query the web interface? This could be done e.g. through curl. We can add this feature to our TODO list.

Re: Get temperature

Posted: Mon Feb 07, 2022 2:25 pm
by matteolucarelli
Curl could be an option if no other can do the trick
But I suggest you to add the feature in next updates

which url can be used?

Re: Get temperature

Posted: Mon Feb 07, 2022 3:39 pm
by k.schauwecker
If you use the default IP then the URL should be
http://192.168.10.10/status

You can try the following script:

Code: Select all

curl http://192.168.10.10/status/ 2>&1 | \
                grep -A1 temperature | grep span | \
                sed -e 's/^ *<td>[^>]*>\([^\ ]*\)\ .*/\1/'

Re: Get temperature

Posted: Mon Feb 07, 2022 4:01 pm
by matteolucarelli
Is the www API documented somewhere?

Re: Get temperature

Posted: Mon Feb 07, 2022 4:25 pm
by k.schauwecker
This is not an offical API but just the regular web interface. The script that I posted does the following:

1. It downloads the status page of the web interface (the first page you see when opening the web interface in your browser)
2. Using grep, it searches for the word "temperature" in the HTML code and outputs this line and the following. The resulting HTML code will look something like this:

Code: Select all

 <td>SoC temperature: </td>
 <td><span class="value_good">50.0 °C</span></td>
3. It extracts the value (50.0) from the HTML code by calling sed