just to replace my sed skills by regular PHP, there is of course a more
sophisticated method available in pure PHP:
<?php
$cpu_temp = exec ('cat /sys/class/thermal/thermal_zone0/temp')/1000;
$cpu_temp = number_format($cpu_temp , 1 , '.' , ',');
?>
although I am glad to know the sed thing.
Am Freitag, 21. Februar 2020 21:54:20 UTC+1 schrieb Vetti52:
>
> I am using interceptor.py.
>
> Meanwhile I could realise it with PHP, thanks to your input:
>
> <?php
> $cpu_temp = exec ('cat /sys/class/thermal/thermal_zone0/temp|sed
> "s/\([0-9]\{2\}\)\([0-9]\{3\}\)/\1.\2/"');
> ?>
>
> However, it seems, that the thermal_zone0/temp value differs somewhat
> from the result of vcgencmd measure_temp
>
> I don't care about the three decimals, but that might be solved either by
> simply cutting it in the sed pipe or by adding another piping e.g. | awk
> '{printf "%.1f", $1}
>
> And, of course, I had to enable php snippets in html by inserting this
> line into lighttpd.conf:
>
> fastcgi.map-extensions = ( ".htm" => ".php", ".html" => ".php")
>
> and then I placed the value into the hardware widged:
>
> <tr>
> <td class="label">CPU temperature</td>
> <td class="data"><?PHP echo "$cpu_temp"; ?> °C</td>
> </tr>
>
> that's it!
> Thanks a lot!
>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/weewx-user/f72d24dd-da50-41c0-8a35-adffa0dc104a%40googlegroups.com.