GitHub - hparadiz/camera-notif: Receive motion/person/sound notifications from Google Nest cameras and watch live video in a small always-on-top desktop window on KDE Plasma

3 min read Original article ↗

Receive motion/person/sound notifications from Google Nest cameras and watch live video in a small always-on-top desktop window on KDE Plasma.

Technical Hurdles Project Demonstrates:

  • Software rendering video to plasma compositor overlay layer in real time. Perfect high frames even while gaming.
  • WebRTC + SDP video signaling. Signal upgrade and downgrade on the fly.
  • WebRTC -> v4l2loopback

plasma-overlay-demo


What it does

  • Opens a live video stream from Google Home in a floating overlay window. The window draws on top of everything — including full-screen games and videos — and doesn't appear in the taskbar or Alt+Tab. It can be pinned to any screen corner.
  • A tray icon lets you show or hide the window with a single click.
  • The stream reconnects automatically if it drops.
  • Can also stream to a virtual webcam you can use in any program that consumes video streams like OBS.

Requirements

You'll need a few libraries installed before building. On Debian/Ubuntu:

sudo apt install build-essential pkg-config \
    libcurl4-openssl-dev libssl-dev \
    libdatachannel-dev \
    libwayland-dev \
    libavcodec-dev libavutil-dev libswscale-dev \
    libayatana-appindicator3-dev

On Arch Linux:

pacman -S base-devel pkgconf curl openssl \
    libdatachannel wayland ffmpeg libayatana-appindicator

Build

The binary is written to build/camera-notif.


Setup

Before running, you need to register with Google's device API. This is a one-time process.

1. Register a Device Access project

Go to the Device Access Console, create a project (one-time $5 fee), and note the Project ID.

2. Create Google Cloud credentials

  1. In the Google Cloud Console, enable the Smart Device Management API and the Cloud Pub/Sub API.
  2. Go to APIs & Services → Credentials, create an OAuth 2.0 client ID (Desktop app type), and note the client ID and secret.
  3. On the OAuth consent screen, add yourself as a test user with these scopes:
    • https://www.googleapis.com/auth/sdm.service
    • https://www.googleapis.com/auth/pubsub
  4. Create a Pub/Sub topic and subscription for receiving events:
    gcloud pubsub topics create camera-events --project YOUR_GCP_PROJECT
    gcloud pubsub subscriptions create camera-sub \
        --topic camera-events --project YOUR_GCP_PROJECT
  5. Back in the Device Access Console, link the topic (projects/YOUR_GCP_PROJECT/topics/camera-events) to your project.

3. Configure

Edit .env and fill in your credentials:

CLIENT_ID=...
CLIENT_SECRET=...
SDM_PROJECT_ID=...
PUBSUB_SUBSCRIPTION=projects/YOUR_GCP_PROJECT/subscriptions/camera-sub

Running

First run

The first time you run, it will ask you to open a URL in your browser and paste back an authorization code. After that, it handles token refresh automatically.

Watch for events (default mode)

Logs camera events as they arrive and saves clip images to clips/.

Live video overlay

./build/camera-notif --widget

Opens a small video window in the corner of your screen. The window starts hidden — click the tray icon to show it. Right-click the tray icon to choose which corner to pin it to, or to exit.

If you have multiple cameras, pass the device number shown at startup:

./build/camera-notif --widget 1

Other options

--stream-play       Open the stream in an ffplay window
--stream-v4l2 DEV   Feed the stream into a v4l2loopback device
--force-reauth      Re-run the Google sign-in flow
--help              Show all options

Troubleshooting

Problem Fix
CLIENT_ID not set Make sure .env exists and is filled in
Sign-in fails with invalid_client Double-check the client ID and secret in .env
Sign-in fails with invalid_grant The code expires quickly — paste it immediately after copying
HTTP 403 on startup Make sure both APIs are enabled in Google Cloud and your project IDs match
No events arriving Check that the Pub/Sub topic is linked in the Device Access Console
No video overlay Your build is missing the wayland or ffmpeg libraries — check the make output
No tray icon The appindicator library is missing — install libayatana-appindicator3-dev
Stream disconnects Normal — it reconnects automatically