A Nightscout Phase for OhMyPosh reveals my realtime Blood Sugar readings in my Git Immediate

A Nightscout Phase for OhMyPosh reveals my realtime Blood Sugar readings in my Git Immediate



I’ve talked about how I really like a pleasant fairly immediate in my Home windows Terminal and made movies exhibiting intimately easy methods to do it. I’ve additionally labored with my buddy TooTallNate to place my real-time blood sugar right into a bash or PowerShell immediate, however this was again in 2017.

Now that I am “Group OhMyPosh” I’ve been which means to write down a Nightscout “section” for my immediate. Nightscout is an open supply self-hosted (there are business hosts additionally like T1Pal) web site and API for distant show of real-time and near-real-time glucose readings for Diabetics like myself.

Since my physique has an energetic REST API the place I can simply do an HTTP GET (by way of curl or no matter) and see my blood sugar, it clearly belongs in a spot of honor, identical to my present Git Department!

My blood sugar in my Prompt!

Oh My Posh helps configurable “segments” and now there is a beta (nonetheless wants mmol and rancid readings assist) Nightscout section which you can setup in only a few minutes!

This immediate works in ANY shell on ANY os! You are able to do this in zsh, PowerShell, Bash, no matter makes you cheerful.

Here’s a YouTube of Jan from OhMyPosh and I coding the section LIVE in Go.

When you’ve got an current OhMyPosh json config, you may simply add one other section like this. Be certain your Nightscout URL features a safe Token or is public (as much as you). Be aware additionally that I setup “if/then” guidelines in my background_templates. These are non-obligatory and as much as you to vary to your style. I set my background colours to purple, yellow, inexperienced relying on sugar numbers. I even have a foreground template that isn’t actually used, as you may see it at all times evaluates to black #000, nevertheless it reveals you ways you can set it to white textual content on a darker background in the event you wished.

{
"kind": "nightscout",
"type": "diamond",
"foreground": "#ffffff",
"background": "#ff0000",
"background_templates": [
"{{ if gt .Sgv 150 }}#FFFF00{{ end }}",
"{{ if lt .Sgv 60 }}#FF0000{{ end }}",
"#00FF00"
],
"foreground_templates": [
"{{ if gt .Sgv 150 }}#000000{{ end }}",
"{{ if lt .Sgv 60 }}#000000{{ end }}",
"#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 hit your Nightscout occasion each 5 min, solely when the immediate is repainted, and we’ll solely wait 1500ms earlier than giving up. You possibly can set that “http_timeout” (how lengthy earlier than we surrender) in the event you really feel this slows you down. It will be cached for five min so it is unlikely  to b one thing you will discover. The good thing about this new OhMyPosh section over the earlier resolution is that it requires no further companies/chron jobs and will be setup extraordinarily shortly. Be aware additionally which you can customise your template with NerdFonts. I’ve included a tiny syringe!

What a lovely prompt with Blood Sugar!

Subsequent I am going to hope to enhance the section with mmol assist in addition to strikeout type for “stale” (over 15 min previous) outcomes. You are additionally welcome to assist out by watching our YouTube and submitting a PR!


Sponsor: Make login Auth0’s drawback. Not yours. Present the handy login options your clients need, like social login, multi-factor authentication, single sign-on, passwordless, and extra. Get began at no cost.




About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, marketing consultant, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a guide creator.

facebook
bluesky
subscribe
About   E-newsletter

Internet hosting By
Hosted on Linux using .NET in an Azure App Service








author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
rooshohttps://www.roosho.com
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Latest Articles

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.