Earl Display Control
Skill for managing the VisuoSpatial Sketchpad — Earl's living-room TV dashboard. This covers starting the HTTP server, launching the kiosk browser, and updating earl_mind.json via the Python API.
All file paths below use {baseDir} to mean this skill's root directory (the repo root containing VisuoSpatialSketchpad/).
Quick Response Checklist
- 1. Wake requests ("Earl wake up", "Could not sync", "Earl is sleeping")
- Start the local server (see
Server Management)
- Launch the kiosk browser (see
Launching the Kiosk)
- Confirm health: watch for
GET /earl_mind.json ... 200 in the server log
- 2. Content updates (mood, house stuff, hot takes, doodles, weather)
- Use the
EarlMind API from
{baseDir}/VisuoSpatialSketchpad/earl_api.py
- Relaunch the kiosk after changes if the display looks stale
Server Management
Start the HTTP server from the VisuoSpatialSketchpad directory:
CODEBLOCK0
Background the process so the shell prompt returns.
Killing a stuck server
macOS / Linux:
CODEBLOCK1
Windows (PowerShell):
CODEBLOCK2
Launching the Kiosk
macOS:
open -a "Google Chrome" --args --kiosk http://localhost:8000/sketchpad.html
If Chrome is unavailable, Safari works too:
CODEBLOCK4
Windows (PowerShell):
CODEBLOCK5
Linux:
xdg-open http://localhost:8000/sketchpad.html
Or for a true kiosk with Chromium:
CODEBLOCK7
Always relaunch after a wake cycle — the browser may cache the old page.
EarlMind API Reference
All methods live in {baseDir}/VisuoSpatialSketchpad/earl_api.py. Run from the VisuoSpatialSketchpad directory:
CODEBLOCK8
Each mutating method auto-saves and bumps meta.last_updated / meta.update_count.
Method Reference
| Method | Purpose | Key Parameters |
|---|
| INLINECODE11 | Set Earl's mood and inner monologue | INLINECODE12 : str, energy: 0-1 float, vibe: str, expression: str |
| INLINECODE16 |
Set Earl's header photo |
url: str (URL or local path),
caption: str |
|
post_house_stuff(title, detail, priority, category, icon) | Add a household reminder |
priority: "high"/"medium"/"low",
icon: emoji str |
|
resolve_house_stuff(item_id) | Remove a resolved item by ID |
item_id: str (e.g. "hs_a1b2c3") |
|
clear_house_stuff() | Clear all house stuff items | — |
|
update_room(room_id, status, notes, attention) | Update a room's state |
attention: 0-1 float |
|
add_room(room_id, name, x, y, icon, status, notes, attention) | Add a new room |
x,
y: 0-1 normalized position |
|
sweep() | Log a full house sweep | — |
|
hot_take(topic, take, heat, emoji) | Add or update a hot take |
heat: 0-1 float, updates if topic exists |
|
drop_take(topic) | Remove a hot take by topic | — |
|
doodle(label, x, y, size, color, note) | Place an emoji doodle on the sketchpad |
x,
y: 0-1,
size: px,
color: hex |
|
sketch_note(text, x, y, size, color) | Place a text note on the sketchpad | Same as doodle |
|
clear_sketchpad() | Wipe the sketchpad clean | — |
|
learn_pattern(pattern, confidence, observations) | Record a long-term pattern |
confidence: 0-1,
observations: int |
|
summary() | Get a human-readable state summary | Returns str |
|
snapshot() | Get the raw mind dict | Returns dict |
Common Examples
CODEBLOCK9
Weather Update
Run the weather helper to fetch live Open-Meteo data, update mood/energy, and drop a weather doodle:
CODEBLOCK10
earl_mind.json Schema
The dashboard reads {baseDir}/VisuoSpatialSketchpad/earl_mind.json. Top-level structure:
CODEBLOCK11
If you edit JSON directly, always bump meta.last_updated and meta.update_count, and write with ensure_ascii=False, indent=2.
Troubleshooting
- - Server keeps dying — Check for duplicate python processes. On macOS/Linux:
lsof -i:8000. On Windows: Get-Process python. - Browser won't go fullscreen — Kill stray browser processes first. macOS:
pkill -f "Google Chrome". Windows: taskkill /IM msedge.exe /F. - Content not updating — Relaunch the kiosk to bust any cache. Verify the JSON saved correctly.
- Weather not working — Check that
spatial_awareness.location.latitude and longitude are set (not 0.0) in earl_mind.json. - Import error — Make sure you run Python from the
VisuoSpatialSketchpad directory, or add it to sys.path.
Tight Loop
Restart server -> launch kiosk -> apply content changes -> relaunch kiosk if needed. Follow this every time the house texts "wake up".
Earl 显示控制
管理视觉空间画板——Earl 客厅电视仪表盘的技能。包括启动 HTTP 服务器、启动自助浏览器以及通过 Python API 更新 earl_mind.json。
以下所有文件路径使用 {baseDir} 表示此技能的根目录(包含 VisuoSpatialSketchpad/ 的仓库根目录)。
快速响应清单
- 1. 唤醒请求(Earl 醒醒、无法同步、Earl 正在睡觉)
- 启动本地服务器(参见
服务器管理)
- 启动自助浏览器(参见
启动自助终端)
- 确认健康状态:在服务器日志中查看 GET /earl_mind.json ... 200
- 2. 内容更新(心情、家务、热评、涂鸦、天气)
- 使用 {baseDir}/VisuoSpatialSketchpad/earl_api.py 中的 EarlMind API
- 如果显示内容过时,更改后重新启动自助终端
服务器管理
从 VisuoSpatialSketchpad 目录启动 HTTP 服务器:
bash
cd {baseDir}/VisuoSpatialSketchpad && python3 -m http.server 8000
将进程置于后台运行,以便返回 Shell 提示符。
终止卡死的服务器
macOS / Linux:
bash
lsof -ti:8000 | xargs kill -9
Windows(PowerShell):
powershell
Get-Process -Id (Get-NetTCPConnection -LocalPort 8000).OwningProcess | Stop-Process -Force
启动自助终端
macOS:
bash
open -a Google Chrome --args --kiosk http://localhost:8000/sketchpad.html
如果 Chrome 不可用,也可使用 Safari:
bash
open -a Safari http://localhost:8000/sketchpad.html
Windows(PowerShell):
powershell
Start-Process msedge.exe --kiosk http://localhost:8000/sketchpad.html --edge-kiosk-type=fullscreen
Linux:
bash
xdg-open http://localhost:8000/sketchpad.html
或使用 Chromium 实现真正的自助终端:
bash
chromium-browser --kiosk http://localhost:8000/sketchpad.html
每次唤醒循环后务必重新启动——浏览器可能缓存了旧页面。
EarlMind API 参考
所有方法位于 {baseDir}/VisuoSpatialSketchpad/earl_api.py。从 VisuoSpatialSketchpad 目录运行:
python
from earl_api import EarlMind
mind = EarlMind()
每个修改方法会自动保存并更新 meta.lastupdated / meta.updatecount。
方法参考
| 方法 | 用途 | 关键参数 |
|---|
| setmood(mood, energy, vibe, expression) | 设置 Earl 的心情和内心独白 | mood:字符串,energy:0-1 浮点数,vibe:字符串,expression:字符串 |
| setphoto(url, caption) |
设置 Earl 的标题照片 | url:字符串(URL 或本地路径),caption:字符串 |
| post
housestuff(title, detail, priority, category, icon) | 添加家务提醒 | priority:high/medium/low,icon:表情符号字符串 |
| resolve
housestuff(item
id) | 按 ID 移除已解决的项目 | itemid:字符串(例如 hs_a1b2c3) |
| clear
housestuff() | 清除所有家务项目 | — |
| update
room(roomid, status, notes, attention) | 更新房间状态 | attention:0-1 浮点数 |
| add
room(roomid, name, x, y, icon, status, notes, attention) | 添加新房间 | x、y:0-1 归一化位置 |
| sweep() | 记录一次全面清扫 | — |
| hot_take(topic, take, heat, emoji) | 添加或更新热评 | heat:0-1 浮点数,如果主题存在则更新 |
| drop_take(topic) | 按主题移除热评 | — |
| doodle(label, x, y, size, color, note) | 在画板上放置表情涂鸦 | x、y:0-1,size:像素,color:十六进制 |
| sketch_note(text, x, y, size, color) | 在画板上放置文本笔记 | 与涂鸦相同 |
| clear_sketchpad() | 清空画板 | — |
| learn_pattern(pattern, confidence, observations) | 记录长期模式 | confidence:0-1,observations:整数 |
| summary() | 获取人类可读的状态摘要 | 返回字符串 |
| snapshot() | 获取原始思维字典 | 返回字典 |
常见示例
python
设置心情
mind.set_mood(happy, energy=0.9, vibe=阳光明媚,氛围绝佳。)
发布家务提醒
mind.post
housestuff(今晚要倒垃圾, detail=又是周三了。, priority=high, category=chores, icon=🗑️)
发布热评
mind.hot_take(菠萝披萨, 有争议但我尊重这种大胆。, heat=0.6, emoji=🍕)
在画板上涂鸦
mind.doodle(🌧️, x=0.3, y=0.2, size=30, note=开始下雨了)
记录模式
mind.learn_pattern(猫下午3点坐在窗边, confidence=0.7, observations=5)
天气更新
运行天气助手获取实时 Open-Meteo 数据,更新心情/能量,并放置天气涂鸦:
bash
cd {baseDir}/VisuoSpatialSketchpad && python3 updateweatherping.py
earl_mind.json 架构
仪表盘读取 {baseDir}/VisuoSpatialSketchpad/earl_mind.json。顶层结构:
{
identity: { name, role, mood, energy (0-1), currentvibe, avatarexpression, photo, photo_caption }
spatialawareness: { housename, location: { latitude, longitude, timezone, temperatureunit, windspeedunit }, lastsweep, rooms: [...] }
house_stuff: { items: [{ id, title, detail, priority, category, icon }] }
earl_unplugged: [{ id, topic, take, heat (0-1), emoji, date }]
sketchpad: { canvas: [{ id, type (doodle|note), label, x, y, size, color, note }] }
longtermpatterns: [{ pattern, confidence (0-1), observations }]
meta: { schemaversion, lastupdated (ISO 8601), update_count }
}
如果直接编辑 JSON,务必更新 meta.lastupdated 和 meta.updatecount,并使用 ensure_ascii=False, indent=2 写入。
故障排除
- - 服务器持续崩溃——检查是否有重复的 Python 进程。macOS/Linux:lsof -i:8000。Windows:Get-Process python。
- 浏览器无法全屏——先终止残留的浏览器进程。macOS:pkill -f Google Chrome。Windows:taskkill /IM msedge.exe /F。
- 内容未更新——重新启动自助终端以清除缓存。验证 JSON 是否正确保存。
- 天气无法工作——检查 earlmind.json 中 spatialawareness.location.latitude 和 longitude 是否已设置(不为 0.0)。
- 导入错误——确保从 VisuoSpatialSketchpad 目录运行 Python,或将其添加到 sys.path。
紧密循环
重启服务器 -> 启动自助终端 -> 应用内容更改 -> 必要时重新启动自助终端。每次收到醒醒消息时遵循此流程。