mirror of
https://github.com/zyphlar/LanternPowerMonitor.git
synced 2024-03-08 14:07:47 +00:00
Migrating from from wiringpi to pigpio. This increases the sample rate by a factor of 3 and will allow creation of a board that can monitor over 30 breakers with a single raspberry pi.
This is based on pi4j 2.0 which is in a beta status. I have fixed a few bugs in a local version of pi4j 2.0 to get it to work but I haven't submitted those changes to pi4j yet. This change requires a migration to Java 11 and will *NOT* be backwards compatible. Upgrading to this hub software will require that java 11 and pigpio be installed on the hub. This can be done from an ssh session with the following commands: apt-get update apt-get install openjdk-11-jre-headless apt-get install pigpio Alternatively, you can download a new sd image, reflash your sd card, and re-adopt your hub.
This commit is contained in:
@@ -39,7 +39,7 @@ public class BreakerHub implements IIdentical<BreakerHub> {
|
||||
}
|
||||
|
||||
public double getPortCalibrationFactor() {
|
||||
return portCalibrationFactor == 0.0?1.25:portCalibrationFactor;
|
||||
return portCalibrationFactor == 0.0?1.20:portCalibrationFactor;
|
||||
}
|
||||
|
||||
public void setPortCalibrationFactor(double _portCalibrationFactor) {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.lanternsoftware.datamodel.currentmonitor;
|
||||
|
||||
import com.lanternsoftware.util.dao.annotations.DBSerializable;
|
||||
|
||||
@DBSerializable
|
||||
public class EmailCredentials {
|
||||
private EmailProvider provider;
|
||||
private String apiKey;
|
||||
private String apiSecret;
|
||||
private String emailFrom;
|
||||
private String serverUrlBase;
|
||||
|
||||
public EmailProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(EmailProvider _provider) {
|
||||
provider = _provider;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String _apiKey) {
|
||||
apiKey = _apiKey;
|
||||
}
|
||||
|
||||
public String getApiSecret() {
|
||||
return apiSecret;
|
||||
}
|
||||
|
||||
public void setApiSecret(String _apiSecret) {
|
||||
apiSecret = _apiSecret;
|
||||
}
|
||||
|
||||
public String getEmailFrom() {
|
||||
return emailFrom;
|
||||
}
|
||||
|
||||
public void setEmailFrom(String _emailFrom) {
|
||||
emailFrom = _emailFrom;
|
||||
}
|
||||
|
||||
public String getServerUrlBase() {
|
||||
return serverUrlBase;
|
||||
}
|
||||
|
||||
public void setServerUrlBase(String _serverUrlBase) {
|
||||
serverUrlBase = _serverUrlBase;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.lanternsoftware.datamodel.currentmonitor;
|
||||
|
||||
public enum EmailProvider {
|
||||
SENDGRID,
|
||||
MAILJET
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public enum HubConfigCharacteristic {
|
||||
Shutdown(13, CharacteristicFlag.WRITE),
|
||||
Version(14, CharacteristicFlag.READ),
|
||||
Update(15, CharacteristicFlag.WRITE),
|
||||
ReloadConfig(15, CharacteristicFlag.WRITE);
|
||||
ReloadConfig(16, CharacteristicFlag.WRITE);
|
||||
|
||||
public final int idx;
|
||||
public final UUID uuid;
|
||||
|
||||
@@ -36,6 +36,10 @@ public class NetworkStatus {
|
||||
pingSuccessful = _pingSuccessful;
|
||||
}
|
||||
|
||||
public boolean isNetworkConnected() {
|
||||
return isWifiConnected() || isEthernetConnected();
|
||||
}
|
||||
|
||||
public boolean isWifiConnected() {
|
||||
return CollectionUtils.isNotEmpty(wifiIPs);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.lanternsoftware.datamodel.currentmonitor.dao;
|
||||
|
||||
import com.lanternsoftware.datamodel.currentmonitor.EmailCredentials;
|
||||
import com.lanternsoftware.datamodel.currentmonitor.EmailProvider;
|
||||
import com.lanternsoftware.util.dao.AbstractDaoSerializer;
|
||||
import com.lanternsoftware.util.dao.DaoEntity;
|
||||
import com.lanternsoftware.util.dao.DaoProxyType;
|
||||
import com.lanternsoftware.util.dao.DaoSerializer;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class EmailCredentialsSerializer extends AbstractDaoSerializer<EmailCredentials>
|
||||
{
|
||||
@Override
|
||||
public Class<EmailCredentials> getSupportedClass()
|
||||
{
|
||||
return EmailCredentials.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DaoProxyType> getSupportedProxies() {
|
||||
return Collections.singletonList(DaoProxyType.MONGO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DaoEntity toDaoEntity(EmailCredentials _o)
|
||||
{
|
||||
DaoEntity d = new DaoEntity();
|
||||
d.put("provider", DaoSerializer.toEnumName(_o.getProvider()));
|
||||
d.put("api_key", _o.getApiKey());
|
||||
d.put("api_secret", _o.getApiSecret());
|
||||
d.put("email_from", _o.getEmailFrom());
|
||||
d.put("server_url_base", _o.getServerUrlBase());
|
||||
return d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmailCredentials fromDaoEntity(DaoEntity _d)
|
||||
{
|
||||
EmailCredentials o = new EmailCredentials();
|
||||
o.setProvider(DaoSerializer.getEnum(_d, "provider", EmailProvider.class));
|
||||
o.setApiKey(DaoSerializer.getString(_d, "api_key"));
|
||||
o.setApiSecret(DaoSerializer.getString(_d, "api_secret"));
|
||||
o.setEmailFrom(DaoSerializer.getString(_d, "email_from"));
|
||||
o.setServerUrlBase(DaoSerializer.getString(_d, "server_url_base"));
|
||||
return o;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ com.lanternsoftware.datamodel.currentmonitor.dao.BreakerPowerSerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.BreakerSerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.ChargeSummarySerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.ChargeTotalSerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.EmailCredentialsSerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.EnergyBlockSerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.EnergySummarySerializer
|
||||
com.lanternsoftware.datamodel.currentmonitor.dao.EnergyTotalSerializer
|
||||
|
||||
Reference in New Issue
Block a user