AutoCamLight
╔═══╗ ╖ ╔═══╕ ╖ ╖ ╖
║ ║ ║ ║ ║ ° ║ ║
╠═══╣╖ ╓╠═╛╔══╗║ ╒══╗╔═╦═╗║ ╖╔══╗╠══╗╠═╛
║ ║║ ║║ ║ ║║ ╔══╣║ ║ ║║ ║║ ║║ ║║
╜ ╙╚══╝╚═╛╚══╝╚═══╛╚══╝╜ ╙ ╙╚═══╛╙╚══╣╜ ╙╚═╛
╓ ║
AutoCamLight ╚══╝
A small linux utility to automate your webcam light via Home Assistant.
Monitors /dev/video* and sends a state update to HA via MQTT when it detects that video is being captured.
Usage
Install, configure and run in the background.
After the first time the webcam is used, the device & entity will be created in Home Assistant, so you can set up your automations.
Install
Use of uv is highly recommended:
uv tool install autocamlight
Configure
Create a autocamlight.toml file in one of the following locations:
- $XDG_CONFIG_HOME (or ~/.config if unset), or
- $XDG_CONFIG_DIRS (or /etc/xdg if unset), read as a list of folder split by :, as per the XDG specification, or
- the current working directory.
The files are read in the order they are listed, so you can override settings. But only top level keys can be overridden in their entirety, no table merging is performed.
Example configuration with some comments:
# Log level, one of: CRITICAL, ERROR, WARNING, INFO, DEBUG
log_level = "DEBUG"
# Time to wait for inotify events, in seconds.
# Longer times will reduce CPU usage, but will increase the delay and jitter of the state updates.
inotify_block_duration = 0.1
# Time to wait after before sending the state update, in seconds.
# If another event is received before this time, the timer is reset.
debounce_duration = 0.5
# MQTT settings from https://github.com/unixorn/ha-mqtt-discoverable
[mqtt]
host = "homeassistant.local"
username = "mqtt"
password = "Correct Horse Battery Staple"
# Entity settings from https://github.com/unixorn/ha-mqtt-discoverable
[entity]
name = "Webcam"
unique_id = "fe4bd497-7c2f-4f35-899f-f147f9f84738-capturing"
# Device settings from https://github.com/unixorn/ha-mqtt-discoverable
[entity.device]
name = "Webcam"
identifiers = "fe4bd497-7c2f-4f35-899f-f147f9f84738"
The file structure is dictated mostly by ha_mqtt_discoverable.
Auto-run on login
Create a new (user) unit file:
systemctl --user --force --full edit autocamlight
Add the following to the file, assuming uv is installed in /usr/bin:
[Unit]
Description=AutoCamLight
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/uv tool run autocamlight
Restart=on-failure
RestartSec=5
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=default.target
Now enable & start the unit:
systemctl --user enable autocamlight
systemctl --user start autocamlight
You can monitor the service status with:
systemctl --user status autocamlight
journalctl --user -u autocamlight -f
Test
Open any program that uses the webcam, e.g. Cheese.
If you have the logs open, an INFO message should appear. The entity should be created in Home Assistant.
Support the Project
If you find this project useful, a tip is always welcome via PayPal:
Metadata
Release files for autocamlight 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autocamlight-0.2.0.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autocamlight-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / autocamlight-0.2.0.tar.gz
| Download URL | autocamlight-0.2.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93f085bea65e8f13e00ac6c3b43f2291af6ca046e382039f6617c9a29fe0e5ba
|
|
BLAKE2b-256 checksum How to use checksums |
c13afc1eeb7ce5d251dab5fd105fa82c5ac55784b1ec9ed6a8e1af9f04a0494b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2025.
Transparency logRelease files / autocamlight-0.2.0-py3-none-any.whl
| Download URL | autocamlight-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c8aeed85389c2356aef11570088ce79aebad074252b6e48fbb39a53d2b2119a5
|
|
BLAKE2b-256 checksum How to use checksums |
24a9ae286d6125fbf8568f6e2dc744f38ff4a8d25bcaf3d8fff5f66a936a6391
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2025.
Transparency log