Skip to content

Installing MMeowlink

ddaniels1 edited this page May 22, 2016 · 19 revisions

Setup

As this is still a WIP, I don't have a Python package available yet. Install it as follows:

cd ~
git clone https://github.com/oskarpearson/mmeowlink.git mmeowlink-source
cd mmeowlink-source
git checkout master
sudo pip install -e .

Add the vendor:

openaps vendor add --path . mmeowlink.vendors.mmeowlink

This will create an entry like this in your openaps.ini:

[vendor "mmeowlink.vendors.mmeowlink"]
path = .
module = mmeowlink.vendors.mmeowlink

Remove any existing pump device

Note that you might need to delete any existing 'pump' device before running the add, so as to disassociate the pump device from CareLink.

If you already have the loop running with CareLink, you should remove the existing pump definition:

openaps device remove pump

This will remove this section from your openaps.ini:

[device "pump"]
extra = pump.ini

Add the new pump device

The parameter format is as follows:

openaps device add pump mmeowlink <radio_type> <port> <serial_number_of_pump>

For example, if you're on an Edison with the subg_rfspy firmware, with pump serial number 12345 your command would be:

openaps device add pump mmeowlink subg_rfspy /dev/ttyMFD1 12345

(See the section on udev rules, below, for an alternative to specifying "/dev/ttyMFD1".) Once run, this would appear in your openaps.ini file:

[device "pump"]
vendor = mmeowlink.vendors.mmeowlink
extra = pump.ini

The pump.ini file would contain the following:

[device "pump"]
serial = 12345
port = /dev/ttyMFD1
radio_type = subg_rfspy

For the mmcommander hardware, replace 'subg_rfspy' with 'mmcommander'

Using udev rules to make meaningful device names

NOTE: this only applies to a TI stick that's plugged into a USB port, not a serial device. Serial devices do not appear in 'lsusb' and remain the same across boots.

Device names like "dev/ttyUSB0" are assigned by the kernel when devices are plugged in, and may differ from one boot to the next. To create more meaningful device names that are tied to the USB vendor and product ID, rather than insertion order, you can use udev rules. For example, if you create a file /etc/udev/rules.d/90-mmeowlink.rules that contains

# symlink for TI Dongle flashed with subg_rfspy firmware
ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="8001", MODE="0664", GROUP="plugdev", SYMLINK+="mmeowlink"

then a symbolic link /dev/mmeowlink will be created whenever the TI Dongle is inserted. You can use the output of

$ lsusb

to verify the vendor and product identifiers for the devices you want to name in this way, and you can have multiple rules, for different devices, in separate files or in the same file.

##Run mmtune

  • Run the tuner to make sure it works and to set up a frequency for the first time openaps use pump mmtune. It may show errors, but if it gives a frequency it's probably safe to ignore the errors.

Troubleshooting mmtune

When running mmtune if you get " Could not get subg_rfspy state or version. Have you got the right port/device and radio_type?" You likely have the wrong port in the pump.ini file.

##Tuning as part of your preflight loop to get the cleanest connection every time (Optional)

  • openaps alias add preflight '! bash -c "echo -n \"mmtune: \" && openaps use pump mmtune && echo -n \"PREFLIGHT \" && openaps report invoke monitor/clock.json 2>/dev/null >/dev/null && echo OK || ( echo FAIL; sleep 120; exit 1 )"'. Be sure to remove your old preflight if you have one first and then make sure it's added into whatever your cron sequence is. Also, make sure to switch temp_basal.json to whatever your temp basal file is called/located.