From 30c82c2f5634b1ba9e7593f33bf93b2e6689d127 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 25 Nov 2021 08:57:47 +0100 Subject: [PATCH] chore(nightscout): add all object properties --- docs/docs/segment_nightscout.md | 9 +++++++++ src/segment_nightscout.go | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/docs/segment_nightscout.md b/docs/docs/segment_nightscout.md index 54456408..f651c1ad 100644 --- a/docs/docs/segment_nightscout.md +++ b/docs/docs/segment_nightscout.md @@ -79,7 +79,16 @@ if that color is visible against any of your backgrounds. ## Template Properties +- .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 glpyh as seen above diff --git a/src/segment_nightscout.go b/src/segment_nightscout.go index 00cd148a..f26d355e 100644 --- a/src/segment_nightscout.go +++ b/src/segment_nightscout.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "errors" + "time" ) // segment struct, makes templating easier @@ -31,8 +32,17 @@ const ( // NightscoutData struct contains the API data type NightscoutData struct { - Sgv int64 `json:"sgv"` - Direction string `json:"direction"` + ID string `json:"_id"` + Sgv int `json:"sgv"` + Date int64 `json:"date"` + DateString time.Time `json:"dateString"` + Trend int `json:"trend"` + Direction string `json:"direction"` + Device string `json:"device"` + Type string `json:"type"` + UtcOffset int `json:"utcOffset"` + SysTime time.Time `json:"sysTime"` + Mills int64 `json:"mills"` } func (ns *nightscout) enabled() bool {