Skip to main content

Client library to control a raspberry PI camera through MQTT

Project description

# rpi-cam-mqtt-client

Client library to control a raspberry PI camera through MQTT.

Provides high level methods to control a raspberry PI camera:
  • get_cmd_list

  • get_cmd_info

  • run_command

  • get_status

  • get_ptviews

  • is_active

  • is_ptview_available

  • is_recording

  • is_detecting_motion

  • set_camera_status

  • set_motion_detection_status

  • start_video

  • stop_video

  • take_picture

  • set_exposure_mode

  • set_wb_mode

  • set_metering_mode

  • set_image_effect

  • set_pantilt

The camera needs to have the RPi-Cam-Web-Interface installed and the MQTT agent running. Check rpi-cam-mqtt (https://gitlab.com/gbus/rpi-cam-mqtt) project for further details.

## Installation

The library can be installed and called in a python module:

pip3 install rpicammqtt_client

from rpicammqtt_client import RpiCamMqttClient help(RpiCamMqttClient)

## Configuration

The configuration file is looked up from:

/etc/rpi-cam-mqtt/rpi-cam-mqtt.yaml $HOME/.rpi-cam-mqtt/rpi-cam-mqtt.yaml ./config/rpi-cam-mqtt.yaml

A template can be downloaded from:

https://gitlab.com/gbus/rpi-cam-mqtt-client/raw/master/rpicammqtt_client/config/rpi-cam-mqtt.yaml

## Use

The main class RpiCamMqttClient needs to have passed a reference to publish/subscribe custom definitions to implement the specific calls to the MQTT library of choice. One based on the paho mqtt library is provided and can be used for reference:

from rpicammqtt_client import RpiCamMqttClient from rpicammqtt_client.mqtt import MQTT

The RpiCamMqttClient needs the rpicam name as configured in the remote agent that controls the camera and a few extra options to change the MQTT behaviour.

The main method to use is run_command, which allows to publish any command as it would normally be sent to the PIPE. More info:

https://elinux.org/RPi-Cam-Web-Interface#Pipe

Additionally a few higher level methods are provided that simplify the use of the library. A good starting point is the list of examples described in the next section where it is possible to see the library in action.

## Applications

Example of applications using the library can be found in the package:

https://gitlab.com/gbus/rpi-cam-mqtt-client/tree/master/rpicammqtt_client/examples

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

rpicammqtt_client-0.3.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

rpicammqtt_client-0.3.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file rpicammqtt_client-0.3.0.tar.gz.

File metadata

  • Download URL: rpicammqtt_client-0.3.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for rpicammqtt_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 12d545dd566d3d1636ac7a3385d9a2cc711ff524945634ed1b5984ad6b9636bc
MD5 21040a396dc62c99337bf4c5dd49d4c6
BLAKE2b-256 d08bbf2dea38020205fdd6fe3107292c5bd1c83f50b8b3176ed993c73de57cdf

See more details on using hashes here.

File details

Details for the file rpicammqtt_client-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: rpicammqtt_client-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for rpicammqtt_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3cac8dc4f76bf746d2c3f5dd855c75b9e129fb4e6bff15af4f35fb1ae48220c
MD5 af44aecba0dd44b3d243ec8633c929e5
BLAKE2b-256 f8e5866a11ad4bebb1ba31171002ade5e599b87dd880fe55a949d260d18d076f

See more details on using hashes here.

Supported by

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