night-watch
Receives motion alert push notifications from the NightWatch R1 Creation and forwards them to your phone via a configured messaging channel (Pushover, ntfy, Telegram, or plain log).
- License 许可
- MIT
- 最近更新
- 2026-09-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- night-watch
- author
- rabbit-r1-skillz
- version
- 1.0.0
- description
- Receives motion alert push notifications from the NightWatch R1 Creation and forwards them to your phone via a configured messaging channel (Pushover, ntfy, Telegram, or plain log).
02 资源文件 3
- 资产文件card.jpg25.4 KB
- 资产文件icon.png11.1 KB
- 参考文档index.html48.4 KB
03 SKILL.md 正文
NightWatch — OpenClaw Skill
This skill is the local-machine handler for the NightWatch R1 Creation. When the R1 detects significant motion during a configured quiet window, it sends an event through the OpenClaw bridge. This skill receives the payload and dispatches a push notification to your phone.
What This Skill Does
- Watches the OpenClaw shared-storage key
openclaw:cmdfor commands withskill: "night-watch". - On
command: "push-notify", formats a push notification describing the motion event (type, time, description, magnitude). - Dispatches the notification via your configured provider:
- Pushover (recommended — instant, reliable)
- ntfy (self-hosted or ntfy.sh, no account required)
- Telegram Bot
- Log-only (no notification, just writes to a JSONL file)
- Writes a response to
openclaw:respso the R1 can confirm delivery. - Appends each event to
~/NightWatch/event-log.jsonlfor long-term history.
Setup
Prerequisites
- Node.js 18+
- OpenClaw running on your local machine and connected to the R1
- One of: a Pushover account, an ntfy topic, or a Telegram bot token
Installation
cd ~/openclaw/skills
mkdir night-watch && cd night-watch
touch index.js
Paste the following into index.js:
import fs from "fs";
import path from "path";
import os from "os";
// ── Configuration ────────────────────────────────────────────────────────────
// Choose one provider. Set the others to null to disable.
const CONFIG = {
// Pushover (https://pushover.net) — get user key and app token from dashboard
pushover: {
userKey: process.env.PUSHOVER_USER_KEY ?? null,
appToken: process.env.PUSHOVER_APP_TOKEN ?? null,
},
// ntfy (https://ntfy.sh or self-hosted)
// Example topic URL: "https://ntfy.sh/my-secret-nightwatch-topic"
ntfy: {
topicUrl: process.env.NTFY_TOPIC_URL ?? null,
},
// Telegram
telegram: {
botToken: process.env.TELEGRAM_BOT_TOKEN ?? null,
chatId: process.env.TELEGRAM_CHAT_ID ?? null,
},
};
const LOG_DIR = path.join(os.homedir(), "NightWatch");
const LOG_FILE = path.join(LOG_DIR, "event-log.jsonl");
fs.mkdirSync(LOG_DIR, { recursive: true });
// ── Handler ──────────────────────────────────────────────────────────────────
export default async function handler(command, params) {
if (command !== "push-notify") {
return { ok: false, error: `Unknown command: ${command}` };
}
const { ts, type, desc, magnitude, timeStr, inQuiet } = params;
if (!ts || !type) {
return { ok: false, error: "Missing required fields: ts, type" };
}
const typeLabel = type === "accel" ? "Vibration" :
type === "camera" ? "Camera" : "Both Sensors";
const priority = type === "combo" || magnitude >= 0.8 ? "high" : "normal";
const title = "NightWatch: " + typeLabel + " Detected";
const body = timeStr + " — " + desc +
(inQuiet ? " (quiet window)" : "") +
"\nMagnitude: " + (magnitude * 100).toFixed(0) + "%";
const logEntry = { ts, type, desc, magnitude, timeStr, inQuiet, dispatched: Date.now() };
let sent = false;
let provider = "none";
try {
if (CONFIG.pushover.userKey && CONFIG.pushover.appToken) {
await sendPushover(title, body, priority, CONFIG.pushover);
sent = true;
provider = "pushover";
} else if (CONFIG.ntfy.topicUrl) {
await sendNtfy(title, body, priority, CONFIG.ntfy);
sent = true;
provider = "ntfy";
} else if (CONFIG.telegram.botToken && CONFIG.telegram.chatId) {
await sendTelegram(title, body, CONFIG.telegram);
sent = true;
provider = "telegram";
}
} catch (err) {
logEntry.dispatchError = err.message;
}
logEntry.sent = sent;
logEntry.provider = provider;
fs.appendFileSync(LOG_FILE, JSON.stringify(logEntry) + "\n", "utf8");
return { ok: true, sent, provider };
}
// ── Pushover ──────────────────────────────────────────────────────────────────
async function sendPushover(title, body, priority, cfg) {
const res = await fetch("https://api.pushover.net/1/messages.json", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
token: cfg.appToken,
user: cfg.userKey,
title,
message: body,
priority: priority === "high" ? 1 : 0,
sound: priority === "high" ? "siren" : "pushover",
}),
});
if (!res.ok) throw new Error("Pushover HTTP " + res.status);
}
// ── ntfy ──────────────────────────────────────────────────────────────────────
async function sendNtfy(title, body, priority, cfg) {
const res = await fetch(cfg.topicUrl, {
method: "POST",
headers: {
"Title": title,
"Priority": priority === "high" ? "high" : "default",
"Tags": "rotating_light",
},
body,
});
if (!res.ok) throw new Error("ntfy HTTP " + res.status);
}
// ── Telegram ──────────────────────────────────────────────────────────────────
async function sendTelegram(title, body, cfg) {
const text = "🚨 *" + title + "*\n" + body;
const url = "https://api.telegram.org/bot" + cfg.botToken + "/sendMessage";
const res = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
chat_id: cfg.chatId,
text,
parse_mode: "Markdown",
}),
});
if (!res.ok) throw new Error("Telegram HTTP " + res.status);
}
Register the Skill
Add night-watch to your OpenClaw skills.config.json:
{
"skills": [
{ "name": "night-watch", "entry": "./skills/night-watch/index.js" }
]
}
Configure Your Provider
Set environment variables before starting OpenClaw. Use whichever provider you prefer:
Pushover (recommended):
export PUSHOVER_USER_KEY="your_user_key_here"
export PUSHOVER_APP_TOKEN="your_app_token_here"
ntfy (no account required with ntfy.sh):
export NTFY_TOPIC_URL="https://ntfy.sh/your-secret-topic-name"
Subscribe to the topic in the ntfy app on your phone.
Telegram:
export TELEGRAM_BOT_TOKEN="123456:ABC-your-bot-token"
export TELEGRAM_CHAT_ID="your-chat-id"
Get your chat ID by messaging @userinfobot on Telegram.
Restart OpenClaw after setting environment variables.
Event Log
Every motion event is appended to:
~/NightWatch/event-log.jsonl
Each line is a JSON object:
{"ts":1718300000000,"type":"accel","desc":"clear footsteps","magnitude":0.62,"timeStr":"2:14am","inQuiet":true,"dispatched":1718300000100,"sent":true,"provider":"pushover"}
You can view recent events with:
tail -20 ~/NightWatch/event-log.jsonl | jq .
Data Format Sent from R1
The R1 Creation sends the following payload via openclaw:cmd:
{
"skill": "night-watch",
"command": "push-notify",
"params": {
"ts": 1718300000000,
"type": "accel",
"desc": "clear footsteps",
"magnitude": 0.62,
"timeStr": "2:14am",
"inQuiet": true
}
}
The skill must respond by writing to openclaw:resp:
{
"status": "done",
"ts": 1718300001000,
"data": {
"ok": true,
"sent": true,
"provider": "pushover"
}
}
Troubleshooting
Notifications not arriving — Verify OpenClaw is running and the skill is registered. Check ~/NightWatch/event-log.jsonl to see if the skill received the events. Look for dispatchError fields.
"OpenClaw response timeout" in R1 app — The R1 waits 15 seconds for a response. If OpenClaw is slow to start, wait 30 seconds after launching before arming NightWatch.
Pushover 429 rate limit — Pushover allows 10,000 messages/month on the free tier. NightWatch sends at most one notification per event with an 8-second cooldown, so this limit is essentially unreachable in normal use.
False positives at night — Lower sensitivity from the R1 app by pressing PTT while on the setup screen, then scrolling. Sensitivity 1 or 2 will only trigger on clear, large motion events. You can also narrow the quiet window in G.quietStart / G.quietEnd if you need to exclude early morning activity.
Camera motion not detected — Camera detection requires the R1 browser to have camera permission. If no camera is available (or permission is denied), NightWatch falls back to accelerometer-only mode gracefully. The event log will show only accel type events.
Windows path for log file — Change LOG_DIR to an absolute Windows path, e.g.:
const LOG_DIR = "C:\\Users\\YourName\\NightWatch";
04 同仓库更多 Skills
whisper-quiz
WhisperQuiz — voice-answered trivia game for Rabbit R1. Generates questions via the R1's built-in LLM, captures spoken answers via STT, and evaluates correctness with flexible LLM-based matching.
walk-cast
Walking podcast production skill. Receives raw audio metadata and transcript from the R1, removes long pauses, applies noise reduction and normalization, generates AI chapter titles and episode metadata via LLM, and uploads the final episode to your configured podcast RSS host (Spotify for Podcasters / Anchor, Podbean, Buzzsprout, RSS.com, or any FTP-accessible feed).
voice-novel
Local machine skill for VoiceNovel — handles story export to disk.
voice-guide
Environment description and navigation assistant for blind and low-vision users. Analyzes camera frames via a vision LLM, reads visible text, identifies scene categories (people/vehicles/food/hazards/exits), performs 360° scans, retrieves GPS position, and sends emergency SMS alerts — all via audio feedback with zero screen dependency.
voice-draft
Voice-driven document drafting for the Rabbit R1. Dictate stream-of-consciousness speech; the R1 formats it into Email, Blog Post, Report, Proposal, Meeting Notes, Creative Writing, Code Comments, Cover Letter, or Tweet Thread — then saves the result to a configured folder on your local machine via OpenClaw.
voice-commit
Hands-free git and CI workflow voice controller for the Rabbit R1. Speak git/CI commands and hear results — commit, push, status, PR management, test runs, and deploy, all voice-driven via OpenClaw.