meterN 0.8

Talks about metering
NevD
Posts: 136
Joined: Tue Mar 11, 2014 12:22 am

Re: meterN 0.8

Post by NevD » Mon Jan 23, 2017 10:32 pm

HI

Here is results

pi@raspberrypi /etc $ ls -al /etc/localtime
-rw-r--r-- 1 root root 426 Jun 15 2015 /etc/localtime
pi@raspberrypi /etc $

pi@raspberrypi /etc $ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 7
Please select one of the following time zone regions.
1) Lord Howe Island 8) Queensland - most locations
2) Macquarie Island 9) Queensland - Holiday Islands
3) Tasmania - most locations 10) South Australia
4) Tasmania - King Island 11) Northern Territory
5) Victoria 12) Western Australia - most locations
6) New South Wales - most locations 13) Western Australia - Eucla area
7) New South Wales - Yancowinna
#? 8

The following information has been given:

Australia
Queensland - most locations

Therefore TZ='Australia/Brisbane' will be used.
Local time is now: Tue Jan 24 07:28:01 AEST 2017.
Universal Time is now: Mon Jan 23 21:28:01 UTC 2017.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
TZ='Australia/Brisbane'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Australia/Brisbane
pi@raspberrypi /etc $


This is when system working OK using testTD.php

GMT it is 20170123, yesterday was 20170122
Australia/Brisbane it is 20170123, yesterday was 20170122


This at 0720hrs 24 Jan local time AND graph is faulty

GMT it is 20170123, yesterday was 20170122
Australia/Brisbane it is 20170124, yesterday was 20170123

? should the localtime file be updated when doing TZ it shows same last mod date time after doing TZ?

Neville

escix
Posts: 19
Joined: Sun Sep 01, 2013 6:22 am

Re: meterN 0.8

Post by escix » Tue Jan 24, 2017 3:38 am

Nev, Mate,

add this

Code: Select all

date_default_timezone_set($DTZ); 
line in programs/programmeter.php just after the

Code: Select all

//yesterday
and before

Code: Select all

$yesterday = date('Ymd', time() - 60 * 60 * 24);
and this

Code: Select all

date_default_timezone_set('GMT');
after

Code: Select all

$yesterday = date('Ymd', time() - 60 * 60 * 24); 
so it will be look like:

Code: Select all

    // Yesterday
date_default_timezone_set($DTZ); //<---added new line
    $yesterday = date('Ymd', time() - 60 * 60 * 24);

date_default_timezone_set('GMT'); //<---added new line
    if ($contalines < 290 && file_exists($dir . "$yesterday.csv")) {
        $file = file($dir . "$yesterday.csv");

        $contalines2  = count($file) - 1;
        $prevyear     = substr($output[$cnt - 2], -12, 4);
        $prevmonth    = substr($output[$cnt - 2], -8, 2);
        $prevday      = substr($output[$cnt - 2], -6, 2);

NevD
Posts: 136
Joined: Tue Mar 11, 2014 12:22 am

Re: meterN 0.8

Post by NevD » Tue Jan 24, 2017 5:26 am

OK done that...restarted metern still working:) now have to wait until tomorrow to see results.

Thanks for the input

Neville

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

Re: meterN 0.8

Post by jeanmarc » Tue Jan 24, 2017 8:47 am

That should do the trick, thanks escix ;)

NevD
Posts: 136
Joined: Tue Mar 11, 2014 12:22 am

Re: meterN 0.8

Post by NevD » Tue Jan 24, 2017 9:10 pm

Just checked and the graph looks good.

Thanks

Neville

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

Re: meterN 0.8

Post by megamarco83 » Tue Feb 28, 2017 4:25 pm

Ciao Jeanmarc, as discussed previously in another post, i finally tryed to update my metern 0.8.2.7 that was working with virtmet to metern 0.8.3.2
the update works well also adapting with reqsdm to calling DS device, SDM device and so on...
the problem is that virtmet is no working.
the problem i think that is in /metern/scripts/metern.php
with the last version of metern 0.8.2.7, to use virtmet, i do in this way:

Code: Select all

cd /var/www/metern/scripts
mv metern.php metern.php.old
wget https://raw.githubusercontent.com/The-Drake/virtmet/master/metern/0.8/scripts/metern.php

cd /var/www/metern/comapps
sudo mv virtmet-F123.php virtmet-F123.php.old
wget https://raw.githubusercontent.com/The-Drake/virtmet/master/virtmet-F123.php
sudo chmod +x virtmet-F123.php
sudo rm /usr/local/bin/virtmet-F123
sudo ln -s /var/www/metern/comapps/virtmet-F123.php /usr/local/bin/virtmet-F123
but for sure using the old metern.php on metern version 0.8.3.2 is not working (i tryed just to verify, and if i use the metern.php "taking from wget" the live display is stopped)

