.echo on
.headers on
.mode column
--.system ls -lha /dev/ttyU*
.system ls -lha /dev/ttyG*

-- init.sql
--select load_extension('libsqlitefunctions.so');


.open 'ramdisk/aiox.db'
PRAGMA main.quick_check; 

--attach 'ssmppt15l.db' as ssd;
--PRAGMA ssd.quick_check; 

select load_extension('libsqlitefunctions.so');  --x86_64
--select load_extension('/usr/lib/arm/libsqlitefunctions.so');  --arm
--select load_extension('/usr/lib/arm-linux-gnueabihf/libsqlitefunctions.so');  --rpi
--select load_extension('/usr/lib/x86_64-linux-gnu/libsqlitefunctions.so');       --amd64
select 'test', floor(12.34);

.databases
.tables
.show
.schema
--============================================================Begin Dashboard

--Box 1 - big box on left- Top row,then Columns left to right and Rows top to bottom
select  dt, systemstatusid as ss, Ppv1 as 'Solar:', AC_InWatt as 'Import:', OP_Watt as 'Consumption Power:', Bat_Watt as 'Dis(Charge) +(-)'  from ir order by dt desc limit 7;
--Box 2 - Top middle
select 'Solar' dt, Epv1_today, Epv1_total from ir order by dt desc limit 7;
--Top Right
select 'Discharged', dt, Ebat_dischrToday as Today, Ebat_dischrTotal as Total from ir order by dt desc limit 7;
--Bottom 1/3
select 'Charged', dt, Epv1_today + Eac_chrToday, Epv1_total + Eac_chrTotal from ir order by dt desc limit 7;
--Bottom 2/3
select 'Imported from Grid', dt, Eac_chrToday + Eac_dischrToday, Eac_chrTotal + Eac_dischrTotal from ir order by dt desc limit 7;
--Bottom 3/3
select 'Load Consumption', dt, Eop_dischrToday, Eop_dischrTotal from ir order by dt desc limit 7;
--============================================================End Dashboard
--================================================Begin Energy Trend=============
--select  dt,  Ppv1 as 'Solar:', AC_InWatt as 'Import:', OP_Watt as 'Consumption Power:'  from ir  where date(dt) = (select date(max(dt)) from ir);
--================================================End Energy Trend=============

.mode line
select * from hr order by dt desc limit 1;
select * from ir order by dt desc limit 1;

select '<<<END>>>';

