Custom Beeminder iOS widget

Hey,

I find it useful to look up the urgency load. I created an app that is displaying urgency load among other funny things.

Nonetheless, I really liked Duolingo iOS widget and I thought to myself it would be nice to just have the same experience for Beeminder. Also, this would eliminate the need to open my app.

I came across very simple app called Widgy. It allows you to create your custom iOS widgets. Such widgets can read data from JSON APIs such as Beeminder API.

I myself read urgency score from my serverless app hosted on dash.deno.com:

import { serve } from "https://deno.land/std@0.155.0/http/server.ts";

serve(async (req: Request) => {
    const data = await fetch(`https://www.beeminder.com/api/v1/users/${Deno.env.get('username')}.json?auth_token=${Deno.env.get('token')}`).then(d => d.json());
    return Response.json({data: data.urgency_load});
});

Then, in Widgy, I read the data from that endpoint:

and I can display it on my home screen:

Well, Iā€™ll iterate on the design later :smile: I imagine it could get red or green background depending on my load, display goals that are in danger or some other magic. My desired urgency load meter looks like this: Beeminding by k1rsty - #52 by skorytnicki

Itā€™s worth mentioning that you can display any data there that is available in Beeminder API - urgency load is just my favourite one. You might want to display your goals due today, a chart for some goal or any visualisation thatā€™s available in BUI or playing with Beeminder data.

Let me know if you find it interesting or you know alternatives to Widgy, or if you struggle with setting it up :slight_smile:

9 Likes

I display task names so that I know what to do without looking up BUI.

6 Likes

Ooh, I love ambient awareness tricks like this! Now we just need someone like @narthur or @alys or @adamwolf to tell us how to achieve this on Android. :smiley: :robot:

3 Likes

I have a demo somewhere of an Android app that sets your whole background bright red until you have no Beemergencies!

5 Likes

Itā€™s been ages since Iā€™ve created custom widgets on Android but it looks like the recommended way to do it these days is by using Tasker to create the text that you want to display (Tasker can connect to Beeminder using Beeminderā€™s API) and using KWGT Kustom Widget Maker to display the text.

When you install KWGT, it will appear as a plugin within Tasker, and I believe the plugin settings will let you associate a Tasker variable (which contains the text) with a KWGT variable. A KWGT widget can then display the contents of the KWGT variable.

Iā€™m vaguely interested now so I might play around with it a bit, and if I do I will probably post more details here, if no one else gets to it first. :slight_smile:

2 Likes

I would love to have a distribution chart like in BUI. Donā€™t ask me why, I just liked it. Unfortunately widgy does not seem to work with SVG. If youā€™ve got some alternative ideas, let me know.

SVG is good because itā€™s essentially some text. I could have a simple function that would take goalLoad/urgencyLoad and generate corresponding slice of the pie for each goal. Copy&paste engineering.

1 Like

Urgency load is a bit negative. A positive thing is how productive you are. In other words, sum of your safety buffers in all goals, but no more than 7 points for each, Math.max(7, goal.safetybuf).

I can score 63 points for my 9 goals and currently Iā€™m at 52/63, which is 83%. It has the same drawbacks as urgency load, but letā€™s see if itā€™s a better thing to observe.

4 Likes

oooh, yes, i love that idea!! iā€™ve never really gotten the appeal of urgency load, but

sounds like a very beautiful thing to track!!

unfortunately i donā€™t have an iphone, so i canā€™t use your widget. however, the same duolingo widget also exists on android, and iā€™ve now started using it, itā€™s so cute. :smiling_face_with_three_hearts: thanks for letting me discover it!

2 Likes

Yeah, these widgets is a great thing. I am sure thereā€™s some app for Android, but I canā€™t confirm anything as I donā€™t own a device -,-

In general ā€œambient awarenessā€ is the key. In the past I used new tab in my browser to display new Anki cards. There are smart mirrors that can display stuff when you brush your teeth etc.

2 Likes

I think it works for me. Never had urgency load of 1:

4 Likes

Hereā€™s my dash.deno.com endpoint to host my data:
Beeminder widgy utils Ā· GitHub

And hereā€™s widgy widget in JSON:

Two words on these.

In the first gist, youā€™ll notice that I have small utilities to get data from particular goals (hasDatapointToday) - I use these to get data from my language goals and check if I contribute to them. This could be a separate beeminder goal with metaminding, but why would I do it. I can have 2/3 done information on my screen. You can safely remove languages part from it.

Then, in widgy JSON data, please replace YOURENDPOINT with your actual endpoint url.

2 Likes

(Typo: min not max! I do that every dang time.)

My first reaction was ā€œoh, wow, why the heck didnā€™t we go with the positive formulation??ā€ but then I went spelunking and found the reason: we didnā€™t like how adding more edge-skatey goals would improve your metric.

Iā€™m not at all sure whether thatā€™s a valid objection though! Maybe itā€™s a bit like an ice cream truck loophole. Realistically youā€™re not going to be tempted to dispatch your ā€œget more safety bufferā€ meta goal by creating a new Beeminder goal. Unless you want a new goal anyway, in which case, so bee it? :thinking:

Let me repeat that in a new top-level post, along with reviewing the current definition of Urgency Load and posing the question of whether Total Buffer might be better:

https://forum.beeminder.com/t/is-total-buffer-a-better-metric-than-urgency-load/10935

That way we can stay on topic in this thread about custom widgets!

4 Likes

If you want to have a simple urgency load tracking, you donā€™t need the complexity I introduced. Urgency load can be retrieved from beeminder api.

Hereā€™s my Lock Screen widget with urgency load and steps. Two good metrics of how I am doing today.

2 Likes

Thanks so much for sharing this! I didnā€™t know custom widgets were a thing, but they are so helpful! My phone is a lot simpler now, and I can now easily track my urgency load and how much Iā€™ve decreased it today. Iā€™m totally vibing with my new home screen!

3 Likes

Nice one, you have great taste for user interfaces by the way.

How do you track it?

4 Likes

Thanks!

Thereā€™s probably a better way to do this, but I just have a simple Supabase DB that stores the highest urgency load for the day.

3 Likes

I noticed it is possible to create a nice ring widget if you give it a CSV input (text).

image

In this example, itā€™s percentage of total possible buffer (sum of buffer of all goals).

2 Likes

Hi!

I just moved to iOS and Iā€™ve been trying to use the Widgy app to hit the Beeminder API to get my goalā€™s data.

These are my steps:

  1. Use the URI from the Beeminder API page as an example: ```
    https://www.beeminder.com/api/v1/users/alice/goals/weight.json?auth_token=abc123

I replaced ā€˜aliceā€™ with my username and the auth token I got one from https://www.beeminder.com/api/v1/auth_token.json

2. Opened the Widgy app and selected ā€˜Import URL or JSONā€™ and pasted the above modified URL there

It then says ā€œImport failedā€. Can someone walk me through the process of how I can import data from the Beeminder API into the Widgy app?
1 Like

Any of this type of stuff work on apple watch yet ?

Hey, you have to create a new widget, then add a new layer of type text and select JSON as a source of content for this layer (I tap on the box icon in the last step).

I recorded the steps for you, maybe itā€™s easier that way:

then you insert your URL and you should be able to retrieve the data.

3 Likes