the second issue is for /metern/programs/meter.php

Code: Select all

<?php
// Credit Louviaux Jean-Marc 2015
define('checkaccess', TRUE);
include('../config/config_main.php');
include('../scripts/memory.php');
date_default_timezone_set($DTZ);

$dir    = '../data/csv/';
$output = glob($dir . '/*.csv');
rsort($output);

@$shmid = shmop_open($LIVEMEMORY, 'a', 0, 0);
if (!empty($shmid) && isset($output[0])) {
    $size = shmop_size($shmid);
    shmop_close($shmid);
    $shmid = shmop_open($LIVEMEMORY, 'c', 0644, $size);
    $memdata  = shmop_read($shmid, 0, $size);
    $live = json_decode($memdata, true);
    shmop_close($shmid);

    //echo "MEMORY = $MEMORY\n";
    @$shmid = shmop_open($MEMORY, 'a', 0, 0);
    if (!empty($shmid)) {
        $size = shmop_size($shmid);
        shmop_close($shmid);
        $shmid = shmop_open($MEMORY, 'c', 0644, $size);
        $memdata  = shmop_read($shmid, 0, $size);
        $memory = json_decode($memdata, true);
        shmop_close($shmid);

        $array = array();

        //var_dump($memory);
        $array = array();
        for ($i = 1; $i <= $NUMMETER; $i++) {
            include("../config/config_met$i.php");

            if (${'TYPE' . $i} == 'Elect') {
                $val_mid = $memory["Midnight$i"];
                settype($val_mid, 'integer');
                //echo "val_mid $i: $val_mid\n";
                $val_tot = $memory["Totalcounter$i"];
                settype($val_tot, 'integer');
                //echo "val_tot $i: $val_tot\n";
                $val_today = $val_tot - $val_mid;
                //echo "val_today $i: $val_today\n";
                $val_today /= 1000;
                $array["${'METNAME'.$i}$i"] = array("KW" => $live["${'METNAME'.$i}$i"], "KWH" => round($val_today,${'PRECI' . $i}));
            }
        }
    }
} else {
    for ($i = 1; $i <= $NUMMETER; $i++) {
        include("../config/config_met$i.php");

        $array["${'METNAME'.$i}$i"] = array("KW" => 0, "KWH" => 0);
    }
}

header("Content-type: text/json");
echo json_encode($array);
?>
that meter.php is used to import in 123solar the consumption and switch on/off a load when i have enought production.

thanks so much for help and this mess :)

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

Re: meterN 0.8

Post by jeanmarc » Tue Feb 28, 2017 5:42 pm

hmm dude.. mind that i am not going to rewrite virtmet :? i am surely ok to help and explain (again) how to write a virtual meter, like pooltot or houseenergy. Also, that's another topic.

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

Re: meterN 0.8

Post by megamarco83 » Tue Feb 28, 2017 7:25 pm

Hi JM, yes, i understand completly what you mean!
i think that virtmet should be rewrite to match the new code of metern...i'm not able do to, and for sure i wouldn't ask to you to do that :)
but we was talking about i still have 0.8.2.7 and i explain that the reason behing is because that is the last version where i was able to adapt virtmet :D
if i use a new virtual meter, to have consumption split on two different time during a day i have to start counting from zero?
last question: the /metern/program/meter.php that i use to export consumption in 123solar is also to completly rewrite?
yesterday i tested mine, but didn't work after upgare to last version
thanks for sugestion!
Regards

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

Re: meterN 0.8

Post by jeanmarc » Tue Feb 28, 2017 7:58 pm

megamarco83 wrote:
Tue Feb 28, 2017 7:25 pm
if i use a new virtual meter, to have consumption split on two different time during a day i have to start counting from zero?
No check "retrieve values in last csv" in examples.
last question: the /metern/program/meter.php that i use to export consumption in 123solar is also to completly rewrite?
It is rewrited, but better use "pool123s"

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

Re: meterN 0.8

Post by jeanmarc » Sat Jul 29, 2017 10:30 am

Hello,

meterN0.8.3.3 is out

- Bug sensor yaxis start from 0
- Bug don't showed yesterday values if restarted/started
- Review today production in comparison/reading
- Detailled show daily values
- Merged Clean up events log Purging 1 detailed csv
- Updated JS libs
- Other minor clean up

Bye

stats: There have been 559 downloads of metern0.8.3.2.tar.gz

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest