reqsdm to have state of GPIO

Talks about metering
Post Reply
megamarco83
Posts: 27
Joined: Tue Apr 14, 2015 9:25 am

reqsdm to have state of GPIO

Post by megamarco83 » Sat Mar 11, 2017 6:44 pm

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

jeanmarc
Posts: 1334
Joined: Thu Aug 29, 2013 7:16 am

Re: reqsdm to have state of GPIO

Post by jeanmarc » Sun Mar 12, 2017 8:50 am

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.

megamarco83
Posts: 27
Joined: Tue Apr 14, 2015 9:25 am

Re: reqsdm to have state of GPIO

Post by megamarco83 » Mon Mar 13, 2017 6:07 pm

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 :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest