call_detector
call_detector listens to microphone and camera states to detect if the user is participating in an online call. Gathered information is being published to an MQTT broker.
Where it works
Currently only Linux is supported, I don't have plans to support other operating systems. If you're interested, feel free to open a PR.
In order to use call_detector you'll need pulseaudio or pipewire-pulse and libpulse.
How it works
call_detector listens to pulseadio events to detect apps which use the microphone and uses inotify with some /proc magic to find apps which use the camera.
MQTT
call_detector was only tested against mosquitto MQTT broker with login/password authentication and TLS enabled, however in therory it can work without TLS and authentication and against any broker supported by gmqtt.
Every time the call_detector detects an app which starts or stops using the microphone or the camera,
it publishes a message to an MQTT topic with name of the format call_detector/<hostname> where hostname is the hostname
of the machine where you run call_detector. Also it sends a message on start and every minute.
Message examples:
{"camera": [], "microphone": [], "call": false} when camera and microphone are not active.
{"camera": ["firefox"], "microphone": ["firefox"], "call": true} when user is in an online call using firefox.
Installation
pip install call_detector
Usage
Basic usage:
call_detector -H mqtt.example.com -U user -P password
More advanced options can be found in help
call_detector --help
Home Assistant
Binary sensor:
binary_sensor:
- platform: mqtt
name: "User in an online meeting"
state_topic: "call_detector/<hostname>" # check call_detector --help to find the default topic for your computer
value_template: "{{ 'ON' if value_json.call else 'OFF' }}"
json_attributes_topic: "call_detector/<hostname>" # same as state_topic
json_attributes_template: "{{ value_json | tojson }}"
qos: 1
Automation example:
- alias: Pause music while User is in an online meting
trigger:
- platform: state
entity_id: binary_sensor.user_in_an_online_meeting
to: "on"
condition:
- condition: state
entity_id: media_player.mpd
state: "playing"
action:
- service: media_player.media_pause
data:
entity_id: media_player.mpd
- wait_for_trigger:
- platform: state
entity_id: binary_sensor.user_in_an_online_meeting
to: "off"
- service: media_player.media_play
data:
entity_id: media_player.mpd
Contribution
You know;)
Metadata
Release files for call-detector 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| call_detector-0.2.4.tar.gz | 5.9 kB | Without provenance | Details for call_detector-0.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| call_detector-0.2.4-py3-none-any.whl | Python 3 | none | any | Details for call_detector-0.2.4-py3-none-any.whl |
Total release size: 13.1 kB
Release files / call_detector-0.2.4.tar.gz
| Download URL | call_detector-0.2.4.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ed43acf510f14a343f0d6336237631ca3d5cdafb4291a4858649ca53cdfb2b5
|
|
BLAKE2b-256 checksum How to use checksums |
5b08b036ccbcdbcf67123c0d0f9d46da9b0c4905a8c29fce79c03be96f74f65e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Release files / call_detector-0.2.4-py3-none-any.whl
| Download URL | call_detector-0.2.4-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dbf4240b7fbd5a67ce4b80749bee6c48b5454bd0ea353a422321825e30bbd9e3
|
|
BLAKE2b-256 checksum How to use checksums |
937db778a4d93b04a70437719ea4e20426d8280d5ed1faaf1d1c71990eaff121
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
|
Security for call-detector 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.