From 89ece8d68a78a44e93118994b8515c181acc018b Mon Sep 17 00:00:00 2001 From: memcpy-rand-rand-rand Date: Thu, 16 Dec 2021 09:55:47 +0000 Subject: [PATCH] feat(brewfather): new fields, fixes add batch fields update doc with new fields and fix ref to .DefaultString complete schema definition --- docs/docs/segment-brewfather.md | 5 +- src/segment_brewfather.go | 6 ++- themes/schema.json | 87 +++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 4 deletions(-) diff --git a/docs/docs/segment-brewfather.md b/docs/docs/segment-brewfather.md index 4449a578..9f25e8cf 100644 --- a/docs/docs/segment-brewfather.md +++ b/docs/docs/segment-brewfather.md @@ -81,6 +81,8 @@ Commonly used fields - .DaysBottled `int` - days since bottled/kegged - .DaysBottledOrFermented `int` - one of the above, chosen automatically based on batch status - .Recipe.Name: `string` - The recipe being brewed in this batch +- .BatchName `string` - The name of this batch +- .BatchNumer `int` - The number of this batch - .MeasuredAbv: `float` - The ABV for the batch - either estimated from recipe or calculated from entered OG and FG values - .ReadingAge `int` - age in hours of most recent reading or -1 if there are no readings available @@ -107,8 +109,7 @@ Additional template properties Hyperlink support - .URL `string` - the URL for the batch in the Brewfather app. You can use this to add a hyperlink to the segment -if you are using a terminal that supports it and the segment has `"enable_hyperlink":true` in it's properties. `.DefaultString` -has this by default. +if you are using a terminal that supports it. The default template implements this. Hyperlink formatting example diff --git a/src/segment_brewfather.go b/src/segment_brewfather.go index 85f2ab41..bd7a2b40 100644 --- a/src/segment_brewfather.go +++ b/src/segment_brewfather.go @@ -76,8 +76,10 @@ type BatchReading struct { } type Batch struct { // Json tagged values returned from https://api.brewfather.app/v1/batches/batch_id - Status string `json:"status"` - Recipe struct { + Status string `json:"status"` + BatchName string `json:"name"` + BatchNumber int `json:"batchNo"` + Recipe struct { Name string `json:"name"` } `json:"recipe"` BrewDate int64 `json:"brewDate"` diff --git a/themes/schema.json b/themes/schema.json index 0fd38cd2..ec6c0f2d 100644 --- a/themes/schema.json +++ b/themes/schema.json @@ -1837,6 +1837,93 @@ "title":"Icon to use to indicate days", "description":"Appended to a number to indicate days, e.g. 25d", "default":"d" + }, + "http_timeout": { + "$ref": "#/definitions/http_timeout" + }, + "cache_timeout": { + "type": "integer", + "title": "cache timeout in minutes", + "description": "The number of minutes the response is cached. A value of 0 disables the cache.", + "default": 5 + }, + "doubleup_icon": { + "type":"string", + "title":"Temperature trend icon, very high positive change", + "description":"Delta between this and prior temperature reading is very high (> 4C by default), available intemplate as .TemperatureTrend", + "default":"↑↑" + }, + "singleup_icon": { + "type":"string", + "title":"Temperature trend icon, high positive change", + "description":"Delta between this and prior temperature reading is high (2C < delta < 4C by default), available intemplate as .TemperatureTrend", + "default":"↑" + }, + "fortyfiveup_icon": { + "type":"string", + "title":"Temperature trend icon, positive change", + "description":"Delta between this and prior temperature reading is positive (0.5C < delta < 2C by default), available intemplate as .TemperatureTrend", + "default":"↗" + }, + "flat_icon": { + "type":"string", + "title":"Temperature trend icon, flat/small change", + "description":"Delta between this and prior temperature and this temperature reading (< +-0.5C change), available intemplate as .TemperatureTrend", + "default":"→" + }, + "fortyfivedown_icon": { + "type":"string", + "title":"Temperature trend icon, v. negative change", + "description":"Delta between this and prior temperature reading is negative (-0.5C > delta > -2C by default), available intemplate as .TemperatureTrend", + "default":"↘" + }, + "singledown_icon": { + "type":"string", + "title":"Temperature trend icon, high negative change", + "description":"Delta between this and prior temperature reading is large negative (-2C > delta > -4C by default), available intemplate as .TemperatureTrend", + "default":"↓" + }, + "doubledown_icon": { + "type":"string", + "title":"Temperature trend icon, very high negative change", + "description":"Delta between this and prior temperature reading is very large negative (> -4C by default), available intemplate as .TemperatureTrend", + "default":"↓↓" + }, + "planning_status_icon": { + "type":"string", + "title":"Icon for batch in planning", + "description":"Available in template as .StatusIcon", + "default":"\uF8EA" + }, + "brewing_status_icon": { + "type":"string", + "title":"Icon for batch being brewed", + "description":"Available in template as .StatusIcon", + "default":"\uF7DE" + }, + "fermenting_status_icon": { + "type":"string", + "title":"Icon for batch fermenting", + "description":"Available in template as .StatusIcon", + "default":"\uF499" + }, + "conditioning_status_icon": { + "type":"string", + "title":"Icon for batch conditioning", + "description":"Available in template as .StatusIcon", + "default":"\uE372" + }, + "completed_status_icon": { + "type":"string", + "title":"Icon for completed batch", + "description":"Available in template as .StatusIcon", + "default":"\uF7A5" + }, + "archived_status_icon": { + "type":"string", + "title":"Icon for archived batch", + "description":"Available in template as .StatusIcon", + "default":"\uF187" } } }