You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my $s = $h->prepare(q/insert into home_electricity (unixtime, watts) values(?,?)/);
foreach (@files) {
open(my $fd, "<", $_) or die "failed to open $ARGV[0]";
while(<$fd>) {
my @values = split(',', $_);
$s->execute($values[0], $values[1]);
}
close $fd;
}
$s = q|select sum(watts) as watts, sum(watts) / 1000 * 0.1617 as cost, convert(varchar(10), dateadd(ss,unixtime,'1970-01-01'), 103) as "date" from home_electricity group by convert(varchar(10), dateadd(ss,unixtime,'1970-01-01'), 103)|;