14.5 C
New York
Sunday, November 17, 2024

A Nightscout section for OhMyPosh exhibits my blood sugar readings in actual time in my Git indicator



I’ve talked about How I like a pleasant, fairly message in my Home windows Terminal and I made movies displaying intimately tips on how to do it.. I’ve additionally labored with my good friend. TooTallNate to place my real-time blood sugar in a bash or PowerShell messagehowever this was in 2017.

Now that I am group OhMyPosh“I had been that means to write down a Nightscout “section” for my submit. night time explorer It’s self-hosted open supply (there are Business hosts additionally like T1Pal.) web site and API for distant viewing of real-time and close to real-time glucose readings for diabetics like me.

Since my physique has an lively REST API the place I can do an HTTP GET (through curl or no matter) and see my blood sugar, it clearly belongs in a spot of honor, as does my Git department! present!

Oh My Posh helps configurable “segments” and now there’s a beta model (nonetheless wants assist for mmol and deprecated reads) night time exploration section that you may arrange in only a few minutes!

This message works in ANY shell on ANY working system! You are able to do this in zsh, PowerShell, Bash, no matter makes you content.

This is a YouTube of Jan from OhMyPosh and I coding the LIVE in Go section.

If you have already got an OhMyPosh json configuration, you possibly can add one other section like this. Be sure your Nightscout URL features a safe token or is public (it is as much as you). Please additionally word that I set “if/then” guidelines in my background templates. These are elective and you may change them to your liking. I set the background colours to purple, yellow and inexperienced, primarily based on the sugar numbers. I even have a foreground template that is not actually used, as you possibly can see it at all times evaluates to black #000, but it surely exhibits you how one can set it to white textual content on a darker background if you would like.

{
"kind": "nightscout",
"model": "diamond",
"foreground": "#ffffff",
"background": "#ff0000",
"background_templates": (
"{{ if gt .Sgv 150 }}#FFFF00{{ finish }}",
"{{ if lt .Sgv 60 }}#FF0000{{ finish }}",
"#00FF00"
),
"foreground_templates": (
"{{ if gt .Sgv 150 }}#000000{{ finish }}",
"{{ if lt .Sgv 60 }}#000000{{ finish }}",
"#000000"
),

"leading_diamond": "",
"trailing_diamond": "uE0B0",
"properties": {
"url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?depend=1&token=APITOKENFROMYOURADMIN",
"http_timeout": 1500,
"template": " {{.Sgv}}{{.TrendIcon}}"
}
},

By default, we are going to solely exit and entry your Nightscout occasion each 5 minutes, solely when the message is repainted, and we are going to solely wait 1500 ms earlier than giving up. You possibly can set that “http_timeout” (how lengthy earlier than we hand over) in the event you really feel like this slows you down. It will likely be cached for five minutes, so that you’re unlikely to note something. The good thing about this new OhMyPosh section over the earlier answer is that it requires no extra chronological providers/work and could be arrange extraordinarily shortly. Additionally word that you may customise your template with NerdFonts. I’ve included a small syringe!

What a lovely message with Blood Sugar!

Subsequent, I hope to enhance the section with mmol assist and strikethrough model to get “stale” outcomes (greater than quarter-hour). It’s also possible to assist by watching our youtube and sending a PR!


Sponsor: Make login an Auth0 difficulty. Not yours. Present the handy login options your prospects need, like social login, multi-factor authentication, single sign-on, passwordless, and extra. Get began without spending a dime.




About Scott

Scott Hanselman is a former professor, former chief monetary architect, now speaker, guide, father, diabetic, and Microsoft worker. He’s a failed comic, a scrunchie, and a e-book creator.

Facebook
twitter
subscribe
About Truth sheet

Lodging by
Hosted on an Azure App Service










Related Articles

Latest Articles