name: trmnl
description: 使用 TRMNL CSS 框架为 TRMNL 电子墨水屏设备生成内容,并通过 trmnl CLI 发送。适用于用户希望在 TRMNL 设备上显示信息、向电子墨水屏发送消息、创建仪表板内容、显示通知或更新其终端显示的场景。支持使用 TRMNL 框架创建丰富的布局(弹性盒子、网格、表格、进度条、排版工具)。
为 TRMNL 电子墨水屏设备生成 HTML 内容。
安装最新版本的 trmnl CLI:
npm install -g trmnl-cli@latest
配置 Webhook 插件(一次性设置):
# 添加插件
trmnl plugin add home "https://trmnl.com/api/custom_plugins/{uuid}"
# 验证配置
trmnl plugin
npm install -g trmnl-cli@latesttrmnl plugin - 如果没有插件,提示用户添加bash
trmnl send --file /tmp/trmnl-content.html
# 或发送到特定插件:
trmnl send --file /tmp/trmnl-content.html --plugin office从文件发送(推荐):
# 首先将 HTML 内容写入文件
cat > /tmp/trmnl-content.html << 'EOF'
<div class="layout layout--col gap--space-between">
<div class="item">
<span class="value value--xlarge value--tnums">Hello TRMNL!</span>
</div>
</div>
<div class="title_bar">
<span class="title">我的插件</span>
</div>
EOF
# 发送到显示屏
trmnl send --file /tmp/trmnl-content.html
发送前验证:
trmnl validate --file /tmp/trmnl-content.html
查看发送历史:
trmnl history
trmnl history --today
trmnl history --failed
| 套餐 | 负载大小 | 速率限制 |
|---|---|---|
| 免费版 | 2 KB (2,048 字节) | 12 次请求/小时 |
| TRMNL+ | 5 KB (5,120 字节) | 30 次请求/小时 |
全局设置套餐以进行准确验证:
trmnl tier plus # 或 "free"
根据需要阅读这些文件:
| 文件 | 何时阅读 |
|---|---|
references/patterns.md |
从此开始 - 常见插件模式 |
references/framework-overview.md |
设备规格、电子墨水屏限制 |
references/css-utilities.md |
颜色、排版、尺寸、间距 |
references/layout-systems.md |
弹性盒子、网格、溢出引擎 |
references/components.md |
标题栏、分隔线、项目、表格 |
references/webhook-api.md |
负载格式、故障排除 |
assets/anti-patterns.md |
需要避免的常见错误 |
每个插件都遵循此模式:
<div class="layout layout--col gap--space-between">
<!-- 用分隔线分隔的内容区域 -->
</div>
<div class="title_bar">
<img class="image" src="icon.svg">
<span class="title">插件名称</span>
<span class="instance">上下文</span>
</div>
layout + layout--col = 垂直弹性容器gap--space-between = 将区域推到边缘title_bar = 始终在底部,位于布局之外divider = 分隔主要区域.layout 元素<div class="grid">
<div class="col--span-3">30%</div>
<div class="col--span-7">70%</div>
</div>
<div class="item">
<div class="content">
<span class="value value--xlarge value--tnums">$159,022</span>
<span class="label">总销售额</span>
</div>
</div>
数字必须使用 value--tnums。
| 类名 | 用途 |
|---|---|
value--xxxlarge |
核心 KPI |
value--xxlarge |
大额价格 |
value--xlarge |
次要指标 |
value--tnums |
数字必用 |
使用抖动类,而非内联颜色:
- bg--black, bg--gray-60, bg--gray-30, bg--gray-10, bg--white
- text--black, text--gray-50
| 属性 | 用途 |
|---|---|
data-fit-value="true" |
自动调整文本大小以适应 |
data-clamp="N" |
限制为 N 行 |
data-overflow="true" |
启用溢出管理 |
layout + title_bar 结构value--tnumsdata-fit-valuebg--gray-* 抖动类| 问题 | 解决方案 |
|---|---|
trmnl: command not found |
运行 npm install -g trmnl-cli@latest |
| 未配置插件 | 运行 trmnl plugin add <名称> <URL> |
| Webhook 失败 | trmnl config - 验证插件 URL |
| 负载过大 | trmnl validate --file - 检查大小 |
| 数字未对齐 | 添加 value--tnums 类 |
| 发送历史 | trmnl history --failed |