From e47e62f2c08ec94917a10510d006e5a8afe6e140 Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 3 Jun 2017 16:32:58 +0800 Subject: [PATCH] update motion-arm --- motion-arm/Dockerfile | 2 +- motion-arm/README.md | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/motion-arm/Dockerfile b/motion-arm/Dockerfile index 6e3bf7a..37cbd20 100644 --- a/motion-arm/Dockerfile +++ b/motion-arm/Dockerfile @@ -11,7 +11,7 @@ ENV MOTION_URL https://github.com/Motion-Project/motion/releases/download/releas RUN set -xe \ && apt-get update \ - && apt-get install -y curl libraspberrypi0 \ + && apt-get install -y curl libraspberrypi0 mosquitto-clients \ && curl -sSL ${MOTION_URL} -o ${MOTION_FILE} \ && (dpkg -i ${MOTION_FILE} || apt-get -f install -y) \ && sed -i -e 's/^daemon on/daemon off/' \ diff --git a/motion-arm/README.md b/motion-arm/README.md index aa0e1fa..dabd1b6 100644 --- a/motion-arm/README.md +++ b/motion-arm/README.md @@ -48,14 +48,34 @@ ffmpeg_timelapse 60 Motion can work with Home-Assistant via [External Commands][2]. +``yaml +binary_sensor: + - platform: mqtt + name: Motion + state_topic: /pi/sensor/motion + qos: 0 + payload_on: ON + payload_off: OFF + device_class: motion +``` + ```bash # Command to be executed when a movie file (.mpg|.avi) is created. (default: none) # To give the filename as an argument to a command append it with %f -on_movie_start curl -s -H 'X-HA-Access: ******' -H 'Content-Type: application/json' -d '{"state": "on", "attributes": {"friendly_name": "Motion", "device_class": "motion"}}' http://hass.easypi.pro:8123/api/states/binary_sensor.motion + +# CURL +;on_movie_start curl -s -H 'X-HA-Access: ******' -H 'Content-Type: application/json' -d '{"state": "on", "attributes": {"friendly_name": "Motion", "device_class": "motion"}}' http://hass.easypi.pro:8123/api/states/binary_sensor.motion +# MQTT +;on_movie_start mosquitto_pub -h mqtt.easypi.pro -u username -P password -r -t /pi/sensor/motion -m ON # Command to be executed when a movie file (.mpg|.avi) is closed. (default: none) # To give the filename as an argument to a command append it with %f -on_movie_end curl -s -H 'X-HA-Access: ******' -H 'Content-Type: application/json' -d '{"state": "off", "attributes": {"friendly_name": "Motion", "device_class": "motion"}}' http://hass.easypi.pro:8123/api/states/binary_sensor.motion + +# CURL +;on_movie_end curl -s -H 'X-HA-Access: ******' -H 'Content-Type: application/json' -d '{"state": "off", "attributes": {"friendly_name": "Motion", "device_class": "motion"}}' http://hass.easypi.pro:8123/api/states/binary_sensor.motion +# MQTT +;on_movie_end mosquitto_pub -h mqtt.easypi.pro -u username -P password -r -t /pi/sensor/motion -m OFF + ``` Please read [this][3] to enable raspberry pi camera module.