Automate Papal Election Smoke Detection with Playwright and AI
Job to be done: Automate checking for white smoke from the Sistine Chapel chimney during a papal election
🇳🇬 Ways to use this in Nigeria
Ideas to get you started, adapt to your situation.
- Student
Automate checking for white smoke from the Sistine Chapel chimney during a papal election using Playwright and AI.
What this is, in plain English
When the Catholic Church elects a pope, the cardinals meet in secret (a “conclave”) and burn their ballots after each vote. The chimney smoke is black if there is no decision yet and white once a new pope is chosen. This project automates watching for that: a web-automation tool (Playwright) grabs the live video of the chimney every minute, and an AI that can look at images (Google Gemini Flash) is asked “is this smoke white?”. When it is, the script flags it.
Be honest about two things. First, the pope-watching is the fun demo; the real, reusable value is the pattern underneath, point a camera or web page at an AI on a schedule and have it judge a visual condition for you. Second, this is a developer project, not a one-click app: you clone a code repository, add an AI key, and set up a scheduled job. That is why it is marked advanced. This page shows what it does, where the pattern is genuinely useful, and the realistic shape of running it.
What you can use it for
The same “watch a feed, let AI judge it, then alert” recipe applies far beyond a chimney:
- Watch a webcam for an event. Check a shop, car park, or gate camera and get notified when something specific happens (a space opens, a queue forms, a shutter rolls up).
- Monitor a web page for a visual change. Catch when a dashboard turns red, a “sold out” label appears, or a status light changes.
- Spot deliveries or arrivals. Flag when a van pulls up or a package is left at a door.
- Quality or safety checks on a schedule. Have AI glance at a live view periodically and raise a flag when it looks wrong.
- Any “is this picture showing X right now?” question you would otherwise have to sit and watch for.
Tools you need
- Playwright (free): an open-source tool that controls a web browser automatically, used here to load the live feed and capture an image.
- Google Gemini Flash 2.0 (freemium): a fast AI model that can look at an image and answer questions about it. It has a free API tier.
- GitHub Actions (freemium): GitHub’s built-in scheduler, used to run the check automatically every minute. It has a free monthly allowance.
How it actually works
You are adapting an existing project, not writing it from scratch. The realistic path:
-
Clone the repository. Copy the project’s code to your machine (or fork it on GitHub). It already contains the Playwright script.
-
Install the dependencies. In the project folder, install the Node.js packages it needs (the README lists the exact command, usually
npm install). -
Get a Gemini API key and store it safely. Create a free key in Google AI Studio, then add it as a GitHub Actions “secret” (an encrypted setting), not as plain text in the code. The workflow file reads it from there.
-
Point the script at your feed. Set the image or live-feed URL you want watched. For the original, that is the chimney camera; for your own use, swap in your camera or page.
-
Let the schedule run it. GitHub Actions runs the script on a timer (every minute in the original). Each run captures an image and asks the AI. A starting prompt:
Analyze this image of smoke coming from a chimney. Is the smoke white? Respond with only 'yes' or 'no'. -
Read the result. The run passes (or sends your alert) only when the AI answers yes. You can see each run’s outcome in the GitHub Actions history.
Words you’ll see, explained
- Playwright: a tool that drives a web browser automatically, for loading pages and taking screenshots.
- Gemini Flash: a fast AI model that can read and answer questions about images.
- GitHub Actions: a service that runs your code on a schedule or when you push changes.
- API key: a secret key that lets your script use an online service (here, Gemini) and bills it to you.
- Secret: an encrypted setting (for example in GitHub Actions) where you store keys so they never appear in your code.
- Conclave: the closed-door meeting where cardinals elect a pope.
Original source
Based on a Show HN post by vasusen on Hacker News, demonstrating Playwright plus Google Gemini Flash to automatically check the Sistine Chapel chimney during a papal conclave, with the scheduled check passing only when the smoke is white.
Notes & variations
- Do you even need this? For a single rare event, a person glancing at the live feed is simpler. The automation earns its place when you want a feed watched continuously or repeatedly, which is where the general pattern shines.
- Free-tier viability: Playwright is free, GitHub Actions has a generous free allowance, and Gemini Flash has a free API tier, so personal use costs nothing.
- Common pitfall: never paste an API key directly into your code, especially in a public repository. Always use a secret, as in step 3.
- Tip for better results: swap the prompt to detect whatever you care about (“Is a delivery van visible?”, “Is the status light red?”). If the AI struggles with a blurry image, a clearer feed or a text status source can be more reliable.