网淘吧来吧,欢迎您!

TRMNL Display

2026-03-30 新闻来源:网淘吧 围观:8
电脑广告
手机广告

TRMNL 内容生成器

为 TRMNL 电子墨水屏设备生成 HTML 内容。

前提条件

安装trmnlCLI 至最新版本:

TRMNL Display

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

快速入门工作流

  1. 安装/更新 CLI:运行npm install -g trmnl-cli@latest
  2. 检查插件:运行trmnl plugin- 如果没有,提示用户添加一个
  3. 确认设备类型(默认:TRMNL OG,2 位色,800x480)
  4. 根据内容需求阅读相关参考文档
  5. 使用 TRMNL 框架类生成 HTML
  6. 将 HTML 写入临时文件并发送:
    trmnl send --file /tmp/trmnl-content.html
    # Or to a specific plugin:
    trmnl send --file /tmp/trmnl-content.html --plugin office
    
  7. 仅显示最小化确认信息- 请勿将内容回显到聊天中

正在发送内容

从文件(推荐):

# 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--blackbg--gray-60bg--gray-30,bg--gray-10,bg--white
  • text--black,text--gray-50

数据属性

属性用途
data-fit-value="true"自动调整文本大小以适应
data-clamp="N"限制为 N 行
data-overflow="true"启用溢出管理

最佳实践

  1. 使用布局+标题栏结构
  2. 始终value--tnums用于数字
  3. 使用数据拟合值关于主要指标
  4. 使用bg--gray-* 类抖动类
  5. 保持负载低于层级限制
  6. 最小确认次数- 仅显示“已发送至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

相关文章

您是本站第321789名访客 今日有130篇新文章/评论