跳转到主内容

Nightscout

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

Nightscout(云端 CGM 监测)是一个开源 DIY 项目,通过 HTTP REST API 提供 CGM 数据的实时访问。它支持在任何地方安全远程查看血糖数据……包括在命令行中通过 Oh My Posh 片段显示!

示例配置

本示例默认使用 mg/dl(毫克/分升)单位,因为 Nightscout API 发送的血糖值(.Sgv)格式为 mg/dl。下方还提供了以 mmol/L(毫摩尔/升)显示血糖值的模板。使用不同颜色范围时,需将你的高低血糖范围值乘以 18 后填入模板。还需注意背景色与前景色的搭配,例如避免在黄色背景上使用白色文字。

下方的 foreground_templates 示例可设为单一颜色,只要该颜色在所有背景色下都清晰可见。

{
"type": "nightscout",
"style": "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": "",
"template": " {{ .Sgv }}{{ .TrendIcon }}",
"options": {
"url": "https://YOURNIGHTSCOUTAPP.herokuapp.com/api/v1/entries.json?count=1&token=APITOKENFROMYOURADMIN",
"http_timeout": 1500
}
}

或使用以下模板以 mmol/L 显示(替代默认的 mg/dl):

{
"template": " {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round (divf .Sgv 18) 1 }}{{ end }}{{ .TrendIcon }}"
}

选项

NameTypeDefaultDescription
urltemplateYour Nightscout URL, including the full path to entries.json AND count=1 AND token. Example above. You'll know this works if you can curl it yourself and get a single value
headersmap[string]stringA key, value map of Headers to send with the request
http_timeoutint20in milliseconds - how long do you want to wait before you want to see your prompt more than your sugar? I figure a half second is a good default
信息

你可以自由更改趋势图标位置、添加文本或自定义样式! 确保你的 NerdFont 包含所需字形或搜索图标

图标默认值描述
DoubleUpIcon↑↑急速上升
SingleUpIcon快速上升
FortyFiveUpIcon缓慢上升
FlatIcon平稳
FortyFiveDownIcon缓慢下降
SingleDownIcon快速下降
DoubleDownIcon↓↓急速下降

模板 (信息)

默认模板
 {{ .Sgv }}

属性

NameTypeDescription
.IDstringThe internal ID of the object
.SgvintYour Serum Glucose Value (your sugar)
.DateintThe unix timestamp of the entry
.DateStringtimeThe timestamp of the entry
.TrendintThe trend of the entry
.DevicestringThe device linked to the entry
.TypestringThe type of the entry
.UtcOffsetintThe UTC offset
.SysTimetimeThe time on the system
.MillsintThe amount of mills
.TrendIconstringBy default, this will be something like ↑↑ or ↘ etc but you can override them with any glyph as seen above