Keep track of peak production, peak consumption, peak from grid, and peak to grid values to aid in solar panel and storage sizing.

This commit is contained in:
MarkBryanMilligan
2021-09-07 22:56:22 -05:00
parent d63f6df1fd
commit 0cfdaaa272
12 changed files with 209 additions and 26 deletions

View File

@@ -0,0 +1,26 @@
package com.lanternsoftware.currentmonitor.servlet;
import com.lanternsoftware.currentmonitor.context.Globals;
import com.lanternsoftware.datamodel.currentmonitor.Account;
import com.lanternsoftware.util.dao.DaoSerializer;
import com.lanternsoftware.util.dao.auth.AuthCode;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/rebuildSummaries")
public class RebuildSummariesServlet extends SecureServlet {
@Override
protected void get(AuthCode _authCode, HttpServletRequest _req, HttpServletResponse _rep) {
if (_authCode.getAccountId() == 100) {
for (String sId : Globals.dao.getProxy().queryForField(Account.class, null, "_id")) {
int id = DaoSerializer.toInteger(sId);
if (id != 0)
Globals.dao.rebuildSummariesAsync(id);
}
}
else
_rep.setStatus(401);
}
}

View File

@@ -1,10 +1,10 @@
package com.lanternsoftware.currentmonitor;
import com.lanternsoftware.datamodel.currentmonitor.AuthCode;
import com.lanternsoftware.util.LanternFiles;
import com.lanternsoftware.util.ResourceLoader;
import com.lanternsoftware.util.cryptography.AESTool;
import com.lanternsoftware.util.dao.DaoSerializer;
import com.lanternsoftware.util.dao.auth.AuthCode;
public class CreateAuthCode {
private static final AESTool aes = new AESTool(ResourceLoader.loadFile(LanternFiles.OPS_PATH + "authKey.dat"));

View File

@@ -0,0 +1,16 @@
package com.lanternsoftware.currentmonitor;
import com.lanternsoftware.util.http.HttpPool;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
public class RebuildSummariesRemote {
public static void main(String[] args) {
HttpPool pool = new HttpPool(10, 10, 10000, 10000, 10000);
HttpGet r = new HttpGet("https://lanternpowermonitor.com/currentmonitor/rebuildSummaries");
r.addHeader("auth_code", "<redacted>");
CloseableHttpResponse resp = pool.execute(r);
System.out.println(resp.getStatusLine().getStatusCode());
pool.shutdown();
}
}