{ "info": { "author": "Gianluca Busiello", "author_email": "gianluca.busiello@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "Rpi-Cam-MQTT\n------------\n\nMqtt agent for RPi-Cam-Web-Interface (https://elinux.org/RPi-Cam-Web-Interface) project.\n\nThe agent runs on a raspberry pi where RPi-Cam-Web-Interface is installed and running.\n\nThe main objective is to provide an mqtt interface to the FIFO file (/var/www/FIFO11) to inject commands and get the status from status_mjpeg.txt. \n\nAdditionally, the support for pantilt is also available (check below).\n\nThe agent has been developed with the specific purpose to simplify the integration with homeassistant; this is made possible through the dedicated HA camera platform \"rpicam\" (https://gitlab.com/gbus/ha-rpicam), currently under development. \nAnyway, the generic nature of the mqtt messages makes it possible to use any mqtt controller to read and send info with the agent.\n\nWhen connected to an MQTT server it is possible to:\n- get the camera status\n- send remote mqtt commands to control the camera\n- send remote mqtt commands to control pantilt (if available)\n- list pan/tilt views (if pantilt available and views configured)\n\nThe topics are:\n- _`rpicam//status`_, status from /dev/shm/mjpeg/status_mjpeg.txt\n- _`rpicam/`_, topic used to publish commands \n- _`rpicam//pt`_, topic used to publish pan/tilt commands\n- _`rpicam//pt/views`_, list of configured views\n- _`rpicam//events/motion`_, motion events\n\nInstallation\n------------\n\n- From pypi\n\nEnsure that the command pip3 is installed and run:\n\n sudo pip3 install rpicammqtt\n\n\n- Development code from gitlab\n\nInstall the requirements, clone the repo and run the setup:\n\n sudo apt-get install git python3-setuptools python3-yaml\n git clone git@gitlab.com:gbus/rpi-cam-mqtt.git\n\n cd rpi-cam-mqtt\n sudo python3 setup.py install\n\nConfiguration\n-------------\n\nThe configuration is looked up in:\n\n /etc/rpi-cam-mqtt/rpi-cam-mqtt.yaml\n $HOME/.rpi-cam-mqtt/rpi-cam-mqtt.yaml\n\nCreate the preferred directory:\n\n sudo mkdir /etc/rpi-cam-mqtt\n or\n mkdir $HOME/.rpi-cam-mqtt\n\ncd into it and add the files:\n\n sudo wget https://gitlab.com/gbus/rpi-cam-mqtt/raw/master/rpicammqtt/config/rpi-cam-mqtt.yaml\n sudo wget https://gitlab.com/gbus/rpi-cam-mqtt/raw/master/rpicammqtt/config/Adafruit_PCA9685.yaml\n\nIn rpi-cam-mqtt.yaml change at least the following:\n\n - Camera name\n - MQTT server address\n - MQTT user/pw\n\nConfigure the service to start at boot:\n\n sudo wget -o /etc/systemd/system/rpi-cam-mqtt.service https://gitlab.com/gbus/rpi-cam-mqtt/raw/master/rpicammqtt/systemd/rpi-cam-mqtt.service\n sudo systemctl daemon-reload\n sudo systemctl enable rpi-cam-mqtt\n sudo systemctl start rpi-cam-mqtt\n\nMotion events\n-------------\n\nWhen RPi-Cam-Web-Interface is set in monitoring mode, a macro is executed every time motion starts or stops.\n`rpicam` is able to publish these events as MQTT message on a dedicated topic:\n\n rpicam//events/motion\n\nThe macro relies on the netcat command:\n\n sudo apt-get install netcat\n\nAdd to the macro path the following script:\n\n cat /macros/motion_event.sh\n (usually webpath = /var/www/html)\n\n #!/bin/bash\n printf $1 | /bin/netcat 127.0.0.1 8888\n\nensure the script `motion_event.sh` is executable.\n\n\nPan/Tilt\n--------\n\nPan/Tilt can be enabled and it is based on the PCA9685 controller and the Adafruit library.\nIt is possible to predefine pan/tilt pair values with memorable names so that the camera can be instructed to point to a specific location (ie: point to \"front_window\").\nThe configuration looks like this:\n\n pantilt:\n views:\n front_window:\n - 560\n - 355\n door:\n - 420\n - 355\n\nThe pan/tilt values can be easily identified running the command \"configpt\", available from your path after the installation of the module.\n\nThis allows you to move the arrow keys while watching the live feed from the camera and get the pan/tilt values:\n\n # configpt\n\n\n\n Pan: 540 Tilt: 470\n\n\nWhen the views are noted down with the correct pan/tilt values press q to exit the command.\n\n\nTesting\n-------\n\n- Test camera status and PIPE commands\n\nAn easy way to test the agent is to check the topics for your camera with an mqtt client, ie with mosquitto:\n\n mosquitto_sub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME/status\n mosquitto_sub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME/pt/views\nor all of it:\n\n mosquitto_sub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -F 'Topic: %t\\nMsg: %p\\n' -t rpicam/CAMERA_NAME/#\n\n\nIt is possible to send any commands you would normally send to the FIFO file as described in the documentation (https://elinux.org/RPi-Cam-Web-Interface#Pipe), ie:\n\n Disable the camera:\n mosquitto_pub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME -m \"ru 0\"\n\n Enable motion detection:\n mosquitto_pub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME -m \"md 1\"\n\n Set a new annotation and add a background to the text:\n mosquitto_pub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME -m \"an Entrance hall %Y.%M.%D_%h:%m:%s\"\n mosquitto_pub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME -m \"ab 1\"\n\nWhen the agent receives the string commands, they are parsed before being sent to the pipe. The filtering is based on the type schema and the limits defined in data/rpi-cam-info.json \n\n- Test pan/tilt views and commands\n\nThe camera can be pointed to different corners by setting values for pan and tilt like this:\n\n mosquitto_pub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME/pt -m \"{\\\"pan\\\": 380, \\\"tilt\\\": 300}\"\n\nAlternatively, one of views can be retreived:\n\n mosquitto_sub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME/pt/views\n\n...and used:\n\n mosquitto_sub -h MQTTSRV_IP -p 1883 -u USERNAME -P PASSWORD -q 1 -t rpicam/CAMERA_NAME/pt -m \"{\\\"view\\\": \\\"front_window\\\"}\"\n\nDebug\n-----\n\nAfter the agent is started by systemctl check for process errors:\n\n systemctl status rpi-cam-mqtt\n\nIf the process is correctly run, check the logs:\n\n tail -f /var/log/rpi-cam-mqtt.log\n\nIncrease the logging level in the configuration if needed:\n\n logging:\n level: ERROR|INFO|DEBUG\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/gbus/rpi-cam-mqtt", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "rpicammqtt", "package_url": "https://pypi.org/project/rpicammqtt/", "platform": "", "project_url": "https://pypi.org/project/rpicammqtt/", "project_urls": { "Homepage": "https://gitlab.com/gbus/rpi-cam-mqtt" }, "release_url": "https://pypi.org/project/rpicammqtt/0.10.1/", "requires_dist": [ "PyYaml (>=3.12)", "paho-mqtt (>=1.4.0)", "adafruit-pca9685" ], "requires_python": "", "summary": "Mqtt agent for rpi-cam-web-interface", "version": "0.10.1" }, "last_serial": 4907805, "releases": { "0.10.1": [ { "comment_text": "", "digests": { "md5": "1269997296b488c55c55bd019b014be6", "sha256": "4df64a6e07b150c1c30433f5dc2d26f03f494c3df76b8ab2d43f402a5a65eebb" }, "downloads": -1, "filename": "rpicammqtt-0.10.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1269997296b488c55c55bd019b014be6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19877, "upload_time": "2019-03-07T00:47:47", "url": "https://files.pythonhosted.org/packages/b3/e1/dcb3bc5907359b62172a4c6a6f7942eff02fe7cf993e9b974640d1c0fbe5/rpicammqtt-0.10.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "171f89ec8b101223e2a3e198b0d8d40e", "sha256": "b0fb18599a9a4550fd24f857d12fb4f09f398a0de0277af58bd1746bc18b8c6e" }, "downloads": -1, "filename": "rpicammqtt-0.10.1.tar.gz", "has_sig": false, "md5_digest": "171f89ec8b101223e2a3e198b0d8d40e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12185, "upload_time": "2019-03-07T00:47:48", "url": "https://files.pythonhosted.org/packages/df/67/ede5c97bfe571e70fcb78c9df8723c002c3c5a2574dd630300db176ffa53/rpicammqtt-0.10.1.tar.gz" } ], "0.9.4": [ { "comment_text": "", "digests": { "md5": "832be98a05f1c9876bc42067be0d9676", "sha256": "e4436745651b6bacfd47223ec97bd9abb99302caefe16582e14f2abc75db0fe4" }, "downloads": -1, "filename": "rpicammqtt-0.9.4-py3-none-any.whl", "has_sig": false, "md5_digest": "832be98a05f1c9876bc42067be0d9676", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20878, "upload_time": "2019-01-04T14:55:36", "url": "https://files.pythonhosted.org/packages/98/5f/1c290918203310272daef96f4a9913ca8069383253122e737fb85878af9a/rpicammqtt-0.9.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "040d6d7826d6da078de7fe1872577643", "sha256": "cd6799cb75d1183bca2f457bb0a26b64ea263fea4a8069473081f8e5f58bd61f" }, "downloads": -1, "filename": "rpicammqtt-0.9.4.tar.gz", "has_sig": false, "md5_digest": "040d6d7826d6da078de7fe1872577643", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11376, "upload_time": "2019-01-04T14:55:37", "url": "https://files.pythonhosted.org/packages/16/46/1286c8566772bc6ee4314a68aa7e20179e2985b71dc121eeb87dbcf2580b/rpicammqtt-0.9.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1269997296b488c55c55bd019b014be6", "sha256": "4df64a6e07b150c1c30433f5dc2d26f03f494c3df76b8ab2d43f402a5a65eebb" }, "downloads": -1, "filename": "rpicammqtt-0.10.1-py3-none-any.whl", "has_sig": false, "md5_digest": "1269997296b488c55c55bd019b014be6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19877, "upload_time": "2019-03-07T00:47:47", "url": "https://files.pythonhosted.org/packages/b3/e1/dcb3bc5907359b62172a4c6a6f7942eff02fe7cf993e9b974640d1c0fbe5/rpicammqtt-0.10.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "171f89ec8b101223e2a3e198b0d8d40e", "sha256": "b0fb18599a9a4550fd24f857d12fb4f09f398a0de0277af58bd1746bc18b8c6e" }, "downloads": -1, "filename": "rpicammqtt-0.10.1.tar.gz", "has_sig": false, "md5_digest": "171f89ec8b101223e2a3e198b0d8d40e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12185, "upload_time": "2019-03-07T00:47:48", "url": "https://files.pythonhosted.org/packages/df/67/ede5c97bfe571e70fcb78c9df8723c002c3c5a2574dd630300db176ffa53/rpicammqtt-0.10.1.tar.gz" } ] }