Make Gadgets Work

Background As a diabetic there are a number of things we are not able to control but one thing we can do is keep tabs on our data and while in past it would have meant meticulously noting down BG readings in a diary, today it is much much easier with all the apps and connected services. In this article, I aim to go through the list of technologies that I am aware of and use to keep on top of my diabetic data right from my phone. Table of Contents Blood Glucose Meter Freestyle Libre 2 (FSL2) FreeStyle Libre App Diabox (Especially with FSL2) Nightscout Diabetes:M XDRIP+ Tidepool Eufy Smartscales Blood Glucose Meter While there are a number of options available, I settled for CareSens Dual. The biggest advantage with this model is that it plays very nicely with xdrip+ app although lately I am relying more on Diabox so the point is kind of moot. Apart from that, one factor we must bear in mind while chosing the device is not just the cost of the device itself but also that of testing strips as it will be a recurring expense and this device has one of the most reasonably priced testing strips. Freestyle Libre 2 (FSL2) FSL2 became available in the UK only from Jan'21 and this or it's previous version allow for a more regular check of the BG trends. FSL1 in my experience was a bit less accurate than FSL2. However these sensors along with the official app from manufacturer require manual scan, don't give all datapoints and can not be calibrated which is again where xdrip+ / Diabox apps come into the picture. Freestyle Libre 1 (FSL1) with Transmitter (Miaomiao / Bubble) Before Jan'21, in the UK we only had the option of FSL1 and as this version does not have bluetooth communication; the possibility to calibrate and get automated data points required usage of a transmitter device such as Miaomiao or Bubble. I ordered a Miaomiao transmitter back then and I still can use it with FSL2 albiet with slightly modified approach. I do it because I have the device but with FSL2 a transmitter is not needed as explained later. Freestyle Libre App Now the fact is I dont really use this app for anything other than activating the sensor but it is for this reason alone an app you can not avoid or do without. In order to use the sensors to feed data directly and automatically to Diabox the sensor at the time of activation should not be paired through bluetooth to this app. Now there are several ways to achieve this. One is to install the app on a completely separate phone and turn off Bluetooth on that phone. Another is just do not give this app the "Location" permission which would then not allow app access to Bluetooth. Either scenario should work in theory but I use the safest approach of activating sensor through this app on a compltely different phone (that of my daughter actually :)) Diabox (Especially with FSL2) I have been using this app only for 10 days at the time of writing but it works really well with FSL2 and as it gets the data directly from the sensor it removes the additional cost of the transmitter and that makes this a very useful app indeed. The app is available for both iOS as well as Android but from what I gathered at some point Abbot Laboratories (Manufacturers of FSL sensor) complained about the app to Google and so google was obligated to takedown this app from playstore. App therefore is available as an apk file on github and the latest release for it can be downloaded from this GitHub Link The developer has a Diabox Dev website with lot more information on user interface and setup etc. but I will explain my setup below. Download the latest version of the app from GitHub Link Install the app - As it is not from playstore, the permission to install from unknown sources [1] should be activated in Android Settings. Once installed, open the app. It will ask to scan the sensor. Once you scan, the phone will automatically pair the sensor with the Bluetooth of the Libre. Now to enable calibration tap on the sensor image as shown in screenshot below: Now tap 5 times on the text "Factory" in the last entry "Calibration Mode" as shown below: This will present a dialogbox "Sensor Magic Code". Type "GODMODE" in the dialogbox field and press "OK". This should activate the calibration mode and screen should look as shown below: Go back to homepage and you will now see a red coloured circular button with "+" symbol on it as you can see on the first screenshot above. Tapping on the add button will reveal an icon with a glucometer as shown below: Tapping on the glucometer icon will open a sliding scale to provide the calibration value. Add your calibration and click on Save button. Now, the app also allows uploading the data it collects to LibreView and Nighscout. I am not so keen on LibreView web interface so I never tried uploading on that service but have it syncing with Nightscout. For Nightscout sync, you will need to have a Nightscout instance up and running [2] but assuming it is in place, the steps will be simple to follow: Click on "Settings" Click on "Integration" Enable "Nightscout Share Server Upload" Enter the URL for Nightscout instance, something like https://your_nightscout.herokuapp.com/api/v1/ Enter the password for your instance. Click on Connect Test If the test is a success, click on Save button. Nightscout Nightscout is a fairly detailed open source solution with loads and loads of functionalities but as a type 2 user I merely use it as a backup of my data. One key thing to note is that once you setup this server your BG data is available to anyone with access to your URL as there is no password block or similar which in my eyes is no big deal. What can anyone do with just my blood glucose data and how or why will they get access to an obscure URL anyway but if this makes you worried perhaps you can skip this part. If this is not of concern then I must say that while the setup guide[2:1] looks very long and complex, it really isn't. They have taken care to make it so very simple that its infact easier than even completing the registration form for some of the online services we have got accustomed to and it will just work. To set it up you can follow the official set-up and installation guide. Diabetes:M Diabetes-M is a very good app and creates some very useful and pretty reports that can be helpful during discussion with Diabetic Nurse / GP. One big advantage of using this app is that it is able to import data from Nightscout directly and keep it in sync every 15 minutes and then that data is also backed-up in Diabetes-M servers. The app also allows for automatic data sync with a number of popular Glucometers but that is a paid feature and I do not use it so I cannot comment on its reliability. For my usecase I anyway calibrate Diabox each time manually when I take the reading from finger prick and that is synched to Nightscout which is synched to Diabetes-M so the data is anyway there when I need it. Steps to sync with Nightscout are as below: Open your nightscout instance in a browser on a laptop / PC . Click on the site in sequence as shown below: On resulting screen - Administration panel, check if the role "readable" exists. If not create it by clicking on the button Add new Role and in "Permissions" type *.*.read as shown below. If it exists, go to the section "Subjects - People, Devices, etc" and click on "Add new Subject" and fill the resulting dialogbox like shown below and click Save: This will generate the Access Token for the app and it will be shown in the table in the section: Open the Diabetes:M app and click on the hamburger menu on top left corner of the screen. Then on the panel locate and tap on the Data Sync icon. On resulting screen under section "Link external sources" locate Nightscout and click on setting icon. Now fill the URL for your nightscout instance, something like https://your_nightscout.herokuapp.com Leave "Secret" empty and in in the field "Access token" type the access token shown generated in step 6 above from the browser and click Save. Direct links to appstore: Google Playstore Apple Appstore XDRIP+ xdrip+ is an opensource Android app (an iOS variant exists but I havent read much about it so have no knowledge to share) and as it is not available from playstore it can be obtained directly from developer site: https://jamorham.github.io/#xdrip-plus To use xdrip, you will also need to order a transmitter called miaomiao - It usually comes within 2 to 3 days - for me atleast it came in 2 days back in October when I started using FSL1. It is a bit of investment at about £162 but it pays for itself in long run. I ordered from their site[3]. Once you get the transmitter, the process will be like so: It will come with a USB charging cable so place it on charger. It should start blinking blue but if it does not there is a very small hole and you will need a safety pin to press and reset it. Insert the safety pin and keep it pressed for 10 seconds. Then place it on charge. Once the transmitter is charged it will display green light. Now there is also a strap they provide with the transmitter which you can use to place it over the libre sensor on your arm. Open xdrip app and follow the xdrip+ installation guide[4]. Once connected, it will ask you to calibrate the app with readings from two finger prick tests. You can do one and provide twice or you can do twice. I usually do it twice for each new sensor. Tidepool This is a not-for-profit site which xdrip+ can directly communicate with and push the readings to every 15 minutes thus creating a backup for your data in the cloud. As I still use the miaomiao transmitter paired with xdrip+ I have created a sync from xdrip+ to tidepool. Now the good thing with tidepool is that it shows glucometer readings in a separate table and while for Diabox I have to manually enter the finger prick test data, Caresens Dual is paired perfectly with xdrip and every single time I take a finger prick test, xdrip+ automatically fetches the reading from meter via Bluetooth and then that reading is fed into Tidepool which allows me to see my BG data at one place like so: Eufy Smartscales Eufy smartscale is very reasonably priced and I ordered it from Amazon. The scale is reliable, uses standard 3x "AAA" battery which last for years not months. The app interface is good too. One drawback perhaps is that data is only accessible through app on the phone and not through any website. It does sync weight with google fit so that can be accessed and shared across other services if one is so inclined but rest of it will need to be manually captured for any statistical fun. However, if I knew before what I know now I would have perhaps opted for a device from this list as then I could have had my data collected through the open source app openScale and would have had better freedom on how to move it around. Hope this list is useful. If there are any questions, please do not hesitate to ask. :) Reference on how to activate installation from unknown sources ↩︎ Guide to setup Nightscout Instance ↩︎ ↩︎ Site to order MiaoMiao ↩︎ XDRIP+ installation guide ↩︎

Tech for Diabetics

Background As a diabetic there are a number of things we are not able to control but one thing we can do is keep tabs on our data and while in past it would have meant meticulously noting down BG readings in a diary, today it is much much easier
Install the Apache module for specific php version sudo apt install libapache2-mod-php7.3 Copy the php.ini from previous version to newer version after making a backup of the original php.ini for new version. sudo cp /etc/php/7.3/apache2/php.ini php.ini.original sudo cp /etc/php/7.2/apache2/php.ini /etc/php/7.3/apache2/php.ini Install specific php modules for Apache and enable the php modules on new version of php. sudo apt install php7.3-curl php7.3-gd php7.3-gmp php7.3-intl php7.3-mbstring php7.3-simplexml php7.3-soap php7.3-wddx php7.3-xmlreader php7.3-xmlrpc php7.3-xmlwriter php7.3-xsl php7.3-zip php7.3-xml php7.3-mysql sudo phpenmod -v 7.3 pdo_mysql soap wddx xmlreader xmlrpc xsl zip intl gd dom curl mysqlnd gmp simplexml mysqli mbstring Disable old php version, enable new version and restart Apache server. sudo a2dismod php7.2 sudo a2enmod php7.3 sudo systemctl restart apache2

Upgrading PHP version on Linux for Apache

Install the Apache module for specific php version sudo apt install libapache2-mod-php7.3 Copy the php.ini from previous version to newer version after making a backup of the original php.ini for new version. sudo cp /etc/php/7.3/apache2/php.ini php.ini.original sudo cp /etc/
Lately I have been a bit frustrated because while I subscribe to Audible services, Amazon and Google do not play nice with each other limiting me - the owner of books with rights to listen my purchase on any device - in my options on where I can listen. Now I am yet to find a good solution that can get my files playing on google home and not just Alexa, I guess first step was to free my audiobooks from Amazaon jail. That as it turns out is rather simple to do. I must at this point mention OpenAudible which is one fine tool. However, their latest version (2.0.7 at the time of writing) added some limitations whereby you can get it to download the AAX files but not convert them to mp3 without purchasing their license. However, converting AAX to mp3 is accomplished using ffmpeg and I do not believe a nice GUI wrapper is what I need and hence I do not believe my money is well spent in getting a license just to achieve from a graphical user interface what I can achieve for free from the terminal with a single line. There are 3 steps in the conversion process: Get a copy of the AAX file you own from your audible account: This can be done in one of two ways as listed below: a. Install OpenAudible and follow instructions to download the AAX files. b. Copy it from the filesystem of your Android phone. Obtain the activation_bytes for your AAX file: a. If you installed OpenAudible, you can use the following steps: cd /opt/OpenAudible/bin/linux/ ffprobe /home/OpenAudible/aax/name\ of\ the\ book.AAX b. This should give you a lot of output and a hash code. Let's say the hashcode you get is a6ger35cf22u03c9x16743j06f6df50a00b811c3 c. Use this hashcode with following command to get the activation_bytes: ./rcrack path /opt/OpenAudible/bin/tables/ -h a6ger35cf22u03c9x16743j06f6df50a00b811c3 d. This should then output the activation_bytes in last line - something like hex:abc43opu as shown below: Above steps are required only once. Keep the activation_bytes code that you obtain above safe as it can be used for converting all your audiobooks. Now use the following commands to convert AAX file to mp3: #change directory to where the AAX files are saved. If using OpenAudible it will be in /home/<username>/OpenAudible/aax cd /home/<username>/OpenAudible/aax ffmpeg -activation_bytes xxxxxxxx -i 'name of the book.AAX' -map_metadata 0 -codec:a libmp3lame -qscale:a 6 /home/<username>/OpenAudible/mp3/name\ of\ the\ book.mp3 Remember to change xxxxxxxx with the activation_bytes code you obtained in step 2 and the name of book as well as destination path and name of the book. Now ofcourse you can accomplish the first Step 2 above without OpenAudible. If you would want to do so, just follow the guidance on github - https://github.com/inAudible-NG/tables. Hope this will be helpful for a few. In the meantime, I am yet to work out the best way to make google home to play my audiobooks when I so desire. If anyone has any tips they will be gratefully received. Have fun!!!

Converting AAX (Audible) to mp3

Lately I have been a bit frustrated because while I subscribe to Audible services, Amazon and Google do not play nice with each other limiting me - the owner of books with rights to listen my purchase on any device - in my options on where I can listen. Now
I like exploring new solutions and anything to do with data always piques my interest. I came across this nice tool through the list of free self hosted software. UPDATE: I am still getting introduced to the world of docker and while most of it just works few things confuse the hell out of me. Anyway what happened is there was an update for Metabase and I wanted to apply it on my container and in doing so I realised that some of this post can be changed to make it a better experience from get go because after update all my config and dashboards were gone and I had to reconfigure everything. It could be that my lack of knowledge meant I did something wrong and faced the issue but irrespective doing it as per updated post below will ensure you dont face the issue at all because I have now tested it twice to ensure it works well. I have also added the steps to update the metabase to latest docker image as it worked for me. The overall impression when I opened their site can be summed up with WOW!! Now they offer simple docker install supported officially by them and the guide to install docker image is simple enough but the few simple steps I followed are as below: Create an A-record for a subdomain for metabase Download the official metabse docker image from dockerhub Create an apache server conf file for metabase Run the metabase docker image Access metabase docker image using subdomain URL Configure your database on metabase Run Certbot to make the URL https Done!! Create A-record for subdomain Using the process for your Domain Name Regsitrar create an A-Record for a subdomain you would want to use for metabase. For this guide we will assume that the subdomain being created is called "metabase" so if your domain name is say yourdomain.com then the URL to access metabase will be metabase .yourdomain .com. NOTE: It is important that if you use a different subdomain name, please replace metabase with the subdomain name you have chosen in all Apache conf file samples in sections below. More detailed steps are available on previous post HERE Download and Create Apache Conf docker pull metabase/metabase cd /etc/apache2/sites-available/ sudo nano metabase.conf Create a conf file similar to what is shown below: <VirtualHost *:80> ServerName metabase.yourdomain.com ServerAlias metabase.yourdomain.com ErrorLog ${APACHE_LOG_DIR}/error_metabase.log CustomLog ${APACHE_LOG_DIR}/access_metabase.log combined ProxyPreserveHost On ProxyPass / http://localhost:3000/ ProxyPassReverse / http:/localhost:3000/ ProxyPass "/ws2/" "ws://localhost:3000/" ProxyPass "/wss2/" "wss://localhost:3000/" </VirtualHost> Save this by pressing Ctrl+X and issue following commands to enable site and reload the apache server. sudo a2ensite metabase.conf sudo systemctl reload apache2 Run Metabase docker image docker run -d -p 3000:3000 --name metabase metabase/metabase If all goes well, you should have metabase already running. If you get an error to the effect saying port 3000 is already in use, you will perhaps have to run it on another port (say 12345) but as metabase container would have been created you will need to issue following commands. docker rm metabase docker run -d -p 12345:3000 --name metabase metabase/metabase In addition to avoid running the database through the container we must anyway move it to filesystem. Using commands below: mkdir /var/www/metabase This command will create metabase directory on the path /var/www/metabase but you can as easily chose another path as you wish. If you do just remember to update it in next commands. docker ps This will show you the active docker containers. Copy the container ID in first column for the row where under Names you see "metabase" which is the container name we have given using previosu commands.Now copy the database from container to local filesystem cd /var/www/metabase docker cp <container ID>:/metabase.db ./ Now Stop and rename the container docker stop metabase docker rename metabase metabase_old Finally run Metabase Docker Image while pointing it to your filesystem for database file. docker run -d -p 12345:3000 -v ~/metabase-data:/var/www/metabase -e "MB_DB_FILE=/var/www/metabase/metabase.db" --name metabase metabase/metabase The above docker command can be explained as beow: docker run -d >>> This is telling system to start a container in detached mode. By design, containers started in detached mode exit when the root process used to run the container exits. -p 12345:3000 >>> This is telling docker to make the container map port 12345 to port 3000 which is the default port on which metabase starts its server. -v ~/metabase-data:/var/www/metabase >>> This part is telling docker to map the "metabase-data" directory in the container to "/var/www/metabase" on the filesystem. In other words, mounting the local volume at path "/var/www/metabase" onto the container in "metabase-data" directory. --name metabase metabase/metabase >>> Finally this part of command is telling docker to name the container "metabase" and to use the docker image "metabase/metabase" from dockerhub Do bear in mind if you change the port as explained above, you will also need to change the port in apache conf file in previous step. So your apache conf file in this case will look as shown below: <VirtualHost *:80> ServerName metabase.yourdomain.com ServerAlias metabase.yourdomain.com ErrorLog ${APACHE_LOG_DIR}/error_metabase.log CustomLog ${APACHE_LOG_DIR}/access_metabase.log combined ProxyPreserveHost On ProxyPass / http://localhost:12345/ ProxyPassReverse / http:/localhost:12345/ ProxyPass "/ws2/" "ws://localhost:12345/" ProxyPass "/wss2/" "wss://localhost:12345/" </VirtualHost> Access and configure on browser Access your metabase using the subdomain url - http:// metabase .yourdomain .com and it should walk you through the initial configuration. If you do not want to add a database and just play with the tool, they have kindly provided a sample database. It might be useful for you to create a "user" in your database that has "read only" access and then use that "user" when you configure metabase. Metabase will only ever need read access as it cannot be used to modify data in your database. Enable SSL Once you are happy with your configuration from step above, just run the certbot to enable https using letsencrypt certificate. On Debian this could be as simple as issuing the command sudo certbot Once above step is created you will have an additional conf file named metabase-le-ssl.conf created in the location /etc/apache2/sites-available. Check this and once it is there you are all set to access your new funstional metabase instance on https. More detailed steps are availble on previos post HERE Update version Updating on docker image is pretty straight forward and provided you have followed steps above should not result in you loosing all the effort once update has completed. #docker rm metabase_old docker stop metabase #docker rename metabase metabase_old docker pull metabase/metabase docker start metabase From my recent messing around, I have come to realise that so long as the first start of the docker image was done using environment variables pointing to correct database directory, there is no need to run the commented lines above and a simple stop, upgrade and start should work just fine. Enjoy!!!

Metabase - A BI solution that just works

I like exploring new solutions and anything to do with data always piques my interest. I came across this nice tool through the list of free self hosted software. UPDATE: I am still getting introduced to the world of docker and while most of it just works few things confuse
Complete walk-through to set-up a self-hosted instant messaging

Prosody behind Apache on Debian Stretch with Conversations

Complete walk-through to set-up a self-hosted instant messaging