Page 1 of 1

reqsdm to have state of GPIO

Posted: Sat Mar 11, 2017 6:44 pm
by megamarco83
Hi, with this command:

Code: Select all

pi@raspberrypi ~ $ sudo cat /sys/class/gpio/gpio17/value
0
i obtain the status of GPIO 17
so i create the reqsdm like that:

Code: Select all

	  } elseif ($argv[1] == 'stato_pompa') { //stato on/off pompa riscaldamento
         $outstr =  exec('cat /sys/class/gpio/gpio17/value');
		 $outstr = "pompa($outstr*X)";
and if i use:

Code: Select all

pi@raspberrypi ~ $ reqsdm stato_pompa
pompa(0*X)
so it works well

now on meterN i create a log metern like that:
name= pompa
meterID= pompa
type = sensor
command = reqsdm stato_pompa
and in dashboard live pooling
meterID = pompa
mode= state
live command= reqsdm stato_pompa

but if i run the command test i receve (in both cases: command and command live)
is not valid, the correct format is pompa(1234.5*)

how i can monitorize the status of ON/OFF of GPIO ?
thanks so mutch

Re: reqsdm to have state of GPIO

Posted: Sun Mar 12, 2017 8:50 am
by jeanmarc
Hi,
Please always use lastest version of mN (it have more detailled ouput return).
You may enable debug and check the log, you could also check your webserver's error log if available.

Re: reqsdm to have state of GPIO

Posted: Mon Mar 13, 2017 6:07 pm
by megamarco83
hi JM i used this escamotage: using command of wiringpi
for example with editing reqsdm.php:

Code: Select all

	  } elseif ($argv[1] == 'stato_pompa') { //stato on/off pompa riscaldamento pin wiringpi 0 -> GPIO17
         $outstr =  exec('gpio read 0');
        $outstr = "pompa($outstr*X)";
i report the solution, maybe is usefull for someone :)