跳转到主内容

Brewfather

非官方测试版翻译

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

功能

精酿爱好者注意啦!通过 brewfather 组件,直接在命令行提示符中实时追踪 Brewfather 的酿造批次状态!

您需要从 Brewfather 设置页面获取用户ID和API密钥,并确保已启用 batches.readrecipes.read 权限范围。

示例配置

此示例使用默认模板展示与批次状态对应的详细信息呈现

当最新数据超过4小时未更新时,组件背景将变为红色——例如当Tilt等设备本应每15分钟向Brewfather提交数据时,可帮助发现异常情况。

信息

温度单位为摄氏度(°C),比重值以 X.XXX 格式表示。

{
"type": "brewfather",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#33158A",
"background_templates": [
"{{ if and (.Reading) (eq .Status \"Fermenting\") (gt .ReadingAge 4) }}#cc1515{{end}}"
],
"options": {
"user_id": "abcdefg123456",
"api_key": "qrstuvw78910",
"batch_id": "hijklmno098765"
}
}

选项

NameTypeDefaultDescription
user_idstringas provided by Brewfather's Generate API Key screen
api_keytemplateas provided by Brewfather's Generate API Key screen
batch_idstringGet this by navigating to the desired batch on the brewfather website, the batch id is at the end of the URL in the address bar
day_iconstringdicon or letter to use to indicate days
http_timeoutint20in milliseconds - How long to wait for the Brewfather service to answer the request

图标配置

可通过以下方式覆盖温度趋势图标(对应模板属性 .TemperatureTrendIcon):

NameDefaultDescription
doubleup_icon↑↑increases of more than 4°C
singleup_iconincrease 2-4°C
fortyfiveup_iconincrease 0.5-2°C
flat_iconchange less than 0.5°C
fortyfivedown_icondecrease 0.5-2°C
singledown_icondecrease 2-4°C
doubledown_icon↓↓decrease more than 4°C

可通过以下方式覆盖批次状态默认图标(对应模板属性 .StatusIcon):

NameDefault
planning_status_icon\uF8EA
brewing_status_icon\uF7DE
fermenting_status_icon\uF499
conditioning_status_icon\uE372
completed_status_icon\uF7A5
archived_status_icon\uF187

模板 (信息)

默认模板
{{ .StatusIcon }} {{ if .DaysBottledOrFermented }}{{ .DaysBottledOrFermented }}{{ .DayIcon }} {{ end }}{{ url .Recipe.Name .URL }} {{ printf \"%.1f\" .MeasuredAbv }}%{{ if and (.Reading) (eq .Status \"Fermenting\") }} {{ printf \"%.3f\" .Reading.Gravity }} {{ .Reading.Temperature }}\u00b0 {{ .TemperatureTrendIcon }}{{ end }}

属性

NameTypeDescription
.StatusstringOne of "Planning", "Brewing", "Fermenting", "Conditioning", "Completed" or "Archived"
.StatusIconstringIcon representing above stats. Can be overridden with properties shown above
.TemperatureTrendIconstringIcon showing temperature trend based on latest and previous reading
.DaysFermentingintdays since start of fermentation
.DaysBottledintdays since bottled/kegged
.DaysBottledOrFermentedintone of the above, chosen automatically based on batch status
.Recipe.NamestringThe recipe being brewed in this batch
.BatchNamestringThe name of this batch
.BatchNumberintThe number of this batch
.MeasuredAbvfloatThe ABV for the batch - either estimated from recipe or calculated from entered OG and FG values
.ReadingAgeintage in hours of most recent reading or -1 if there are no readings available

读数(Reading)

.Reading 包含Brewfather批次读数图表中显示的最新设备或手动输入数据。若无可用读数,.Reading 将为null。

NameTypeDescription
.Reading.Gravityfloatspecific gravity (in decimal point format)
.Reading.Temperaturefloattemperature in °C
.Reading.Timeintunix timestamp of reading
.Reading.Commentstringcomment attached to this reading
.Reading.DeviceTypestringsource of the reading, e.g. "Tilt"
.Reading.DeviceIDstringid of the device, e.g. "PINK"

扩展属性

NameTypeDescription
.MeasuredOgfloatThe OG for the batch as manually entered into Brewfather
.MeasuredFgfloatThe FG for the batch as manually entered into Brewfather
.BrewDateintThe unix timestamp of the brew day
.FermentStartDateintThe unix timestamp when fermentation was started
.BottlingDatetimeThe unix timestamp when bottled/kegged
.TemperatureTrendfloatThe difference between the most recent and previous temperature in °C
.DayIconstringgiven by "day_icon", or "d" by default

超链接支持

NameTypeDescription
.URLstringthe 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. The default template implements this

高级模板定制

内置模板已提供关键信息,您也可利用批次属性构建自定义模板。参考内置模板如下:

{
"template": "{{.StatusIcon}} {{if .DaysBottledOrFermented}}{{.DaysBottledOrFermented}}{{.DayIcon}} {{end}}[{{.Recipe.Name}}]({{.URL}}) {{printf \"%.1f\" .MeasuredAbv}}%{{ if and (.Reading) (eq .Status \"Fermenting\")}}: {{printf \"%.3f\" .Reading.Gravity}} {{.Reading.Temperature}}° {{.TemperatureTrendIcon}}{{end}}"
}

单位转换

默认温度读数为摄氏度,比重读数为小数格式(X.XXX)。

模板支持以下单位转换函数:

温度转换

NameDescription
.DegCToFinput: float degrees in C; output float degrees in F (1 decimal place)
.DegCToKelvininput: float degrees in C; output float Kelvin (1 decimal place)

比重转换

NameDescription
.SGToBrixinput float SG in x.xxx decimal; output float Brix (2 decimal places)
.SGToPlatoinput float SG in x.xxx decimal; output float Plato (2 decimal places)

(基于维基百科的多项式换算公式)

应用示例

{
"template": "{{if .Reading}}{{.SGToBrix .Reading.Gravity}}°Bx, {{.DegCToF .Reading.Temperature}}°F{{end}}"
}

要将比重显示为XXXX格式(如"1020"替代"1.020"),使用 mulf 模板函数:

{
"template": "{{if .Reading}}{{.mulf 1000 .Reading.Gravity}}, {{.DegCToF .Reading.Temperature}}°F{{end}}"
}