screentinker/Examples/PIP-USD-Cap-Alert-Monitor-NOAA/make-demo-alert.js
ScreenTinker ab771ec595 Add PiP overlay example recipes
Self-contained examples for the PiP overlay API (POST /api/pip), each
with a CSP-safe query-param overlay (external JS), config.example.json,
zero runtime deps, an offline test, and a README:

- PIP-Announce-Broadcast    manual one-shot message to a screen/group
- PIP-Weather-Widget        Open-Meteo current conditions (keyless)
- PIP-Air-Quality           Open-Meteo US AQI widget (keyless)
- PIP-Crypto-Ticker         CoinGecko price strip (keyless)
- PIP-News-Ticker           scrolling RSS/Atom headlines
- PIP-Room-Status-Calendar  ICS-driven Available/Busy room sign
- PIP-Event-Countdown       client-side countdown, auto-clears at zero
- PIP-Welcome-Board         rotating welcome/birthday cards from CSV
- PIP-Fundraiser-Thermometer goal-progress bar from local/URL JSON
- PIP-QR-Rotator            rotating QR codes, encoded client-side
- PIP-Incident-Webhook      event-driven: red on firing, clear on resolved

Also includes the CAP-AU (NSW RFS) and US NWS/NOAA emergency-alert
monitors that push expiry-aware PiP overlays.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 20:17:38 -05:00

26 lines
1.3 KiB
JavaScript

// Usage: node make-demo-alert.js [seconds] [outfile]
// Writes a NWS-shaped FeatureCollection with one Extreme alert expiring `seconds` from now
// (default 90). Point the monitor's config.test_feed_file at the output to watch show->expire.
const fs = require('fs');
const secs = parseInt(process.argv[2] || '90', 10);
const out = process.argv[3] || 'demo-noaa.json';
const now = new Date();
const expires = new Date(now.getTime() + secs * 1000);
const fc = {
type: 'FeatureCollection',
features: [{
id: 'https://api.weather.gov/alerts/DEMO-EXPIRY-1', type: 'Feature', geometry: null,
properties: {
id: 'DEMO-EXPIRY-1', areaDesc: 'Demo County',
sent: now.toISOString(), effective: now.toISOString(), onset: now.toISOString(),
expires: expires.toISOString(), ends: expires.toISOString(),
status: 'Actual', messageType: 'Alert', category: 'Met',
severity: 'Extreme', certainty: 'Observed', urgency: 'Immediate',
event: 'Tornado Warning', senderName: 'NWS Demo Office',
headline: `DEMO alert — auto-clears at ${expires.toLocaleTimeString()}`, response: 'Shelter',
},
}],
};
fs.writeFileSync(out, JSON.stringify(fc, null, 2));
console.log(`wrote ${out}: DEMO Tornado Warning expiring in ${secs}s (at ${expires.toISOString()})`);