

Flane ha scritto:Dalla versione 1.2 di MeterN (che io non ho ancora installato), JeanMarc ha introdotto una modifica circa lo status e qui descrive come modificare gli script.
https://123solar.org/phpBB/viewtopic.ph ... t=20#p4414
Lo script che genera il file txt con la lettura deve essere modificato come indicato sopra, per non inserire più 1 o 0 ma On o Off
Codice: Seleziona tutto
6(<font color="#8B0000">Off</font>*X)
Codice: Seleziona tutto
6(<font color="#228B22">On</font>*X)
Flane ha scritto:Questo è un esempio di quello che ci deve essere nel file txt (per il meter n. 6) per avere la scritta Off di colore rossoCodice: Seleziona tutto
6(<font color="#8B0000">Off</font>*X)
e la scritta ON di colore verdeCodice: Seleziona tutto
6(<font color="#228B22">On</font>*X)
Purtroppo non uso più questo script e non ricordo dove andare esattamente a modificare.
Codice: Seleziona tutto
#!/usr/bin/php
<?php
// This script will output a meterN compatible format for the main or live command
// You'll need to setup correct permission
// chmod +x reqsdm.php
// then
// ln -s /var/www/comapps/reqsdm.php /usr/local/bin/reqsdm
// Request command with 'reqsdm tensione' or 'reqsdm corrente' or ......
if (isset($_SERVER['REMOTE_ADDR'])) {
die('Direct access not permitted');
}
if (!isset($argv[1])) {
die("Abording: no valid argument given.\n");
} elseif ($argv[1] == 'tensione') {
$outstr = exec('cat /dev/shm/metern2.txt | egrep "^2_1\(" | grep "*V)"');
} elseif ($argv[1] == 'corrente') {
$outstr = exec('cat /dev/shm/metern2.txt | egrep "^2_2\(" | grep "*A)"');
} elseif ($argv[1] == 'freq') {
$outstr = exec('cat /dev/shm/metern2.txt | egrep "^2_3\(" | grep "*Hz)"');
} elseif ($argv[1] == 'cospi') {
$outstr = exec('cat /dev/shm/metern2.txt | egrep "^2_4\(" | grep "*F)"');
} elseif ($argv[1] == 'boiler-status') {
$outstr1 = exec('echo "pwm_ssr_dimmer("`pgrep -c pwm_ssr_dimmer`"*X)"');
if ($outstr1 == 'pwm_ssr_dimmer(0*X)') {
$outstr = ('pwm_ssr_dimmer(<font color=\'#b00202\'>SPENTO</font>*X")');
} else {
$outstr = ('pwm_ssr_dimmer(<font color=\'#0a8c0a\'>ACCESO</font>*X)');
}
} elseif ($argv[1] == 'boiler-live') {
$outstr = exec('cat /dev/shm/boiler11.txt | egrep "^11\(" | grep "*W)"');
} elseif ($argv[1] == 'boiler-main') {
$outstr = exec('cat /dev/shm/boiler11.txt | egrep "^11\(" | grep "*Wh)"');
} elseif ($argv[1] == 'resistenza') {
$outstr2 = exec('cat /dev/shm/boiler11.txt | egrep "^11_1\(" | grep "*%)"');
if ($outstr2 == '11_1(0*%)') {
$outstr = ('11_1(<font color=\>0</font>*%)');
} else {
$outstr = exec('cat /dev/shm/boiler11.txt | egrep "^11_1\(" | grep "*%)"');
}
} elseif ($argv[1] == 'cpu-temp') {
$outstr = exec('cat /sys/class/thermal/thermal_zone0/temp');
$outstr = $outstr/1000;
$outstr = "cpu($outstr*°C)";
// and so on ....
} else {
die("Usage: reqsdm (tensione|corrente|freq|cospi|boiler-status|boiler-live|boiler-main|resistenza|cpu-temp)\n");
}
echo "$outstr";
?>
cd /home/pi
git clone https://github.com/timofurrer/w1thermsensor.git
cd w1thermsensor/
sudo python setup.py install
root@raspberrypi:/home/pi/w1thermsensor# python setup.py build
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from pathlib import Path
ImportError: No module named pathlib
Visitano il forum: Nessuno e 2 ospiti