ax-devil-mqtt
Python package for easy configuration and consumption of an Axis devices analytics data over MQTT.
See also ax-devil-device-api and ax-devil-rtsp for related tools.
Install
pip install ax-devil-mqtt
Configure (optional)
Set environment variables to avoid repeating credentials and broker details:
AX_DEVIL_TARGET_ADDR– Device IP or hostnameAX_DEVIL_TARGET_USER– Device usernameAX_DEVIL_TARGET_PASS– Device passwordAX_DEVIL_MQTT_BROKER_ADDR– MQTT broker addressAX_DEVIL_MQTT_BROKER_PASS– MQTT broker password
CLI
Run ax-devil-mqtt --help or ax-devil-mqtt help <command> for full details. Common flows:
- Discover analytics data sources:
ax-devil-mqtt list-sources \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password>
- Monitor an analytics stream (use your IP instead of
localhostfor the broker):
ax-devil-mqtt monitor \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password> \
--broker-address <broker-ip> \
--broker-port 1883 \
--stream "com.axis.analytics_scene_description.v0.beta#1" \
--duration 3600 # 0 to run continuously
- Subscribe to an existing MQTT topic without configuring the device:
ax-devil-mqtt subscribe \
--broker-address <broker-ip> \
--broker-port 1883 \
--topic "some/topic"
- Inspect or clean analytics publishers configured on the device:
ax-devil-mqtt list-publishers \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password>
ax-devil-mqtt clean \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password>
- Open the device’s Analytics MQTT API UI in your browser:
ax-devil-mqtt open-api \
--device-ip <device-ip> \
--device-username <username> \
--device-password <password>
Python API
import time
from ax_devil_mqtt import AxisAnalyticsMqttClient, RawMqttClient, MqttMessage
from ax_devil_device_api import DeviceConfig
# Subscribe to an existing topic
client = RawMqttClient(
broker_host="192.168.1.100",
broker_port=1883,
topics=["some/topic"],
message_callback=lambda message: print(message.payload),
worker_threads=1, # dispatch callbacks on a background thread
)
client.start()
time.sleep(5)
client.stop()
# Or configure the device to publish analytics and subscribe automatically
device_config = DeviceConfig.https(host="192.168.1.200", username="root", password="pass")
analytics_client = AxisAnalyticsMqttClient(
broker_host="192.168.1.100",
broker_port=1883,
device_config=device_config,
analytics_data_source_key="com.axis.analytics_scene_description.v0.beta#1",
message_callback=lambda message: print(message.payload),
worker_threads=1,
)
analytics_client.start()
time.sleep(5)
analytics_client.stop()
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
mypy src tests
Disclaimer
This project is an independent, community-driven implementation and is not affiliated with or endorsed by Axis Communications AB. For official APIs and development resources, see the Axis Developer Community.
License
MIT License - see LICENSE for details.
Metadata
Release files for ax-devil-mqtt 0.5.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 | Provenance | Actions |
|---|---|---|---|---|
| ax_devil_mqtt-0.5.0.tar.gz | 12.9 kB | Without provenance | Details for ax_devil_mqtt-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ax_devil_mqtt-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for ax_devil_mqtt-0.5.0-py3-none-any.whl |
Total release size: 24.5 kB
Release files / ax_devil_mqtt-0.5.0.tar.gz
| Download URL | ax_devil_mqtt-0.5.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bc22995793dfd7bcb1cfad159c7542baf5ae36183a70faf5345af68bb0b8edb
|
|
BLAKE2b-256 checksum How to use checksums |
b32f0fb0aed8944923731a0448d0d2c8bca7a77665efd180d4351c2a524e17a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / ax_devil_mqtt-0.5.0-py3-none-any.whl
| Download URL | ax_devil_mqtt-0.5.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4171d61f8d172ac66eebc13c93deb0147d36d3b3f67babe981dcc0774615fd3d
|
|
BLAKE2b-256 checksum How to use checksums |
6ea9dfe9f79194e280207ea0049a2f8423dfdb31e2f8406671b0394e61893540
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for ax-devil-mqtt 0.5.0
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.