Skip to main content

Voice Activity Detection to MQTT bridge using ovos-plugin-manager

Project description

vad2mqtt

Bring the entire OpenVoiceOS VAD ecosystem into Home Assistant as IoT sensors.

vad2mqtt is a real-time Voice Activity Detection bridge built on ovos-plugin-manager. It listens to any microphone, loads any OPM VAD plugin, and publishes speech probability, noise level, and a speech-detected binary sensor to MQTT — with full Home Assistant auto-discovery.

Because OPM plugins are interchangeable, every current and future OVOS VAD plugin instantly becomes a Home Assistant sensor with zero code changes. Install ovos-vad-plugin-silero today, swap to ovos-vad-plugin-webrtcvad tomorrow, or drop in a community plugin next week — vad2mqtt adapts automatically.

A complementary occupancy signal from the microphone you already own.

Why this exists — complementary occupancy detection

Most rooms already have a microphone (smart speakers, SBCs with a cheap USB mic, intercom panels, old phones running Home Assistant Companion). A Voice Activity Detector adds a privacy-respecting complementary occupancy signal with zero extra hardware:

  • Complementary, not standalone. VAD is one input among many (PIR, mmWave, door sensors, etc.). It feeds into a probabilistic occupancy estimator such as Area Occupancy Detection. Both the binary Speech Detected sensor and the continuous Noise Level sensor are useful inputs.
  • No audio ever leaves the device. Only a 0–1 float (speech probability) and a dB value cross the wire. No transcription, no wake-word, no cloud.
  • Lightweight. Silero VAD runs in ~1 ms per 30 ms frame on a Raspberry Pi. CPU usage is negligible.
  • Fills gaps PIR leaves behind. PIR sensors need motion + heat. VAD catches presence when someone is sitting still at a desk or behind a PIR blind spot. It also misses people who are silent, which is why it must be fused with other sensors rather than used alone.

What it does

  1. Real-time audio — captures microphone input in small chunks (default 30 ms).
  2. OPM VAD plugin — loads any ovos-plugin-manager VAD engine. Default is ovos-vad-plugin-silero (ONNX, lightweight).
  3. Speech probability — publishes a 0.0–1.0 float every chunk.
  4. Noise level — publishes RMS dB at a throttled interval.
  5. MQTT + Home Assistant — 4 auto-discovered entities under one device.

Quick start (Docker)

# PipeWire / PulseAudio host (most modern desktops)
vim docker-compose.yml   # set MQTT_HOST
docker compose up -d
# Pure ALSA host (e.g. Raspberry Pi)
# Uncomment the `devices:` line in docker-compose.yml and set ALSA_CARD
vim docker-compose.yml
docker compose up -d

Quick start (pip)

pip install vad2mqtt
vad2mqtt

Home Assistant entities (4 under one device)

Entity Type Payload Note
VAD Probability sensor 0.87 0.0–1.0, state_class: measurement
VAD Model sensor ovos-vad-plugin-silero Static-ish, updates on startup
Noise Level sensor -45.2 dB, device_class: sound_pressure
Speech Detected binary_sensor ON / OFF Derived from threshold

Configuration

All settings are environment variables:

Variable Default Description
MQTT_HOST localhost Broker host
MQTT_PORT 1883 Broker port
MQTT_USER Auth user
MQTT_PASSWORD Auth password
MQTT_TOPIC_PREFIX vad2mqtt Topic root
SAMPLE_RATE 16000 Audio sample rate
SOUND_DEVICE sounddevice device index/name
ALSA_CARD ALSA card string (for PipeWire/ALSA)
VAD_PLUGIN_MODULE ovos-vad-plugin-silero OPM plugin module name
VAD_PLUGIN_CONFIG JSON extra config for plugin
VAD_THRESHOLD 0.5 Speech / silence cutoff
HA_ENABLED true Auto-discovery toggle
DEVICE_NAME vad2mqtt HA entity prefix
DEVICE_ID vad2mqtt_01 HA device identifier
PUBLISH_INTERVAL 0.5 Min seconds between VAD publishes
NOISE_LEVEL_INTERVAL 2.0 Min seconds between noise publishes
NOISE_LEVEL_DELTA 3.0 dB jump that bypasses interval
LOG_LEVEL INFO Logging level

Switching VAD plugins — the OPM advantage

Because vad2mqtt uses ovos-plugin-manager, you can swap VAD engines with a single environment variable. Every current and future OVOS VAD plugin is supported:

# Silero VAD — best accuracy, ONNX, ~1 ms/frame on Pi (default)
pip install ovos-vad-plugin-silero
VAD_PLUGIN_MODULE=ovos-vad-plugin-silero

# WebRTC VAD — lighter, no ML model
pip install ovos-vad-plugin-webrtcvad
VAD_PLUGIN_MODULE=ovos-vad-plugin-webrtcvad

# Noise-based VAD — threshold-based, minimal CPU
pip install ovos-vad-plugin-noise
VAD_PLUGIN_MODULE=ovos-vad-plugin-noise

# Future community plugins — just install and point VAD_PLUGIN_MODULE at them

This is the power of the OVOS plugin ecosystem: new VAD research (new ONNX models, new algorithms) ships as a plain pip package. vad2mqtt consumes it immediately with zero code changes.

Architecture

Mic ──► sounddevice ──► 30 ms chunks ──► OPM VAD Plugin
                                               │
                    ┌──────────────────────────┘
                    ▼
            MQTT ──► Home Assistant
            │
            ├── vad_probability (continuous)
            ├── noise_level (throttled)
            ├── model_name (startup)
            └── speech_detected (binary, derived)

Related

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

vad2mqtt-0.1.0a1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

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

vad2mqtt-0.1.0a1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file vad2mqtt-0.1.0a1.tar.gz.

File metadata

  • Download URL: vad2mqtt-0.1.0a1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vad2mqtt-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 72f0055aea7a57285a47350bba1d69fcb58464b638f1e764673ab91518b3e572
MD5 9845ee038d2991268a1b5290905c481e
BLAKE2b-256 fbc754bc93b6107cd85471e85c08ab27080fda470411064f3bd3d3e4c1a8a1d5

See more details on using hashes here.

File details

Details for the file vad2mqtt-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: vad2mqtt-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vad2mqtt-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 3edb793ed77e36f9a91a3c1e4924a3c72e29e5ab61d93ba80d739f8089ea2a97
MD5 cf845ad2be0814ebccc2551cbf35f3e8
BLAKE2b-256 50e78b268c67143b9885d6942a2a1cbc1e6e28414a723a8d02e0d16086f234fd

See more details on using hashes here.

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