Update to version 1.0.7 for the SD Image.

This commit is contained in:
MarkBryanMilligan 2022-02-10 16:54:26 -06:00
parent a892c7f0e8
commit 17815bc579
4 changed files with 3 additions and 52 deletions

View File

@ -45,7 +45,7 @@ This is only tangentially related. A java library for running a zwave controlle
# Ok, how do I run this thing? # Ok, how do I run this thing?
The easiest way to run the software on a hub is to download a pre-built SD card image. One can be downloaded here:<br> The easiest way to run the software on a hub is to download a pre-built SD card image. One can be downloaded here:<br>
[hub_1.0.6.zip](https://cf.lanternpowermonitor.com/hub_1.0.6.zip) [hub_1.0.7.zip](https://cf.lanternpowermonitor.com/hub_1.0.7.zip)
<br><br> <br><br>
Flash this to any micro sd card (4gig or larger) and you're good to go. Fire up the hub and the phone app should be able to connect to it via bluetooth to finish the configuration. The default password on this image is pi/LanternPowerMonitor<br><br> Flash this to any micro sd card (4gig or larger) and you're good to go. Fire up the hub and the phone app should be able to connect to it via bluetooth to finish the configuration. The default password on this image is pi/LanternPowerMonitor<br><br>
When you add the hub to your configuration via the app, you can change where the hub posts data. If you use lanternsoftware.com (the default host), your data will be stored there securely and won't be shared with or sold to anyone. If you really want to run your own server, you're of course welcome to do that instead, instructions are located further down. When you add the hub to your configuration via the app, you can change where the hub posts data. If you use lanternsoftware.com (the default host), your data will be stored there securely and won't be shared with or sold to anyone. If you really want to run your own server, you're of course welcome to do that instead, instructions are located further down.

View File

@ -17,7 +17,6 @@ import com.lanternsoftware.datamodel.currentmonitor.HubConfigService;
import com.lanternsoftware.datamodel.currentmonitor.HubPowerMinute; import com.lanternsoftware.datamodel.currentmonitor.HubPowerMinute;
import com.lanternsoftware.datamodel.currentmonitor.NetworkStatus; import com.lanternsoftware.datamodel.currentmonitor.NetworkStatus;
import com.lanternsoftware.util.CollectionUtils; import com.lanternsoftware.util.CollectionUtils;
import com.lanternsoftware.util.DateUtils;
import com.lanternsoftware.util.NullUtils; import com.lanternsoftware.util.NullUtils;
import com.lanternsoftware.util.ResourceLoader; import com.lanternsoftware.util.ResourceLoader;
import com.lanternsoftware.util.ZipUtils; import com.lanternsoftware.util.ZipUtils;
@ -63,7 +62,6 @@ public class MonitorApp {
private static MonitorConfig config; private static MonitorConfig config;
private static BreakerConfig breakerConfig; private static BreakerConfig breakerConfig;
private static String host; private static String host;
private static Date lastUpdateCheck = new Date();
private static HttpPool pool; private static HttpPool pool;
private static LEDFlasher flasher = null; private static LEDFlasher flasher = null;
private static final AtomicBoolean running = new AtomicBoolean(true); private static final AtomicBoolean running = new AtomicBoolean(true);
@ -154,7 +152,7 @@ public class MonitorApp {
} }
break; break;
case Update: case Update:
monitor.submit(new UpdateChecker(true)); monitor.submit(new UpdateChecker());
break; break;
case ReloadConfig: case ReloadConfig:
HttpGet get = new HttpGet(host + "config"); HttpGet get = new HttpGet(host + "config");
@ -389,10 +387,6 @@ public class MonitorApp {
} }
if (mqttPoster != null) if (mqttPoster != null)
monitor.submit(() -> mqttPoster.postPower(mqttReadings)); monitor.submit(() -> mqttPoster.postPower(mqttReadings));
if (DateUtils.diffInSeconds(new Date(), lastUpdateCheck) >= config.getUpdateInterval()) {
lastUpdateCheck = new Date();
monitor.submit(new UpdateChecker());
}
long now = new Date().getTime(); long now = new Date().getTime();
long duration = (now - firstPost)%1000; long duration = (now - firstPost)%1000;
if (now - lastPost < 1000) { if (now - lastPost < 1000) {
@ -453,19 +447,9 @@ public class MonitorApp {
} }
private static final class UpdateChecker implements Runnable { private static final class UpdateChecker implements Runnable {
private final boolean force;
public UpdateChecker() {
force = false;
}
public UpdateChecker(boolean _force) {
force = _force;
}
@Override @Override
public void run() { public void run() {
if (NullUtils.isNotEmpty(host) && (force || config.isAutoUpdate())) { if (NullUtils.isNotEmpty(host)) {
DaoEntity meta = DaoSerializer.fromZipBson(pool.executeToByteArray(new HttpGet(host + "update/version"))); DaoEntity meta = DaoSerializer.fromZipBson(pool.executeToByteArray(new HttpGet(host + "update/version")));
String newVersion = DaoSerializer.getString(meta, "version"); String newVersion = DaoSerializer.getString(meta, "version");
if (NullUtils.isNotEqual(newVersion, version)) { if (NullUtils.isNotEqual(newVersion, version)) {

View File

@ -16,9 +16,6 @@ public class MonitorConfig {
private boolean debug; private boolean debug;
private int connectTimeout; private int connectTimeout;
private int socketTimeout; private int socketTimeout;
private int updateInterval;
private boolean autoUpdate;
private float autoCalibrationVoltage;
private boolean needsCalibration; private boolean needsCalibration;
private String mqttBrokerUrl; private String mqttBrokerUrl;
private String mqttUserName; private String mqttUserName;
@ -100,30 +97,6 @@ public class MonitorConfig {
socketTimeout = _socketTimeout; socketTimeout = _socketTimeout;
} }
public int getUpdateInterval() {
return updateInterval == 0 ? 300 : updateInterval;
}
public void setUpdateInterval(int _updateInterval) {
updateInterval = _updateInterval;
}
public boolean isAutoUpdate() {
return autoUpdate;
}
public void setAutoUpdate(boolean _autoUpdate) {
autoUpdate = _autoUpdate;
}
public float getAutoCalibrationVoltage() {
return autoCalibrationVoltage;
}
public void setAutoCalibrationVoltage(float _autoCalibrationVoltage) {
autoCalibrationVoltage = _autoCalibrationVoltage;
}
public boolean isNeedsCalibration() { public boolean isNeedsCalibration() {
return needsCalibration; return needsCalibration;
} }

View File

@ -34,9 +34,6 @@ public class MonitorConfigSerializer extends AbstractDaoSerializer<MonitorConfig
d.put("debug", _o.isDebug()); d.put("debug", _o.isDebug());
d.put("connect_timeout", _o.getConnectTimeout()); d.put("connect_timeout", _o.getConnectTimeout());
d.put("socket_timeout", _o.getSocketTimeout()); d.put("socket_timeout", _o.getSocketTimeout());
d.put("update_interval", _o.getUpdateInterval());
d.put("auto_update", _o.isAutoUpdate());
d.put("auto_calibration_voltage", _o.getAutoCalibrationVoltage());
d.put("needs_calibration", _o.isNeedsCalibration()); d.put("needs_calibration", _o.isNeedsCalibration());
d.put("mqtt_broker_url", _o.getMqttBrokerUrl()); d.put("mqtt_broker_url", _o.getMqttBrokerUrl());
d.put("mqtt_user_name", _o.getMqttUserName()); d.put("mqtt_user_name", _o.getMqttUserName());
@ -60,9 +57,6 @@ public class MonitorConfigSerializer extends AbstractDaoSerializer<MonitorConfig
o.setDebug(DaoSerializer.getBoolean(_d, "debug")); o.setDebug(DaoSerializer.getBoolean(_d, "debug"));
o.setConnectTimeout(DaoSerializer.getInteger(_d, "connect_timeout")); o.setConnectTimeout(DaoSerializer.getInteger(_d, "connect_timeout"));
o.setSocketTimeout(DaoSerializer.getInteger(_d, "socket_timeout")); o.setSocketTimeout(DaoSerializer.getInteger(_d, "socket_timeout"));
o.setUpdateInterval(DaoSerializer.getInteger(_d, "update_interval"));
o.setAutoUpdate(DaoSerializer.getBoolean(_d, "auto_update"));
o.setAutoCalibrationVoltage(DaoSerializer.getFloat(_d, "auto_calibration_voltage"));
o.setNeedsCalibration(DaoSerializer.getBoolean(_d, "needs_calibration")); o.setNeedsCalibration(DaoSerializer.getBoolean(_d, "needs_calibration"));
o.setMqttBrokerUrl(DaoSerializer.getString(_d, "mqtt_broker_url")); o.setMqttBrokerUrl(DaoSerializer.getString(_d, "mqtt_broker_url"));
o.setMqttUserName(DaoSerializer.getString(_d, "mqtt_user_name")); o.setMqttUserName(DaoSerializer.getString(_d, "mqtt_user_name"));