Skip to main content

Linux daemon that detects camera usage and notifies Home Assistant via webhooks.

Project description

onair-monitor

A tiny Linux daemon that detects camera usage and notifies Home Assistant via webhooks. Optionally shows a system-tray icon that turns red when a camera is active.

Install

uv tool install onair-monitor

Tray icon support

To enable the system-tray icon, install the tray extra and the required system libraries:

1. System libraries (needed to build PyGObject):

Debian / Ubuntu:

sudo apt install libgirepository-2.0-dev libcairo2-dev

Fedora:

sudo dnf install gobject-introspection-devel cairo-devel

Arch Linux:

sudo pacman -S gobject-introspection cairo

2. Install with the tray extra:

uv tool install onair-monitor --with tray

GNOME users: the tray icon requires the AppIndicator extension.

Configure

On first run, a default config is created at ~/.config/onair-monitor/config.json. Edit it to point at your Home Assistant instance:

{
  "ha_url": "http://homeassistant.local:8123",
  "webhook_on": "camera_on",
  "webhook_off": "camera_off",
  "poll_interval": 2
}

The monitor POSTs to {ha_url}/api/webhook/{webhook_on|off}.

Setting up webhooks in Home Assistant

  1. Go to Settings > Automations & Scenes > Create Automation.
  2. Add a Webhook trigger and note the webhook ID.
  3. Create one automation for camera_on and one for camera_off.
  4. Use the webhook IDs in your config file.

Run

# run directly (tray icon if available, otherwise headless)
onair-monitor

# force headless mode
onair-monitor --headless

Autostart (desktop session)

onair-monitor --install-autostart

Systemd user service

onair-monitor --install-service
systemctl --user start onair-monitor.service

Uninstall

onair-monitor --uninstall
uv tool uninstall onair-monitor

The config file at ~/.config/onair-monitor/config.json is kept — remove it manually if you no longer need it.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onair_monitor-0.1.0.tar.gz (54.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onair_monitor-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file onair_monitor-0.1.0.tar.gz.

File metadata

  • Download URL: onair_monitor-0.1.0.tar.gz
  • Upload date:
  • Size: 54.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for onair_monitor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b27e2cf14beed17bc8dd07e197ae5c91d0abfcfc7ce219917115ccf9c2a55c99
MD5 e13964c67b47a96fcebcc5184b325b8b
BLAKE2b-256 038eb44ef111312ab5227962b7779dbd14c7fa090ab636a1947ce10a0eb0111e

See more details on using hashes here.

Provenance

The following attestation bundles were made for onair_monitor-0.1.0.tar.gz:

Publisher: publish.yaml on mariushelf/onair_monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onair_monitor-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: onair_monitor-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for onair_monitor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f6d2ff8fa3522e98cb3ceda5c7ea3f3469d7e1ec803c318db28edb33b82aacbc
MD5 757c4b8f8b1de92cedb4196d372dffa5
BLAKE2b-256 fd8748458349d2e7ba4f7b0ae7ee28110602577fdf597cb48fdeddb1530e4ab2

See more details on using hashes here.

Provenance

The following attestation bundles were made for onair_monitor-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on mariushelf/onair_monitor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page