Password reset functionality, ZWave switch schedule improvement, support zwave controller on pi, support relay switches and security sensors.

This commit is contained in:
MarkBryanMilligan
2021-07-02 12:06:37 -05:00
parent 6c2b567536
commit de50645a2c
65 changed files with 27104 additions and 438 deletions

View File

@@ -178,14 +178,14 @@ public class MonitorApp {
return new byte[]{NetworkMonitor.getNetworkStatus().toMask()};
if (HubConfigCharacteristic.NetworkDetails == ch) {
NetworkStatus status = NetworkMonitor.getNetworkStatus();
DaoEntity meta = DaoSerializer.fromZipBson(pool.executeToByteArray(new HttpGet(host + "update/version")));
DaoEntity meta = (host == null)?null:DaoSerializer.fromZipBson(pool.executeToByteArray(new HttpGet(host + "update/version")));
status.setPingSuccessful(CollectionUtils.isNotEmpty(meta));
return DaoSerializer.toZipBson(status);
}
if (HubConfigCharacteristic.Log == ch) {
String[] log = NullUtils.cleanSplit(ResourceLoader.loadFileAsString(WORKING_DIR + "log/log.txt"), "\n");
if (log.length > 10)
log = Arrays.copyOfRange(log, log.length-10, log.length);
if (log.length > 15)
log = Arrays.copyOfRange(log, log.length-15, log.length);
return ZipUtils.zip(NullUtils.toByteArray(CollectionUtils.delimit(Arrays.asList(log), "\n")));
}
return null;
@@ -341,7 +341,7 @@ public class MonitorApp {
if (files != null) {
for (File file : files) {
payload = ResourceLoader.loadFile(file.getAbsolutePath());
if (post(payload, file.getName().endsWith("dat") ? "power/batch" : "power/hub"))
if (post(payload, "power/hub"))
file.delete();
else
break;
@@ -401,7 +401,7 @@ public class MonitorApp {
private static final class UpdateChecker implements Runnable {
@Override
public void run() {
if (NullUtils.isNotEmpty(host)) {
if (NullUtils.isNotEmpty(host) && config.isAutoUpdate()) {
DaoEntity meta = DaoSerializer.fromZipBson(pool.executeToByteArray(new HttpGet(host + "update/version")));
String newVersion = DaoSerializer.getString(meta, "version");
if (NullUtils.isNotEqual(newVersion, version)) {

View File

@@ -17,6 +17,7 @@ public class MonitorConfig {
private int connectTimeout;
private int socketTimeout;
private int updateInterval;
private boolean autoUpdate;
private float autoCalibrationVoltage;
private boolean needsCalibration;
private String mqttBrokerUrl;
@@ -107,6 +108,14 @@ public class MonitorConfig {
updateInterval = _updateInterval;
}
public boolean isAutoUpdate() {
return autoUpdate;
}
public void setAutoUpdate(boolean _autoUpdate) {
autoUpdate = _autoUpdate;
}
public float getAutoCalibrationVoltage() {
return autoCalibrationVoltage;
}

View File

@@ -35,6 +35,7 @@ public class MonitorConfigSerializer extends AbstractDaoSerializer<MonitorConfig
d.put("connect_timeout", _o.getConnectTimeout());
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("mqtt_broker_url", _o.getMqttBrokerUrl());
@@ -60,6 +61,7 @@ public class MonitorConfigSerializer extends AbstractDaoSerializer<MonitorConfig
o.setConnectTimeout(DaoSerializer.getInteger(_d, "connect_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.setMqttBrokerUrl(DaoSerializer.getString(_d, "mqtt_broker_url"));