Device-Status: provide pseudo-levels or reservoir.

This commit is contained in:
Johannes Mockenhaupt 2017-12-05 21:07:49 +01:00
parent 01c52e753c
commit 7b88ec9e93
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -1042,8 +1042,11 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
try {
JSONObject pumpJson = new JSONObject();
pumpJson.put("clock", DateUtil.toISOString(pump.lastSuccessfulCmdTime));
// TODO can we upload empty/low/normal or is a int expected? If so, use fake numbers like 0/50/200
// pumpJson.put("reservoir", pump.reservoirState);
int level = 250;
if (pump.state.insulinState == PumpState.LOW) level = 50;
if (pump.state.insulinState == PumpState.EMPTY) level = 0;
pumpJson.put("reservoir", level);
JSONObject statusJson = new JSONObject();
statusJson.put("status", getStateSummary());