upload only fresh pump status
This commit is contained in:
parent
3fb84636db
commit
a55a4ba6eb
1 changed files with 4 additions and 1 deletions
|
@ -576,6 +576,9 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getJSONStatus() {
|
public JSONObject getJSONStatus() {
|
||||||
|
if (getDanaRPump().lastConnection.getTime() + 5 * 60 * 1000L < new Date().getTime()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
JSONObject pump = new JSONObject();
|
JSONObject pump = new JSONObject();
|
||||||
JSONObject battery = new JSONObject();
|
JSONObject battery = new JSONObject();
|
||||||
JSONObject status = new JSONObject();
|
JSONObject status = new JSONObject();
|
||||||
|
@ -583,7 +586,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
try {
|
try {
|
||||||
battery.put("percent", getDanaRPump().batteryRemaining);
|
battery.put("percent", getDanaRPump().batteryRemaining);
|
||||||
status.put("status", "normal");
|
status.put("status", "normal");
|
||||||
status.put("timestamp", DateUtil.toISOString(new Date()));
|
status.put("timestamp", DateUtil.toISOString(getDanaRPump().lastConnection));
|
||||||
if (isTempBasalInProgress()) {
|
if (isTempBasalInProgress()) {
|
||||||
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
|
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
|
||||||
extended.put("TempBasalStart", DateUtil.toISOString(getTempBasal().timeStart));
|
extended.put("TempBasalStart", DateUtil.toISOString(getTempBasal().timeStart));
|
||||||
|
|
Loading…
Reference in a new issue