Poi:
mysql> use measure_it;
mysql> use measure_it;
mysql -u measureit measure_it -p
SELECT SUM(MEDIA * (300 / 3600)) AS WH FROM ( SELECT AVG(VALORE) AS MEDIA ,ORA ,MINUTO FROM ( SELECT DATA AS VALORE ,TIME ,(EXTRACT(MINUTE FROM TIME) DIV 5 ) * 5 AS MINUTO ,EXTRACT(HOUR FROM TIME) AS ORA FROM `measure_watt` WHERE SENSOR = 9 AND DATE(TIME)=DATE(UTC_DATE()) ) AS MEDIA GROUP BY ORA,MINUTO ) AS MEDIA_W;
giorno | pvoutput | query |
2014-02-17 | 6809 | 6579.66079035 |
2014-02-18 | 9763 | 9451.09023720 |
SELECT UNIX_TIMESTAMP(CONCAT(GIORNO, CONCAT(' ', MAKETIME(ORA,MINUTO,0)))) AS TEMPO ,MEDIA AS MEDIA_W FROM ( SELECT AVG(VALORE) AS MEDIA ,ORA ,MINUTO ,GIORNO FROM ( SELECT DATA AS VALORE ,TIME ,(EXTRACT(MINUTE FROM TIME) DIV 5 ) * 5 AS MINUTO ,EXTRACT(HOUR FROM TIME) AS ORA ,DATE(TIME) GIORNO FROM `measure_watt` WHERE SENSOR = 9 AND DATE(TIME)=DATE(UTC_DATE()) ) AS MEDIA GROUP BY GIORNO,ORA,MINUTO ) AS W;
$URL_pvoutput = 'http://pvoutput.org/service/r2/getstatus.jsp?h=1&limit=1&sid=...&key=...&d=' . date("Ymd");
$data_cons = file_get_contents($URL_pvoutput);
$array_cons = preg_split('/,/', $data_cons);
$kwh_cons = $array_cons[7];
$URL_pvoutput = 'http://pvoutput.org/service/r2/getstatus.jsp?h=1&limit=1&sid=...&key=...&d=' . date("Ymd");
$data_cons = file_get_contents($URL_pvoutput);
$array_cons = preg_split('/,/', $data_cons);
$kwh_cons = $array_cons[7];
date("Ymd") cosa dovrei mettere per il giorno in corso? TODAY?
root@Pogoplug:~# php -r "echo date('Ymd');" ; echo "" 20140219
$URL_pvoutput = 'http://pvoutput.org/service/r2/getstatus.jsp?h=1&limit=1&sid=...&key=...&d=' . date("Ymd");
$data_cons = file_get_contents($URL_pvoutput);
$array_cons = preg_split('/,/', $data_cons);
$kwh_cons = $array_cons[7];
$.getJSON('programs/programday.php', { invtnum: invtnum }, function(JSONResponse) {
$.getJSON('http://ip_raspberry/php/leggi_kwh.php', function(JSONResponse) {
http://IP_RASPBERRY/php/measureit_functions.php?do=summary_sensor&sensor=9&timeframe=limit&unit=DAY&unit_return=timeframe&unit_value=1&table=measure_watt&limit=2014-02-18 23:59:59
http://IP_RASPBERRY/php/measureit_functions.php?do=summary_sensor&sensor=9&timeframe=limit&unit=DAY&unit_return=timeframe&unit_value=1&table=measure_watt&limit=2014-02-18 23:59:59
&callback=?
http://IP_RASPBERRY/php/measureit_functions.php?do=summary_sensor&sensor=9&timeframe=limit&unit=DAY&unit_return=timeframe&unit_value=1&table=measure_watt&limit=2014-02-21 23:59:59&callback=?
SELECT UNIX_TIMESTAMP(CONCAT(GIORNO, CONCAT(' ', MAKETIME(ORA,MINUTO,0)))) AS TEMPO ,MEDIA AS MEDIA_W FROM ( SELECT AVG(VALORE) AS MEDIA ,ORA ,MINUTO ,GIORNO FROM ( SELECT DATA AS VALORE ,TIME ,(EXTRACT(MINUTE FROM TIME) DIV 5 ) * 5 AS MINUTO ,EXTRACT(HOUR FROM TIME) AS ORA ,DATE(TIME) GIORNO FROM `measure_watt` WHERE SENSOR = 0 AND DATE(TIME)=DATE(UTC_DATE()) ) AS MEDIA GROUP BY GIORNO,ORA,MINUTO ) AS W;
$.getJSON('http://192.168.1.9/php/measureit_functions.php?do=summary_sensor&sensor=9&timeframe=limit&unit=DAY&unit_return=timeframe&unit_value=1&table=measure_watt&limit=2014-02-21 23:59:59&callback=?', function(JSONResponse) {options1.series = JSONResponse.data; Mychart1 = new Highcharts.Chart(options1); Mychart1.setTitle({text: JSONResponse.title}, {text: JSONResponse.subtitle}); Mychart1.hideLoading(); });
Commenta