呼叫遵循提供的条件和配置的限制。办公室可覆盖设置室内或室外休息并附注;四项检查仍显示在其下方。
直播卡片
类别:学校。标签:学校和校园,天气和环境。
布局
此全屏卡在横屏或竖屏时填满整个屏幕,不作为角落、芯片或条带放置。
布局:全屏。表单:横向,纵向。
数据与隐私
信息源:screenrig.recess/v1。
信息源文档带有来源归属。播放器向卡片提供信息源。
属性
有关主题、背景、强调色和位置,请参见通用属性。
创建卡片时,在卡片的params中设置静态属性。其数据文档仅包含动态属性。嵌套行描述其父属性的内容。
静态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
title | string | "Recess call" | maxLength:40 | |
school | string | "" | maxLength:60 | 显示在标题旁。为空时显示订阅的地点名称。 |
units | string | "metric" | "metric", "imperial" | 屏幕上的温度、风速和降雨。以下限制保持公制单位。 |
minFeelsLikeC | number | -15 | 最小值:-50;最大值:10 | 当体感温度(含风寒效应)达到此温度或更低(单位:摄氏度)时,休息转入室内。 |
maxFeelsLikeC | number | 32 | 最小值:20;最大值:55 | 当体感温度达到此温度或更高(单位:摄氏度)时,休息转入室内。 |
maxWindKph | number | 50 | 最小值:15;最大值:120 | 当风速达到此值或阵风达到其1.4倍(单位:公里/小时)时,休息转入室内。 |
maxAqi | integer | 100 | 最小值:50;最大值:300 | 当美国空气质量指数超过此值时,休息转入室内。 |
staleMinutes | integer | 90 | 最小值:10;最大值:1440 | |
hour12 | boolean | false | ||
timeZone | 字符串,空值 | null | ||
backgroundColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 用纯色 CSS 顺序覆盖卡片背景和底板。#RRGGBBAA 提供透明度。背景无则优先。 |
textColor | 字符串,空值 | null | 模式:"^#[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$" | 覆盖主文本和次要文本颜色。强调色和语义状态色保持原有功能。 |
动态属性
| 名称 | 类型 | 默认 | 数值和限制 | 描述 |
|---|---|---|---|---|
current | 对象,空值 | null | additionalProperties:false | 当前条件,来自数据存储。存在数据源(screenrig.recess/v1)时优先。 |
current.temperatureC | number | 最小值:-80;最大值:60 | ||
current.apparentC | number | 最小值:-90;最大值:70 | 体感温度。无此项时,卡片根据温度和风速计算风寒值。 | |
current.windKph | number | 最小值:0;最大值:400 | ||
current.gustKph | number | 最小值:0;最大值:500 | ||
current.condition | string | "clear", "partly-cloudy", "cloudy", "fog", "drizzle", "rain", "heavy-rain", "snow", "sleet", "thunderstorm", "wind" | ||
current.precipitationMm | number | 最小值:0;最大值:500 | 过去一小时内有雨或融雪。 | |
aqi | 数字,空值 | null | 最小值:0;最大值:1000 | 来自数据存储的美国空气质量指数。 |
observedAt | string | "" | maxLength:32 | 条件读取时间,ISO 8601(仅数据存储;数据源携带 observedAt)。 |
outlook | array | [] | minItems:0;maxItems:12 | 接下来几小时的数据。存在数据源时优先使用。 |
outlook[].at | string | maxLength:32;必填 | ||
outlook[].apparentC | number | 最小值:-90;最大值:70 | ||
outlook[].temperatureC | number | 最小值:-80;最大值:60 | ||
outlook[].windKph | number | 最小值:0;最大值:400 | ||
outlook[].condition | string | "clear", "partly-cloudy", "cloudy", "fog", "drizzle", "rain", "heavy-rain", "snow", "sleet", "thunderstorm", "wind" | ||
outlook[].precipitationPct | number | 最小值:0;最大值:100 | ||
override | string | "auto" | "auto", "outdoor", "indoor" | 办公室呼叫。自动遵循条件。 |
note | string | "" | maxLength:80 | 办公室做出决定的原因。当覆盖非自动时显示在判决下方。 |
画布示例
将静态属性保存为 params.json 并创建卡片。结果中包含它的 crd_ ID。
{
"theme": "neomustard"
}
screenrig card create --type recess-call --major 1 --file params.json
将此项目添加到播放列表页面的primitives中,并用该 ID 替换示例中的 ID。发布播放列表并分配屏幕。
{
"id": "recess-call",
"primitive": "card",
"card": "crd_01EXAMPLECARD000000000",
"layout": "full",
"content_fit": "fill"
}
写入实时数据
创建卡片后向其写入文档,之后替换该文档即可更新屏幕,无需重新发布。卡片会按其动态属性检查每次写入,并拒绝它不接受的文档。请使用与播放列表相同的项目。
将文档保存为card-data.json。CLI直接读取文档,无需包装:
{
"current": null,
"aqi": null,
"observedAt": "",
"outlook": [],
"override": "auto",
"note": ""
}
screenrig card data put crd_01EXAMPLECARD000000000 --file card-data.json
或直接调用 API。API 将相同文档包装在 document 字段中。智能体令牌已指定其项目,因此不发送项目头;若发送 ScreenRig-Project,必须与令牌项目匹配。通过环境提供 API 授权;详见 API 认证。
curl --request PUT "https://api.screenrig.ai/api/cards/crd_01EXAMPLECARD000000000/data" \
--header "Authorization: Bearer $SCREENRIG_TOKEN" \
--header "Content-Type: application/json" \
--data '{"document":{"current":null,"aqi":null,"observedAt":"","outlook":[],"override":"auto","note":""}}'