Some cleanup
Former-commit-id: ce7c102582a25756784b6a230a8654af6e965c77
This commit is contained in:
parent
2aa2c76025
commit
6dbaff4444
5 changed files with 5 additions and 21 deletions
BIN
hal.db
BIN
hal.db
Binary file not shown.
|
|
@ -8,14 +8,10 @@ import se.koc.hal.plugin.tellstick.TellstickProtocol;
|
|||
import se.koc.hal.plugin.tellstick.TellstickSerialComm;
|
||||
import se.koc.hal.plugin.tellstick.protocols.NexaSelfLearning;
|
||||
import se.koc.hal.struct.Switch;
|
||||
import se.koc.hal.stt.GoogleSTTClient;
|
||||
import se.koc.hal.intf.HalSpeachToText;
|
||||
import se.koc.hal.stt.ManualSTTClient;
|
||||
import se.koc.hal.stt.Sphinx4STTClient;
|
||||
import se.koc.hal.tts.MaryRemoteTTSClient;
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import se.koc.hal.deamon.HalDaemon;
|
|||
import se.koc.hal.page.PCConfigureHttpPage;
|
||||
import se.koc.hal.page.PCHeatMapHttpPage;
|
||||
import se.koc.hal.page.PCOverviewHttpPage;
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.log.CompactLogFormatter;
|
||||
import zutil.log.LogUtil;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package se.koc.hal.deamon;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
|
@ -38,26 +37,17 @@ public class DataAggregatorDaemon extends TimerTask implements HalDaemon {
|
|||
@Override
|
||||
public void run(){
|
||||
try {
|
||||
List<Integer> sensorIdList = HalContext.db.exec("SELECT id FROM sensor", new SQLResultHandler<List<Integer>>(){
|
||||
@Override
|
||||
public List<Integer> handleQueryResult(Statement stmt, ResultSet result) throws SQLException {
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
while(result.next()){
|
||||
list.add(result.getInt("id"));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
});
|
||||
for(int id : sensorIdList){
|
||||
logger.fine("Aggregating sensor_id: " + id);
|
||||
aggregateSensor(id);
|
||||
List<Sensor> sensorList = Sensor.getLocalSensors(HalContext.db);
|
||||
for(Sensor sensor : sensorList){
|
||||
logger.fine("Aggregating sensor_id: " + sensor.getId());
|
||||
aggregateSensor(sensor.getId());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void aggregateSensor(int sensorId) {
|
||||
public void aggregateSensor(long sensorId) {
|
||||
DBConnection db = HalContext.db;
|
||||
try {
|
||||
Long maxDBTimestamp = db.exec("SELECT MAX(timestamp_end) FROM sensor_data_aggr WHERE sensor_id == "+sensorId, new SimpleSQLHandler<Long>());
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import java.sql.ResultSet;
|
|||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue