Coder Social home page Coder Social logo

openaps / openaps Goto Github PK

View Code? Open in Web Editor NEW
468.0 468.0 180.0 336 KB

deprecated repo, formerly tools for exploring DIY openaps, but no longer used in current modern OpenAPS builds. see https://openaps.readthedocs.io/en/latest/ for current build instructions

License: MIT License

Python 97.85% Shell 1.83% Makefile 0.32%

openaps's People

Contributors

bewest avatar channemann avatar cjo20 avatar cluckj avatar danamlewis avatar davidofwatkins avatar egirard avatar esteward avatar jasoncalabrese avatar loudnate avatar lukasz-kaniowski avatar oskarpearson avatar scottleibrand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openaps's Issues

512 1.4c issues

per our discussion currently the following commands not working:

openaps use pump read_bg_readings : ValueError: Circular reference detected
openaps use pump read_settings: ValueError: Circular reference detected
openaps use pump status: 'bolusing': data1 == 1, IndexError: bytearray index out of range

Coomands tested:
read_clock
read_carb_ratios
read_insulin_sensitivies
iter_pump
read_basal_profile_std
set_temp_basal
read_current_history_pages
read_history_data

Permissions Issue (Related to Fuser?)

Periodically seeing some issues like this; can occur at various places in the loop (cgm and pump reports), seemingly at random:

cgms://JSON/iter_glucose_hours/recent_glucose.json
reporting recent_glucose.json
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/pi/openaps/bin/openaps-report", line 82, in <module>
    app( )
  File "/home/pi/openaps/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/home/pi/openaps/bin/openaps-report", line 75, in run
    output = app(args, self)
  File "/home/pi/openaps/openaps/cli/subcommand.py", line 50, in __call__
    return self.method.main(args, app)
  File "/home/pi/openaps/openaps/reports/invoke.py", line 47, in main
    repo.index.add([report.name])
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 726, in add
    entries_added.extend(self._entries_for_paths(paths, path_rewriter, fprogress, entries))
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/util.py", line 54, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/util.py", line 84, in set_git_working_dir
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 612, in _entries_for_paths
    entries_added.append(self._store_path(filepath, fprogress))
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 580, in _store_path
    istream = self.repo.odb.store(IStream(Blob.type, st.st_size, stream))
  File "/usr/local/lib/python2.7/dist-packages/gitdb-0.6.4-py2.7-linux-armv7l.egg/gitdb/db/git.py", line 73, in store
    return self._loose_db.store(istream)
  File "/usr/local/lib/python2.7/dist-packages/gitdb-0.6.4-py2.7-linux-armv7l.egg/gitdb/db/loose.py", line 232, in store
    rename(tmp_path, obj_path)
OSError: [Errno 13] Permission denied

Use only one glucose measurement in json

In all the places I've found, openaps has standardised on reporting glucose levels in mg/dL

However, in https://github.com/openaps/openaps/blob/master/openaps/vendors/medtronic.py#L248-L249 it returns the data in the units specified by the user.

This means that all code that consumes the glucose targets needs to be able to handle two cases. Unfortunately, this could lead to dire consequences, where we try and get sugar levels down to 5.0 in the wrong scale. This sort of thing has happened before: http://www.wired.com/2010/11/1110mars-climate-observer-report/

I think we should standardise entirely on mg/dL in all presented/created/parsed json - and leave it up to tools to display the values differently on the UI if needs be. This moves it to the presentation layer, and means that problems like the above can be avoided.

loudnate/openaps-monitor#24 is an example of this happening in the presentation layer. We can have a field that contains the user-preferred units in the settings json, for example, that would make this sort of thing easier.

If everyone is ok with this, I'd like to change the bg targets code to always return mg/dL

Looking for advice

Hi everyone! My name is Nolan. I recently was introduced to the Nightscout community by my family out of interest in the artificial pancreas system. My father is a T1 diabetic who among other things also suffers from celiacs disease. As soon as i read about the program and saw how it could effect his life i was instantly on board.
However, I dont have a major background in computer science or software engineering. I study Information Science as a junior at the University of Pittsburgh but this isnt entirely helpful for writing the algorithms and in-depth code implementation that this project requires. My experience includes taking two courses each in C++ and java programming and im ok with navigating Linux for the more basic things from working with pi in the past. My question to all of you is do you think a person of my skill level could safely and effectively venture into this project?
I'm willing to learn and i realize it might take a large amount of time in doing so but its the least i could do for someone who has done so much for me throughout my life. I do want to be cautious however, i realize fiddling with a medical device is something that deserves the utmost care.

If you would like to email me personally you can do so at [email protected]
Thanks for any Help!
-Nolan

git object corruption issue

reporting clock.json
Traceback (most recent call last):
File "/usr/local/bin/openaps-report", line 5, in
pkg_resources.run_script('openaps==0.0.4', 'openaps-report')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_scr ipt
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_sc ript
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.4-py2.7.egg/EGG-INFO/ scripts/openaps-report", line 82, in
app( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.4-py2.7.egg/openaps/c li/init.py", line 45, in call
self.epilog( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.4-py2.7.egg/EGG-INFO/ scripts/openaps-report", line 69, in epilog
super(ReportToolApp, self).epilog( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.4-py2.7.egg/openaps/c li/init.py", line 64, in epilog
self.create_git_commit( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.4-py2.7.egg/openaps/c li/init.py", line 72, in create_git_commit
if self.repo.is_dirty( ) or self.repo.index.diff(None):
File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/rep o/base.py", line 582, in is_dirty
len(self.git.diff('--cached', default_args)):
File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/cmd .py", line 440, in
return lambda args, kwargs: self._call_process(name, _args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/cmd .py", line 834, in _call_process
return self.execute(make_call(), *__kwargs)
File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/cmd .py", line 627, in execute
raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git diff --cached --abbrev=40 --full-index --raw' retu rned with exit code 128
stderr: 'error: object file .git/objects/91/cc8d05fd89c0415d34592847f917fa51f2d9 67 is empty
fatal: loose object 91cc8d05fd89c0415d34592847f917fa51f2d967 (stored in .git/obj ects/91/cc8d05fd89c0415d34592847f917fa51f2d967) is corrupt'

Add Additional Dexcom Functionality

Currently, the only Dexcom vendor/device functions available are

glucose
iter_glucose
iter_glucose_hours

which all obtain glucose values, trend arrow direction, system times, and display times.

There are several other functions exposed by dexcom_reader, including device settings, battery status, and I believe calibration entries. It would be great to add this functionality to openaps.

error-checking in read_insulin_sensitivities

We should require "units" to be mg/dL or mmol/L and require the following values to be zero in the first record:

      "i": 0,
      "start": "00:00:00",
      "offset": 0,
      "x": 0
$ cat settings/insulin_sensitivities.json
{
  "units": null,
  "sensitivities": [
    {
      "i": 53,
      "start": "02:30:00",
      "sensitivity": 50,
      "offset": 1590,
      "x": 0
    },
    {
      "i": 50,
      "start": "01:00:00",
      "sensitivity": 0,
      "offset": 1500,
      "x": 1
    }
  ],
  "first": 3
}

openaps use pump read_bg_targets

still trying to see if this pump setting related but getting the following exception:
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 10, in
execfile(file)
File "/home/ubuntu/openaps/bin/openaps-use", line 63, in
app( )
File "/home/ubuntu/openaps/openaps/cli/init.py", line 44, in call
self.run(self.args)
File "/home/ubuntu/openaps/bin/openaps-use", line 58, in run
reporter(output)
File "/home/ubuntu/openaps/openaps/reports/reporters/init.py", line 27, in call
self.blob = self.serialize(data)
File "/home/ubuntu/openaps/openaps/reports/reporters/init.py", line 25, in serialize
return self.method.serialize(render(data), self)
File "/home/ubuntu/openaps/openaps/reports/reporters/JSON.py", line 8, in serialize
return json.dumps(blob, indent=2, default=date_handler)
File "/usr/lib/python2.7/json/init.py", line 250, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
chunks = list(chunks)
File "/usr/lib/python2.7/json/encoder.py", line 443, in _iterencode
for chunk in _iterencode(o, _current_indent_level):
File "/usr/lib/python2.7/json/encoder.py", line 440, in _iterencode
raise ValueError("Circular reference detected")
ValueError: Circular reference detected

Results for Carb Ratios, Sensitivities, BG Targets

Can we only get the items with values like the temp basal profile? right now for Carb Ratio, BG Targets and ISF we get an array with empty items:

{
"units": "grams",
"first": 1,
"schedule": [
{
"i": 0,
"x": 0,
"r": 20,
"ratio": 20,
"offset": 0
},
{
"i": 12,
"x": 1,
"r": 22,
"ratio": 22,
"offset": 360
},
{
"i": 18,
"x": 2,
"r": 20,
"ratio": 20,
"offset": 540
},
{
"i": 22,
"x": 3,
"r": 22,
"ratio": 22,
"offset": 660
},
{
"i": 40,
"x": 4,
"r": 20,
"ratio": 20,
"offset": 1200
},
{
"i": 0,
"x": 5,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 6,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 7,
"r": 0,
"ratio": 0,
"offset": 0
}
]
}

race condition in openaps configuration

When updating an alias or report using openaps alias add, openaps report add, or openaps import, sometimes the configuration will show updated (it will echo back the new config), but then when you run openaps (alias|report) show immediately afterward, the config has reverted to its previous state. (Usually I don't notice this until some time later, when the config I'm relying on to be updated doesn't seem to be working, for no good reason.)

I suspect this is because another openaps operation is ongoing at the time the (add|import) was executed, and when that operation completes, it writes its cached copy of the config, overwriting the updated config.

Fresh install gets ImportError: cannot import name cli

Clone a new copy of openaps. cd into it and run sudo python setup.py install. Try to run openaps, and you get:

pi@raspberrypi3 ~ $ openaps
Traceback (most recent call last):
File "/usr/local/bin/openaps", line 5, in
pkg_resources.run_script('openaps==0.0.0', 'openaps')
File "/usr/local/lib/python2.7/dist-packages/setuptools-1.0-py2.7.egg/pkg_resources.py", line 492, in run_script
File "/usr/local/lib/python2.7/dist-packages/setuptools-1.0-py2.7.egg/pkg_resources.py", line 1350, in run_script
File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.0-py2.7.egg/EGG-INFO/scripts/openaps", line 36, in
from openaps import cli
ImportError: cannot import name cli
pi@raspberrypi3 ~ $

What else is needed to set up the package properly with proper PYTHONPATH etc.? Can we make setup.py do that automatically, or document what's necessary in the appropriate place?

Invoking reports throws an error randomly

I'm fallowing documentation and often I'm getting same exception for different reports:
i.e: $ openaps report invoke settings/insulin_sensitivities.json results with:

pump://JSON/read_insulin_sensitivies/settings/insulin_sensitivities.json
settings/insulin_sensitivities.json  raised  'Pump' object has no attribute 'model'
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 4, in <module>
    __import__('pkg_resources').run_script('openaps==0.0.10', 'openaps-report')
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 726, in run_script
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1484, in run_script
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/EGG-INFO/scripts/openaps-report", line 82, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/EGG-INFO/scripts/openaps-report", line 75, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/cli/subcommand.py", line 52, in __call__
    return self.method.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/reports/invoke.py", line 40, in main
    output = task.method(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/uses/use.py", line 45, in __call__
    output = self.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/vendors/medtronic.py", line 217, in main
    return getattr(self.pump.model, name)(**self.get_params(args))
AttributeError: 'Pump' object has no attribute 'model'

or $ openaps report invoke settings/bg_targets.json

pump://JSON/read_bg_targets/settings/bg_targets.json
settings/bg_targets.json  raised  'Pump' object has no attribute 'model'
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 4, in <module>
    __import__('pkg_resources').run_script('openaps==0.0.10', 'openaps-report')
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 726, in run_script
  File "build/bdist.linux-armv7l/egg/pkg_resources/__init__.py", line 1484, in run_script
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/EGG-INFO/scripts/openaps-report", line 82, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/EGG-INFO/scripts/openaps-report", line 75, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/cli/subcommand.py", line 52, in __call__
    return self.method.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/reports/invoke.py", line 40, in main
    output = task.method(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/uses/use.py", line 45, in __call__
    output = self.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.10-py2.7.egg/openaps/vendors/medtronic.py", line 222, in main
    return getattr(self.pump.model, name)(**self.get_params(args))
AttributeError: 'Pump' object has no attribute 'model'

If I invoke it few times the report in the end is generated though.

(Possible) Insulin sensitivities issue with mmol/l pumps

Hi

When running the read_insulin_sensitivies report, the result is as below - with the sensitivity being 2.2 rather than a more normal 22.

I'm capturing this as I'm not convinced that openaps correctly handles the mmol/L units correctly. That'd lead to hypo actions. I may close the ticket, but I don't want to lose track of this.

{
  "units": "mmol/L",
  "sensitivities": [
    {
      "i": 0,
      "start": "00:00:00",
      "sensitivity": 2.2,
      "offset": 0,
      "x": 0
    }
  ],
  "first": 2
}

Report overwrites existing contents when pump out of range

pump://JSON/read_status/read_status.json
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/src/openaps/bin/openaps-report", line 82, in <module>
    app( )
  File "/root/src/openaps/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/root/src/openaps/bin/openaps-report", line 75, in run
    output = app(args, self)
  File "/root/src/openaps/openaps/cli/subcommand.py", line 50, in __call__
    return self.method.main(args, app)
  File "/root/src/openaps/openaps/reports/invoke.py", line 38, in main
    reporter(task.method(args, app))
  File "/root/src/openaps/openaps/uses/use.py", line 26, in __call__
    output = self.main(args, app)
  File "/root/src/openaps/openaps/vendors/medtronic.py", line 154, in main
    return self.pump.model.read_status( )
AttributeError: 'Pump' object has no attribute 'model'

Results in read_status.json being cleared. Can we catch the exception and recover?

Reports in stdout format throw exception

To reproduce (history data truncated as [...])

$ openaps report add latest_history stdout pump read_history_data 0
added pump://stdout/read_history_data/latest_history
$ openaps report invoke latest_history
pump://stdout/read_history_data/latest_history
[...]reporting latest_history
Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/root/src/openaps/bin/openaps-report", line 82, in <module>
    app( )
  File "/root/src/openaps/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/root/src/openaps/bin/openaps-report", line 75, in run
    output = app(args, self)
  File "/root/src/openaps/openaps/cli/subcommand.py", line 50, in __call__
    return self.method.main(args, app)
  File "/root/src/openaps/openaps/reports/invoke.py", line 40, in main
    repo.index.add([report.name])
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 726, in add
    entries_added.extend(self._entries_for_paths(paths, path_rewriter, fprogress, entries))
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/util.py", line 54, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/util.py", line 84, in set_git_working_dir
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 612, in _entries_for_paths
    entries_added.append(self._store_path(filepath, fprogress))
  File "/usr/local/lib/python2.7/dist-packages/GitPython-1.0.1-py2.7.egg/git/index/base.py", line 571, in _store_path
    st = os.lstat(filepath)     # handles non-symlinks as well
OSError: [Errno 2] No such file or directory: 'latest_history'

openaps use pump iter_pump, error

pi@raspberrypi ~/elliottaps $ openaps use pump iter_pump
No handlers could be found for logger "decocare.stick"
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 8, in
execfile(file)
File "/home/pi/openaps/bin/openaps-use", line 62, in
app( )
File "/home/pi/openaps/openaps/cli/init.py", line 41, in call
self.run(self.args)
File "/home/pi/openaps/bin/openaps-use", line 56, in run
output = app(args, self)
File "/home/pi/openaps/openaps/uses/init.py", line 70, in call
return self.method.selected(args)(args, app)
File "/home/pi/openaps/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/home/pi/openaps/openaps/uses/use.py", line 23, in call
output = self.main(args, app)
File "/home/pi/openaps/openaps/vendors/medtronic.py", line 253, in main
for rec in self.pump.model.iter_history_pages( ):
File "/home/pi/decoding-carelink/decocare/models/init.py", line 63, in call
for record in page:
File "/home/pi/decoding-carelink/decocare/models/init.py", line 42, in download_page
for record in self.find_records(page):
File "/home/pi/decoding-carelink/decocare/models/init.py", line 111, in find_records
records = decoder.decode( )
File "/home/pi/decoding-carelink/decocare/history.py", line 658, in decode
record = parse_record(self.stream, B, larger=larger, model=self.model)
File "/home/pi/decoding-carelink/decocare/history.py", line 593, in parse_record
record.parse( head + date + body )
File "/home/pi/decoding-carelink/decocare/records/base.py", line 66, in parse
return self.decode( )
File "/home/pi/decoding-carelink/decocare/history.py", line 280, in decode
return dict(stale=decode_wizard_settings(stale)
File "/home/pi/decoding-carelink/decocare/history.py", line 308, in decode_wizard_settings
, bg_targets=decode_bg_targets(bg_targets, bg_units)
File "/home/pi/decoding-carelink/decocare/history.py", line 344, in decode_bg_targets
(offset, low, high) = data[start:end]
ValueError: need more than 2 values to unpack

openaps device -h: ImportError: No module named records

pi@raspberrypi3 ~/openaps $ openaps init myopenaps
Initialized empty Git repository in /home/pi/openaps/myopenaps/.git/
[master (root-commit) 89ef0a2] initializing openaps 0.0.0
0 files changed
create mode 100644 openaps.ini
pi@raspberrypi3 ~/openaps $ cd myopenaps/
pi@raspberrypi3 ~/openaps/myopenaps $ ls
openaps.ini
pi@raspberrypi3 ~/openaps/myopenaps $ openaps device -h
Traceback (most recent call last):
File "/usr/local/bin/openaps-device", line 8, in
execfile(file)
File "/home/pi/openaps/bin/openaps-device", line 9, in
from openaps import devices
File "/home/pi/openaps/openaps/devices/init.py", line 3, in
import add, remove, show
File "/home/pi/openaps/openaps/devices/add.py", line 5, in
from openaps import vendors
File "/home/pi/openaps/openaps/vendors/init.py", line 2, in
import dexcom, medtronic
File "/home/pi/openaps/openaps/vendors/medtronic.py", line 8, in
from decocare import stick, session, link, commands, history
File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.8-py2.7.egg/decocare/history.py", line 11, in
from records import *
ImportError: No module named records

openaps use pump read_carb_ratios output some hex (expected?)

ubuntu@ubuntu:~/openaps.alimaz$ openaps use pump read_carb_ratios
0000 0x00 0x14 0x00 0x00 0x00 0x00 0x00 0x00 ........
0008 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ........
0000 0x00 0x14 0x00 0x00 0x00 0x00 0x00 0x00 ........
0008 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ........
0000 0x00 0x14 0x00 0x00 0x00 0x00 0x00 0x00 ........
0008 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ........
0000 0x00 0x14 0x00 0x00 0x00 0x00 0x00 0x00 ........
0008 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ........
{
"units": "grams",
"first": 1,
"schedule": [
{
"i": 20,
"x": 0,
"r": 0,
"ratio": 0,
"offset": 600
},
{
"i": 0,
"x": 1,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 2,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 3,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 4,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 5,
"r": 0,
"ratio": 0,
"offset": 0
},
{
"i": 0,
"x": 6,
"r": 0,
"ratio": 0,
"offset": 0
}
]

Dexcom `iter_glucose` by hours instead of records

Same as #24 but for Dexcom records. Doesn't require any change to decoding-carelink (obviously), so should simply be a port of iter_glucose_hours from the Medtronic device code to the Dexcom device code. I'll give it a go.

Prevent openaps.ini from being truncated

Occasionally my openaps.ini gets truncated to 0 bytes. I presume that's because openaps is truncating the file and re-writing it when it updates the pump expires time. Can we change the way openaps updates it to make a copy, verify it is valid, and then do an atomic move to overwrite the new file?

minutes value 0 in basal rate's first time period

Minimed 522 v2.4A

For all basal rates I've tried (one basal rate throughout the day, a complicated one with insulin dosages that vary throughout the day), in the first section of basal rates, the minutes value is always 0.

[
  {
    "i": 0,
    "start": "00:00:00",
    "rate": 0.8,
    "minutes": 0
  },
  {
    "i": 1,
    "start": "03:00:00",
    "rate": 0.75,
    "minutes": 180
  },
  {
    "i": 2,
    "start": "05:00:00",
    "rate": 0.9500000000000001,
    "minutes": 300
  },
  {
    "i": 3,
    "start": "07:00:00",
    "rate": 1.2000000000000002,
    "minutes": 420
  },
  {
    "i": 4,
    "start": "11:00:00",
    "rate": 0.7000000000000001,
    "minutes": 660

openaps use mypump sensitivities vs. sensitivies

A bit embarrassed to be pointing this out, especially because a fix could break everyone's loop, but just in case there is interest in fixing this typo -- if it even IS a typo: the openaps use arguments for pumps has "sensitivies" as an option, which has bitten me a few times because I always want to type "sensitivities". Perhaps sensitivies could stay in there as deprecated for a little while while folks switch over... again, if that's desired. Tim

openaps use cgm glucose works, iter_glucose does not work

pi@raspberrypi ~/elliottaps $ openaps use cgm iter_glucose 5
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 8, in
execfile(file)
File "/home/pi/openaps/bin/openaps-use", line 62, in
app( )
File "/home/pi/openaps/openaps/cli/init.py", line 41, in call
self.run(self.args)
File "/home/pi/openaps/bin/openaps-use", line 56, in run
output = app(args, self)
File "/home/pi/openaps/openaps/uses/init.py", line 70, in call
return self.method.selected(args)(args, app)
File "/home/pi/openaps/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/home/pi/openaps/openaps/uses/use.py", line 23, in call
output = self.main(args, app)
File "/home/pi/openaps/openaps/vendors/dexcom.py", line 86, in main
for item in self.dexcom.iter_records('EGV_DATA'):
AttributeError: 'Dexcom' object has no attribute 'iter_records'

Large square bolus incorrectly read

Pump: MM 723 v2.4A
Scenario: Bolus wizard used to deliver a square bolus, 6.6 u over 30 min
Issue: iter_pump reads it as only 0.2 u over 30 min

Output below shows records on either side of the bolus wizard delivery. I'm guessing this is a decocare issue, possibly with an extra bit not being accounted for when larger boluses are delivered (similar to the issue with high BG values during MM calibration, perhaps).

pi@raspberrypi ~/hannemannopenaps $ openaps use pump iter_pump 4
[
  {
    "_type": "BasalProfileStart", 
    "_description": "BasalProfileStart 2015-09-28T12:27:37 head[2], body[3] op[0x7b]", 
    "timestamp": "2015-09-28T12:27:37", 
    "_body": "0d2400", 
    "offset": 23400000, 
    "_head": "7b02", 
    "rate": 0.9, 
    "_date": "a55b0c1c0f"
  }, 
  {
    "programmed": 0.2, 
    "_type": "Bolus", 
    "_description": "Bolus 2015-09-28T12:00:36 head[8], body[0] op[0x01]", 
    "timestamp": "2015-09-28T12:00:36", 
    "_body": "", 
    "appended": [
      {
        "_type": "UnabsorbedInsulinBolus", 
        "_description": "UnabsorbedInsulinBolus unknown head[17], body[0] op[0x5c]", 
        "data": [
          {
            "amount": 1.2, 
            "age": 152
          }, 
          {
            "amount": 0.45, 
            "age": 212
          }, 
          {
            "amount": 0.55, 
            "age": 222
          }, 
          {
            "amount": 0.55, 
            "age": 232
          }, 
          {
            "amount": 0.05, 
            "age": 242
          }
        ], 
        "_body": "", 
        "_head": "5c113098c012d4c016dec016e8c002f2c0", 
        "_date": ""
      }
    ], 
    "_head": "0101080108000801", 
    "amount": 0.2, 
    "unabsorbed": 0.2, 
    "duration": 30, 
    "type": "square", 
    "_date": "a4406c7c0f"
  }, 
  {
    "_type": "BolusWizard", 
    "bg": 0, 
    "bg_target_high": 120, 
    "_description": "BolusWizard 2015-09-28T12:00:36 head[2], body[15] op[0x5b]", 
    "timestamp": "2015-09-28T12:00:36", 
    "_body": "505000782864000108000000010878", 
    "_head": "5b00", 
    "unabsorbed_insulin_total": 0.0, 
    "correction_estimate": 0.0, 
    "_date": "a4400c7c0f", 
    "bolus_estimate": 6.6, 
    "bg_target_low": 100, 
    "carb_ratio": 8.0, 
    "food_estimate": 6.6, 
    "carb_input": 80, 
    "sensitivity": 40
  }, 
  {
    "_type": "TempBasalDuration", 
    "duration (min)": 30, 
    "_description": "TempBasalDuration 2015-09-28T11:57:37 head[2], body[0] op[0x16]", 
    "timestamp": "2015-09-28T11:57:37", 
    "_body": "", 
    "_head": "1601", 
    "_date": "a5790b5c0f"
  }, 
  {
    "_type": "TempBasal", 
    "temp": "absolute", 
    "_description": "TempBasal 2015-09-28T11:57:37 head[2], body[1] op[0x33]", 
    "timestamp": "2015-09-28T11:57:37", 
    "_body": "00", 
    "_head": "3301", 
    "rate": 0.025, 
    "_date": "a5790b5c0f"
  }
]

Can not run command read_clock

pi@raspberrypi ~/elliottaps $ openaps use pump read_clock
PowerControl SERIAL 624446
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 8, in
execfile(file)
File "/home/pi/openaps/bin/openaps-use", line 62, in
app( )
File "/home/pi/openaps/openaps/cli/init.py", line 41, in call
self.run(self.args)
File "/home/pi/openaps/bin/openaps-use", line 56, in run
output = app(args, self)
File "/home/pi/openaps/openaps/uses/init.py", line 70, in call
return self.method.selected(args)(args, app)
File "/home/pi/openaps/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/home/pi/openaps/openaps/uses/use.py", line 23, in call
output = self.main(args, app)
File "/home/pi/openaps/openaps/vendors/medtronic.py", line 181, in main
return self.pump.model.read_clock( )
AttributeError: 'ReadPumpModel' object has no attribute 'read_clock'

read_bg_targets sometimes generates dangerously incorrect results

For some reason read_bg_targets sometimes outputs results with "units": null, and sets the OpenAPS target BG to 50 (!).

It looks like read_carb_ratios is also doing the same.

You can see more details in my openaps-dev repo. Command I'm running is:
export file=bg_targets.json && git log $file | grep commit | awk '{print $2}' | while read hash; do git show $hash; done | less

commit 11a32f59627b6fcdbecb78cdb4e2ab31e683a693
Author: Scott Leibrand <[email protected]>
Date:   Sun Jul 19 08:03:26 2015 -0700

    openaps-report invoke profile.json iob.json requestedtemp.json

          TODO: better change descriptions
          /usr/local/bin/openaps-report invoke profile.json iob.json requestedtemp.json

diff --git a/bg_targets.json b/bg_targets.json
index c802e19..555c074 100644
--- a/bg_targets.json
+++ b/bg_targets.json
@@ -1,14 +1,14 @@
 {
-  "units": "mg/dL",
+  "units": null,
   "targets": [
     {
-      "high": 120,
-      "start": "00:00:00",
-      "low": 115,
-      "offset": 0,
-      "i": 0,
+      "high": 50,
+      "start": "02:30:00",
+      "low": 50,
+      "offset": 1590,
+      "i": 53,
       "x": 0
     }
   ],
-  "first": 1
+  "first": 3
 }
\ No newline at end of file

and

commit c5bc3ff8d03260eb74b0228286a10650e819f595
Author: Scott Leibrand <[email protected]>
Date:   Sat Jul 18 22:55:48 2015 -0700

    openaps-report invoke profile.json iob.json requestedtemp.json

          TODO: better change descriptions
          /usr/local/bin/openaps-report invoke profile.json iob.json requestedtemp.json

diff --git a/bg_targets.json b/bg_targets.json
index c802e19..f6026a3 100644
--- a/bg_targets.json
+++ b/bg_targets.json
@@ -1,14 +1,22 @@
 {
-  "units": "mg/dL",
+  "units": null,
   "targets": [
     {
-      "high": 120,
-      "start": "00:00:00",
-      "low": 115,
-      "offset": 0,
-      "i": 0,
+      "high": 7,
+      "start": "04:00:00",
+      "low": 40,
+      "offset": 1680,
+      "i": 56,
       "x": 0
+    },
+    {
+      "high": 18,
+      "start": "15:30:00",
+      "low": 7,
+      "offset": 6690,
+      "i": 223,
+      "x": 1
     }
   ],
-  "first": 1
+  "first": 21
 }
\ No newline at end of file
diff --git a/carb_ratio.json b/carb_ratio.json
index 9d5267a..e9ae799 100644
--- a/carb_ratio.json
+++ b/carb_ratio.json
@@ -1,14 +1,22 @@
 {
-  "units": "grams",
-  "first": 1,
+  "units": null,
+  "first": 3,
   "schedule": [
     {
-      "start": "00:00:00",
-      "r": 10,
-      "ratio": 10,
-      "offset": 0,
-      "i": 0,
+      "start": "02:30:00",
+      "r": 50,
+      "ratio": 50,
+      "offset": 1590,
+      "i": 53,
       "x": 0
+    },
+    {
+      "start": "01:00:00",
+      "r": 0,
+      "ratio": 0,
+      "offset": 1500,
+      "i": 50,
+      "x": 1
     }
   ]
 }
\ No newline at end of file

Proposed wiki change.

I'd like to propose the following change to the Getting Started wiki:

Remove

git clone -b bewest/dev [email protected]:bewest/decoding-carelink.git

In favor of

git clone [email protected]:bewest/decoding-carelink.git
cd decoding-carelink
git checkout -b dev origin/dev
git branch -D master
cd ../

Because I ran into an issue when trying to get started: fatal: Remote branch bewest/dev not found in upstream origin.

Not sure if this is an issue related to git versions or not, but my proposed fix should work on all git versions. I could make this change directly to the wiki but thought that would be poor decorum.

Config file location priority

The code to read in the config file currently uses the following for the defaul locations:

def Read (klass, name=None, defaults=['openaps.ini', '~/.openaps.ini', '/etc/openaps/openaps.ini']):

My understanding is that later files in the list overwrite earlier ones, so in this case it will read the config file in the local folder, then overwrite it with a config found in the home directory, then overwrite it with a config found in the /etc/openaps directory. It might be better to reverse the order of these files so that a config file in the same directory as the executable takes absolute priority.

I'll submit a pull request when I've got openaps up and running.

iter_pump error

This error just popped up and is repeating itself. I'd be happy to provide any more information as needed. The error doesn't seem to stop use or report commands from completing.

pi@betacb ~/bcb-s $ openaps use pump723 iter_pump 1
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
[
  {
    "_type": "TempBasalDuration", 
    "duration (min)": 30, 
    "_description": "TempBasalDuration 2015-12-11T18:56:23 head[2], body[0] op[0x16]", 
    "timestamp": "2015-12-11T18:56:23", 
    "_body": "", 
    "_head": "1601", 
    "_date": "d738124b0f"
  }, 
  {
    "_type": "TempBasal", 
    "temp": "absolute", 
    "_description": "TempBasal 2015-12-11T18:56:23 head[2], body[1] op[0x33]", 
    "timestamp": "2015-12-11T18:56:23", 
    "_body": "00", 
    "_head": "3346", 
    "rate": 1.75, 
    "_date": "d738124b0f"
  }
]pi@betacb ~/bcb-s $ openaps report invoke monitor/pumphistory.json
pump723://JSON/iter_pump/monitor/pumphistory.json
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
ERROR month must be in 1..12 0000   0x1e 0x00                                  ..
reporting monitor/pumphistory.json
pi@betacb ~/bcb-s $ 

openaps init doesn't work on CWD

pi@raspberrypi2:~$ cp -r openaps-dev/ openaps-test/
pi@raspberrypi2:~$ cd openaps-test/
pi@raspberrypi2:~/openaps-test$ rm -rf .git
pi@raspberrypi2:~/openaps-test$ openaps init
Initialized empty Git repository in /home/pi/openaps-test/.git/
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
pi@raspberrypi2:~/openaps-test$ cd ..
pi@raspberrypi2:~$ openaps init openaps-test/
Reinitialized existing Git repository in /home/pi/openaps-test/.git/
[master (root-commit) 55fb38f] initializing openaps 0.0.3
 1 file changed, 199 insertions(+)
 create mode 100644 openaps.ini

Reduce level of log verbosity

Is there a way to reduce the level of log verbosity openaps / decocare create in /var/log/messages and user.log? Even with daily logrotate, I'm filling up my disk with >2GB of logs.

Timezone doesn't handle daylight savings time well

All times and time zones were set correctly but pump history wasn't properly zoned so treatments were displayed in Nightscout as off by one hour (one hour into the future). (Originally posted in oref0 by mistake)

CareLink goes wild

I just noticed when you hit CareLink continuously for extended time (every 5 min) it stops responding and you need to re insert it back to have things working back.

Is this common? Ben, any log I can provide to further troubleshoot? I created a brand new repo using init but still see the same thing. Ubuntu? image issue?

Same challenge with read_clock also still there.

millisecond date doesn't match timestamp in pumphistory.json

Pump time is set correctly in PDT. timestamp is correct. Actual current unix timestamp is:
1437948234
date record on most recent TempBasalDuration record is:
1437951103000.0
which is 1 hour ahead.

"2015-07-26T14:57:48"pi@rpi3 ~/openaps-test $ openaps pumpquery
pump://JSON/read_clock/clock.json
reporting clock.json
pump://JSON/read_temp_basal/currenttemp.json
reporting currenttemp.json
pump://JSON/iter_pump/pumphistory.json
reporting pumphistory.json
pi@rpi3 ~/openaps-test $ date +%s
1437948234
pi@rpi3 ~/openaps-test $ cat clock.json
"2015-07-26T15:02:36"pi@rpi3 ~/openaps-test $
pi@rpi3 ~/openaps-test $ head pumphistory.json
[
  {
    "_type": "TempBasalDuration",
    "duration (min)": 30,
    "_description": "TempBasalDuration 2015-07-26T14:51:43 head[2], body[0] op[0x16]",
    "date": 1437951103000.0,
    "timestamp": "2015-07-26T14:51:43",
    "_body": "",
    "_head": "1601",
    "_date": "6bf30e5a0f"
pi@rpi3 ~/openaps-test $

can not run command reservoir

pi@raspberrypi ~/elliottaps $ openaps use pump reservoir
PowerControl SERIAL 624446
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 8, in
execfile(file)
File "/home/pi/openaps/bin/openaps-use", line 62, in
app( )
File "/home/pi/openaps/openaps/cli/init.py", line 41, in call
self.run(self.args)
File "/home/pi/openaps/bin/openaps-use", line 56, in run
output = app(args, self)
File "/home/pi/openaps/openaps/uses/init.py", line 70, in call
return self.method.selected(args)(args, app)
File "/home/pi/openaps/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/home/pi/openaps/openaps/uses/use.py", line 23, in call
output = self.main(args, app)
File "/home/pi/openaps/openaps/vendors/medtronic.py", line 159, in main
return self.pump.model.read_reservoir( )
AttributeError: 'ReadPumpModel' object has no attribute 'read_reservoir'

read_basal_profile_std only report the first 20 values

openaps report add settings/basal_profile.json JSON pump read_basal_profile_std
only report the first 20 values

if like me you have a setting for every hour of the day at 8pm that becomes the basal value until midnight.

This coupled with the logic below results in some dangerous conditions around 10pm when openaps bounces between the 8pm basal rate and zero as shown in the below charts.

history.js --> function calcTempTreatments (inputs)
var netBasalRate = tempHistory[i].rate-profile_data.current_basal;
var netBasalAmount = Math.round(netBasalRate*tempHistory[i].duration*10/6)/100

faultstate

Send_Temp_basal command

Any chance if we can return a default JSON when we pass an empty JSON or {"temp":"absolute"} ? current build throws an exception.

Exit status code with report

Connection with my pump gives an error, but it is not issue right now.
The problem is, that the report doesn't give correct exit code.

root@rasp:~/a/my1# openaps report show
pump://JSON/read_status/status.json.new
status.json.new raised ACK is 0 bytes:

root@rasp:~/a/my1# echo $?
0

But direct command returns correct exit code:

root@rasp:~/a/my1# openaps use pump status
[lots of output]
decocare.errors.AckError: ACK is 0 bytes:

root@rasp:~/a/my1# echo $?
1

Retrieve actual calibration records

We should add support for retrieval of Dexcom's calibration records (slope, intercept, etc.) so we can properly use the raw filtered and unfiltered records. Currently, openaps use cgm calibrations does the same thing as meter_data. We should instead make it pull the actual calibration records, with slope, intercept, etc.

No LICENSE.txt?

Hello! I saw this in the readme:

By proceeding using these tools or any piece within, you agree to the copyright (see LICENSE.txt for more information) and release any contributors from liability.

However, I can't find LICENSE.txt. Is this in another repo?

openaps use pump read_selected_basal_profile / read_basal_profile_std/ read_basal_profile_A/ read_basal_profile_B

ubuntu@ubuntu:~/openaps.alimaz$ openaps use pump read_selected_basal_profile
Traceback (most recent call last):
File "/usr/local/bin/openaps-use", line 10, in
execfile(file)
File "/home/ubuntu/openaps/bin/openaps-use", line 63, in
app( )
File "/home/ubuntu/openaps/openaps/cli/init.py", line 44, in call
self.run(self.args)
File "/home/ubuntu/openaps/bin/openaps-use", line 57, in run
output = app(args, self)
File "/home/ubuntu/openaps/openaps/uses/init.py", line 101, in call
return self.method.selected(args)(args, app)
File "/home/ubuntu/openaps/openaps/uses/init.py", line 31, in call
return self.method(args, app)
File "/home/ubuntu/openaps/openaps/uses/use.py", line 26, in call
output = self.main(args, app)
File "/home/ubuntu/openaps/openaps/vendors/medtronic.py", line 193, in main
return getattr(self.pump.model, name)(**self.get_params(args))
AttributeError: 'PumpModel' object has no attribute 'read_selected_basal_profile'

Openaps won't initialize

New RPi2 install. Openaps is running and I can see help menus.
pi@raspberrypi ~/myaps $ openaps init myaps Not an openaps environment, run: openaps init
I ran this multiple ways, including creating a dir first and using the exact "myopenaps" from DGW's writeup. It always returns the same error. I have followed all the steps, but my guess is there is still an environmental variable or setting missing, or there is a bug. :)

Timezone vendor not installing correctly

Dump from when I try to install to updated core:

pi@raspberrypi:~/test_openaps/tutorial $ openaps vendor add openapscontrib.timezones
No module named recurrent
openapscontrib.timezones doesn't seem to be an importable python module
If it is a python module, try using --path to influence
PYTHONPATH

< 100 records in pump

Medtronic 522 v2.4A

The pump has a cleared history with < 100 entries.

pi@raspberrypi ~/myopenaps $ openaps use pump iter_pump 100
Traceback (most recent call last):
  File "/usr/local/bin/openaps-use", line 5, in <module>
    pkg_resources.run_script('openaps==0.0.6', 'openaps-use')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/EGG-INFO/scripts/openaps-use", line 63, in <module>
    app( )
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/EGG-INFO/scripts/openaps-use", line 57, in run
    output = app(args, self)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/__init__.py", line 92, in __call__
    return self.method.selected(args)(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/__init__.py", line 31, in __call__
    return self.method(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/uses/use.py", line 26, in __call__
    output = self.main(args, app)
  File "/usr/local/lib/python2.7/dist-packages/openaps-0.0.6-py2.7.egg/openaps/vendors/medtronic.py", line 341, in main
    for rec in self.range( ):
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/models/__init__.py", line 63, in __call__
    for record in page:
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/models/__init__.py", line 42, in download_page
    for record in self.find_records(page):
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/models/__init__.py", line 133, in find_records
    decoder = history.HistoryPage(response.data, self.inst)
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/history.py", line 744, in __init__
    if lib.BangInt(crc) != computed:
  File "/usr/local/lib/python2.7/dist-packages/decocare-0.0.18_dev-py2.7.egg/decocare/lib.py", line 235, in BangInt
    ( x, y ) = ints
ValueError: need more than 0 values to unpack
pi@raspberrypi ~/myopenaps $ ^C
pi@raspberrypi ~/myopenaps $ openaps use pump iter_pump 1
[
  {
    "_type": "BGReceived",
    "link": "909967",
    "_description": "BGReceived 2015-09-14T10:28:16 head[2], body[3] op[0x3f]",
    "timestamp": "2015-09-14T10:28:16",
    "_body": "909967",
    "_head": "3f0a",
    "amount": 82,
    "_date": "905c4a6e0f"
  },
  {
    "_type": "CalBGForPH",
    "_description": "CalBGForPH 2015-09-14T10:28:16 head[2], body[0] op[0x0a]",
    "timestamp": "2015-09-14T10:28:16",
    "_body": "",
    "_head": "0a52",
    "amount": 82,
    "_date": "905c2a6e0f"
  }
]pi@raspberrypi ~/myopenaps $ openaps use pump iter_pump 10
[
  {
    "_type": "BGReceived",
    "link": "909967",
    "_description": "BGReceived 2015-09-14T10:28:16 head[2], body[3] op[0x3f]",
    "timestamp": "2015-09-14T10:28:16",
    "_body": "909967",
    "_head": "3f0a",
    "amount": 82,
    "_date": "905c4a6e0f"
  },
  {
    "_type": "CalBGForPH",
    "_description": "CalBGForPH 2015-09-14T10:28:16 head[2], body[0] op[0x0a]",
    "timestamp": "2015-09-14T10:28:16",
    "_body": "",
    "_head": "0a52",
    "amount": 82,
    "_date": "905c2a6e0f"
  },
  {
    "_type": "Model522ResultTotals",
    "_description": "Model522ResultTotals 2015-09-14T00:00:00 head[1], body[41] op[0x6d]",
    "timestamp": "2015-09-14T00:00:00",
    "_body": "0500c691fb0200000000000000000000000000000000000000000000000000000000000c00e8000000",
    "_head": "6d",
    "_date": "8d8f"
  },
  {
    "_type": "MResultTotals",
    "_description": "MResultTotals 2015-09-14T00:00:00 head[5], body[0] op[0x07]",
    "timestamp": "2015-09-14T00:00:00",
    "_body": "",
    "_head": "0700000000",
    "_date": "8d8f"
  },
  {
    "_type": "BGReceived",
    "link": "909967",
    "_description": "BGReceived 2015-09-13T23:57:58 head[2], body[3] op[0x3f]",
    "timestamp": "2015-09-13T23:57:58",
    "_body": "909967",
    "_head": "3f1f",
    "amount": 251,
    "_date": "ba79776d0f"
  },
  {
    "_type": "CalBGForPH",
    "_description": "CalBGForPH 2015-09-13T23:57:58 head[2], body[0] op[0x0a]",
    "timestamp": "2015-09-13T23:57:58",
    "_body": "",
    "_head": "0afb",
    "amount": 251,
    "_date": "ba79376d0f"
  },
  {
    "_type": "BGReceived",
    "link": "909967",
    "_description": "BGReceived 2015-09-13T09:18:48 head[2], body[3] op[0x3f]",
    "timestamp": "2015-09-13T09:18:48",
    "_body": "909967",
    "_head": "3f12",
    "amount": 145,
    "_date": "b052296d0f"
  },
  {
    "_type": "CalBGForPH",
    "_description": "CalBGForPH 2015-09-13T09:18:48 head[2], body[0] op[0x0a]",
    "timestamp": "2015-09-13T09:18:48",
    "_body": "",
    "_head": "0a91",
    "amount": 145,
    "_date": "b052296d0f"
  },
  {
    "_type": "Model522ResultTotals",
    "_description": "Model522ResultTotals 2015-09-13T00:00:00 head[1], body[41] op[0x6d]",
    "timestamp": "2015-09-13T00:00:00",
    "_body": "0500c88bee0300000000000000000000000000000000000000000000000000000000000c00e8000000",
    "_head": "6d",
    "_date": "8c8f"
  },
  {
    "_type": "MResultTotals",
    "_description": "MResultTotals 2015-09-13T00:00:00 head[5], body[0] op[0x07]",
    "timestamp": "2015-09-13T00:00:00",
    "_body": "",
    "_head": "0700000000",
    "_date": "8c8f"
  },
  {
    "_type": "BGReceived",
    "link": "909967",
    "_description": "BGReceived 2015-09-12T23:32:40 head[2], body[3] op[0x3f]",
    "timestamp": "2015-09-12T23:32:40",
    "_body": "909967",
    "_head": "3f1b",
    "amount": 223,
    "_date": "a860f76c0f"
  }
]pi@raspberrypi ~/myopenaps $

Medtronic `iter_pump` by hours instead of records

Hey @bewest, I'd like to add the ability to call iter_pump with a number of hours (e.g. 4) rather than a number of records. Where would you prefer this go?

  • A new plugin
  • A new Medtronic command in openaps
  • A new, optional argument in iter_glucose/iter_pump named --unit {count,hours,minutes,days} to change the meaning of the count argument

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.