Get temperature

Post Reply
matteolucarelli
Posts: 20
Joined: Fri Feb 04, 2022 3:32 pm

Get temperature

Post by matteolucarelli »

Hi,
with Scarlet and libvisiontransfer how can I read the temperatures available in the web interface?
k.schauwecker
Posts: 123
Joined: Mon Mar 25, 2019 1:12 pm

Re: Get temperature

Post 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.
matteolucarelli
Posts: 20
Joined: Fri Feb 04, 2022 3:32 pm

Re: Get temperature

Post 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?
k.schauwecker
Posts: 123
Joined: Mon Mar 25, 2019 1:12 pm

Re: Get temperature

Post 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/'
matteolucarelli
Posts: 20
Joined: Fri Feb 04, 2022 3:32 pm

Re: Get temperature

Post by matteolucarelli »

Is the www API documented somewhere?
k.schauwecker
Posts: 123
Joined: Mon Mar 25, 2019 1:12 pm

Re: Get temperature

Post 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
Post Reply