daily live reading in index

Talks about metering
giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

daily live reading in index

Post by giulio » Mon Apr 29, 2019 6:59 pm

Hi!
Is it possible to have the daily reading live as in the dashboard on the index page of a water meter, inserting a reqsdm command?
thank you

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

Re: daily live reading in index

Post by jeanmarc » Mon Apr 29, 2019 7:35 pm

Hi,
If you meter is able to return a live value (eg. liters/min) you can use the 'value mode'.
If not (like mine) you can use 'State mode'. You com app should then return a 1 if there is a pulse lately. In my case I set it to 1 during 8 sec if there is a pulse.

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

Re: daily live reading in index

Post by jeanmarc » Tue Apr 30, 2019 8:24 am

I've been thinking during the night.. If you can count the time between 2 pulses, you can also get a live value (like i previously did with my elctrical S0 meter).
If say, the time is 1 sec that mean 60l/min, 2" 30l/m, 4" 15l/min, 8" 7,5l/min, .. above let's say 120" return 0.5l/min and 0 after few seconds.
I shall give it a try with my arduino.

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: daily live reading in index

Post by giulio » Wed May 01, 2019 9:47 am

thanks jeanmarc
I asked the question the wrong way
I already have the live value of my sensor using YOUR "req_espeasy.php"

I would just like to have the daily value of the sensor I read in the dashboard, even on the index page.

with the command "reqsdm total" I get the total value of my espeasy, but to avoid the daily value I have to restart espeasy every day at 00:01
while in the dashboard the daily value is of the virtual counter



sorry if I asked the wrong question first

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

Re: daily live reading in index

Post by jeanmarc » Wed May 01, 2019 4:51 pm

No problem, you give me an idea for my arduino ;)
You can create a script that return daily value, check com apps examples/automation/day_script.php it almost fit to your need.

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: daily live reading in index

Post by giulio » Wed May 01, 2019 9:17 pm


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

Re: daily live reading in index

Post by jeanmarc » Thu May 02, 2019 7:04 am

Give it a try : dayval.php

Code: Select all

#!/usr/bin/php
<?php
// A simple script to show daily value.

$MNDIR  = '/srv/http/metern'; // Path to meterN
$METNUM = 1; // meter number

// No edit should be needed bellow
if (isset($_SERVER['REMOTE_ADDR'])) {
    die('Direct access not permitted');
}
define('checkaccess', TRUE);
include("$MNDIR/config/config_main.php");
include("$MNDIR/config/config_met$METNUM.php");
include("$MNDIR/config/memory.php");

if (file_exists($MEMORY)) {
    $data  = file_get_contents($MEMORY);
    $array = json_decode($data, true);
    
    if (isset($array["First$METNUM"]) && isset($array["Last$METNUM"])) {
        if ($array["First$METNUM"] <= $array["Last$METNUM"]) {
            $val = $array["Last$METNUM"] - $array["First$METNUM"];
        } else { // counter pass over
            $val = $array["Last$METNUM"] + ${'PASSO' . $METNUM} - $array["First$METNUM"];
        }
        $outstr = utf8_decode("${'ID'.$METNUM}($val*${'UNIT'.$METNUM})\n");
        echo "$outstr";
    } else {
        die("Abording: Missing first or last value\n");
    }
    
} else {
    die("Abording: Empty $MEMORY\n");
}
?>

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: daily live reading in index

Post by giulio » Thu May 09, 2019 1:36 pm

Hello
I tried dayval.php..ok it works and returns the correct value

Now I would like to insert the value into Indicator (s) configuration (Not logged)
... but I couldn't configure reqsdm.php

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

Re: daily live reading in index

Post by jeanmarc » Thu May 09, 2019 2:43 pm

ln -s /srv/http/comapps/dayval.php /usr/bin/dayval
chmox+ dayval.php
request 'dayval' command from Indicator (s) configuration :lol:

giulio
Posts: 36
Joined: Tue Aug 28, 2018 1:37 pm

Re: daily live reading in index

Post by giulio » Thu May 09, 2019 3:23 pm

ln -s /srv/http/comapps/dayval.php / usr / bin / dayval >> OK
chmod + x dayval.php >> OK
but in the script "reqsdm.php" I don't know what to write

I'm sorry, I try but I'm inexperienced

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests