Feeding data from Android phone to Bangle.js continuously?

Posted on
Page
of 3
Prev
/ 3
Next
  • @nienno,

    Sadly I have let this languish (in part because I finally got ControlIQ for my insulin pump which has made knowing the moment-to-moment number a bit less pressing).

    But, I do want to do it, and in fact hearing that there's someone else who could directly use it helps reinvigorate me! It will still take some time but hopefully not another 8 months.

  • @epw Thanks for your answer.
    I actually saw the code and played with it in my Garmin. And reusing such code I made my own Garmin app to see my glucose values while doing sports.
    However Garmin uses the ConnectIQ app to do the web request via

    http://127.0.0.1:17580
    

    I'd like to do the same thing but with a PineTime . I am trying to use the wasp-os for that platform using micropython but I believe a miss a companion app that accepts web request via BLE and returns the blood glucose data from xDrip.
    Any thoughts or advices are more than welcome.
    I don't know how to proceed... my thoughts are, reuse the android app shared on your post that advertises xDrip data via BLE under "request", and hopefully get such data in the call back and at that moment parse the data to get the glucose value as MVP (minimal valuable product).
    Cheers!

  • I'm glad to hear you got something to work, @nienno!

    I think you're right about missing a companion app that accepts a Web request over BLE. The Android app on this thread might be able to do it, by making a Web request itself to http://127.0.0.1:17580, and then publishing that. While I don't think I can give many details on that, I can get you started with https://developer.android.com/training/v­olley/simple

    It also might might sense to do this as a "push" action rather than a "pull" one. As in, maybe it would be too slow to make a Web request in order to respond to a BLE request and then give the answer. You can tell xDrip to send a "Broadcast Intent" every time it receives a new reading. The BLE app could then pick up those broadcast intents, and use them to publish the value.

    Again, I can only get you started, but you enable the broadcast intents by going to Settings -> Other Settings -> Inter-app settings -> Broadcast locally. There's some documentation at https://developer.android.com/guide/comp­onents/broadcasts, and it starts with probably-confusing overview, then gets to showing you actual code at the "Receiving broadcasts" heading.

    Let me know if you'd like me to try to expand on any of this!

  • Hello guys,

    finally got my banglejs! I'm currently working on a solution myself. I found this topic before but wanted to try a head on approach without getting too many hints from you guys... My setup right now is as follows: I have the gadgetbridge banglejs version installed and created a 90% finished widget for my blood sugar, this is nearly finished. I'm currently working on an companion which receives the intents from xdrip and pass it through to the bangle. I was already able to pass through test data, but unfortunately I wasn't able to get the intents from xdrip yet (I have never developed in-depth with intents before especially with external ones). But I just started working on this today, so I guess I hopefully will be finished by the weekend. Is anyone else still working on this?
    Greetings from Germany.

  • Hi progg,
    Sorry, I stopped working on this.
    the AndroidAPS code base might be of help.
    xDrip has also internal broadcasting option so any app listening to it could capture the broadcasted data.
    Greetings.

  • Hello @nienno,
    no worries. I got that far the app is working now, actually I have to make some adjustments and then I will release the app in f-droid and the widget in the store.

  • That sounds great, thanks!

    And you're able to make it work by sending the tx intent as in http://www.espruino.com/Gadgetbridge#int­ents ?

  • Exactly, I used that. After work today, I will probably have time to finish everything.

  • I've got it! It's alive!


    1 Attachment

    • threema-20221219-132743639.jpg
  • I'm just getting toast notifications like: "Malformed JSON from Bangle.js: End of input at character 43 of [...]" with the json I send to the watch. Does this mean the intend I send is not correctly send over in full length? The strange thing is it worked before, but stopped to work as it seems. Or where does this error come from?

  • Great!

    Or where does this error come from?

    I think it just comes if your code is printing something to the console (like console.log("Hello world")) and Gadgetbridge sees it and complains.

    That could just be some debug code, or it could actually be an error message from Bangle.js. Maybe you could check your Gadgetbridge logs and see what was actually sent?

  • Ah yeah, I noticed. Something got malformed but seems to be working again, I think I will release it in the next days as I kind of beta and wait for feedback to fix further issues, as it is working for me now without any.

  • Ok, it is working most of the time, but sometimes the JSON file gets destroyed. I will share my code later and hopefully someone can point me out where the error is. I think it is related to the phone writing the json file in the same time the watch is trying to read it. Are there any ways to lock a file, or something familiar?

  • It is online but for testing and sharing purposes only until now. The widget: https://github.com/phrogg/BangleApps and for the app: https://codeberg.org/phrogg/BG2BangleJSA­pp

  • I fixed some bugs, and it works very reliable for me right now. I will make PRs now and try to release it. It's still in beta, though.

  • @phrogg i can not find your app on Fdroid. Neither by using the link on your git README nor by searching in Fdroid.

  • Hey, I didn't release the app in F-Droid yet. Even if I would have, it takes quite some time before it will be approved and added. You can download it under releases in my git though: https://codeberg.org/phrogg/BG2BangleJSA­pp/releases Also sorry for not doing that already, but I've made some more small improvements, and I'm not done yet completely, so I will open a PR for both the app and the widget after that's figured out.

  • Hello, all!

    Any further updates on this project? I'm about to embark on something very similar myself..

  • Sounds great, I think the best approach would be to improve my approach, I'm currently in finalizing the app so that it will be approved by the f-droid staff. I posted my links above where you can see the app and the widget as well. You can just submit a PR, or we could work together to improve it further. I'm also currently looking into adding the banglejs ability right in xdrip so that no extra app is needed.
    EDIT: I currently still face a build problem for the app with the fdroidtool, so I'm working on this right now ...

  • Hi @phrogg, your widget isn't working for me (it just shows "BG") in spite of my having all the parts as far as I can tell:

    1. Blood Glucose Widget (xdrip) on Bangle.js 2
    2. BG2BangleJS helper app
      installed from https://codeberg.org/phrogg/BG2BangleJSA­pp/releases
    3. xDrip+ with pretty much every setting under "Inter-app settings"
      enabled
    4. Bangle.js Gadgetbridge with Allow Intents on

    What can I do to troubleshoot? I'd really like this to work.

    Thanks!

    Kenn

  • Hey,

    there could be several things, did you allow my app to "Draw over apps" in the settings?
    And did you add my app to the inter app receiver in xdrip?


    3 Attachments

    • threema1.png
    • threema2.png
    • threema2.png
  • @phrogg It works! I had already enabled draw over other apps, but the only receiver I had was Tasker. Now the only problem is it appears to be ignoring the setting for mg/dl and still using mmol/l.

  • Great to hear that :) If you just changed it, you will to have to wait for the next value to be received. Does it display correctly now? If not, I should take a look.

  • Nope, it's refreshed many times but continues to use mmol/l.

  • Hmh, strange, I will take a look and reply later today, if my GF does not kill me because of that xD

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Feeding data from Android phone to Bangle.js continuously?

Posted by Avatar for epw @epw

Actions