TRMNL Display
2026-03-30
新闻来源:网淘吧
围观:8
电脑广告
手机广告
TRMNL 内容生成器
为 TRMNL 电子墨水屏设备生成 HTML 内容。
前提条件
安装trmnlCLI 至最新版本:

npm install -g trmnl-cli@latest
配置一个 webhook 插件(一次性设置):
# Add a plugin
trmnl plugin add home "https://trmnl.com/api/custom_plugins/{uuid}"
# Verify it's configured
trmnl plugin
快速入门工作流
- 安装/更新 CLI:运行
npm install -g trmnl-cli@latest - 检查插件:运行
trmnl plugin- 如果没有,提示用户添加一个 - 确认设备类型(默认:TRMNL OG,2 位色,800x480)
- 根据内容需求阅读相关参考文档
- 使用 TRMNL 框架类生成 HTML
- 将 HTML 写入临时文件并发送:
trmnl send --file /tmp/trmnl-content.html # Or to a specific plugin: trmnl send --file /tmp/trmnl-content.html --plugin office - 仅显示最小化确认信息- 请勿将内容回显到聊天中
正在发送内容
从文件(推荐):
# Write HTML content to file first
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">My Plugin</span>
</div>
EOF
# Send to display
trmnl send --file /tmp/trmnl-content.html
发送前验证:
trmnl validate --file /tmp/trmnl-content.html
查看发送历史:
trmnl history
trmnl history --today
trmnl history --failed
Webhook 限制
| 等级 | 负载大小 | 速率限制 |
|---|---|---|
| 免费版 | 2 KB(2,048 字节) | 12 次请求/小时 |
| TRMNL+ | 5 KB(5,120 字节) | 30 次请求/小时 |
全局设置等级以确保验证准确性:
trmnl tier plus # or "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">
<!-- Content sections separated by dividers -->
</div>
<div class="title_bar">
<img class="image" src="icon.svg">
<span class="title">Plugin Name</span>
<span class="instance">Context</span>
</div>
布局+布局--列= 垂直弹性容器间距--元素间分布= 将区域推至边缘标题栏= 始终位于底部,布局之外分隔线= 分隔主要区域- 关键提示:仅一个
布局每个视图中的元素
快速参考
网格系统(10列)
<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">Total Sales</span>
</div>
</div>
数值排版
始终使用value--tnums用于数字。
| 类 | 用法 |
|---|---|
value--xxxlarge | 核心关键绩效指标 |
value--xxlarge | 大额价格 |
value--xlarge | 次要指标 |
value--tnums | 数字必需 |
灰度类
使用预设类,而非内联颜色:
bg--black、bg--gray-60、bg--gray-30,bg--gray-10,bg--whitetext--black,text--gray-50
数据属性
| 属性 | 用途 |
|---|---|
data-fit-value="true" | 自动调整文本大小以适应 |
data-clamp="N" | 限制为 N 行 |
data-overflow="true" | 启用溢出管理 |
最佳实践
- 使用
布局+标题栏结构 - 始终
value--tnums用于数字 - 使用
数据拟合值关于主要指标 - 使用
bg--gray-* 类抖动类 - 保持负载低于层级限制
- 最小确认次数- 仅显示“已发送至TRMNL”
故障排除
| 问题 | 解决方案 |
|---|---|
trmnl:未找到命令 | 运行npm install -g trmnl-cli@latest |
| 未配置插件 | 运行trmnl plugin add <名称> <URL> |
| Webhook失败 | trmnl config- 验证插件URL |
| 负载过大 | trmnl validate --file- 检查大小 |
| 数字未对齐 | 添加价值--tnums类别 |
| 发送历史 | 终端历史 --失败 |
文章底部电脑广告
手机广告位-内容正文底部
上一篇:Portable Tools
下一篇:Openclaw Safety Coach


微信扫一扫,打赏作者吧~