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 示例可设为单一颜色,只要该颜色在所有背景色下都清晰可见。
- json
- yaml
- toml
{
"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
}
}
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
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):
- json
- yaml
- toml
{
"template": " {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round (divf .Sgv 18) 1 }}{{ end }}{{ .TrendIcon }}"
}
template: {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round
(divf .Sgv 18) 1 }}{{ end }}{{ .TrendIcon }}
template = " {{ if eq (mod .Sgv 18) 0 }}{{divf .Sgv 18}}.0{{ else }} {{ round (divf .Sgv 18) 1 }}{{ end }}{{ .TrendIcon }}"
选项
| Name | Type | Default | Description |
|---|---|---|---|
url | template | Your 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 | |
headers | map[string]string | A key, value map of Headers to send with the request | |
http_timeout | int | 20 | in 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 }}
属性
| Name | Type | Description |
|---|---|---|
.ID | string | The internal ID of the object |
.Sgv | int | Your Serum Glucose Value (your sugar) |
.Date | int | The unix timestamp of the entry |
.DateString | time | The timestamp of the entry |
.Trend | int | The trend of the entry |
.Device | string | The device linked to the entry |
.Type | string | The type of the entry |
.UtcOffset | int | The UTC offset |
.SysTime | time | The time on the system |
.Mills | int | The amount of mills |
.TrendIcon | string | By default, this will be something like ↑↑ or ↘ etc but you can override them with any glyph as seen above |