1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-28 09:41:20 +00:00
dockerfiles/motion-arm/README.md

98 lines
2.5 KiB
Markdown
Raw Normal View History

2016-01-03 05:23:48 +00:00
motion-arm
==========
2017-06-03 08:07:14 +00:00
![](http://www.lavrsen.dk/foswiki/pub/Motion/WebPreferences/motion-trans.gif)
2016-01-03 05:23:48 +00:00
[Motion][1] is a program that monitors the video signal from one or more cameras
and is able to detect if a significant part of the picture has changed. Or in
other words, it can detect motion.
2016-01-03 07:07:50 +00:00
## docker-compose.yml
2017-06-03 07:28:43 +00:00
```yaml
2016-01-03 07:07:50 +00:00
motion:
2017-06-03 07:28:43 +00:00
image: easypi/motion-arm
2016-01-03 07:07:50 +00:00
ports:
- "8080:8080"
- "8081:8081"
volumes:
2017-06-03 07:28:43 +00:00
- ./motion.conf:/etc/motion/motion.conf
- ./data:/var/lib/motion
- /etc/localtime:/etc/localtime
2016-01-03 07:07:50 +00:00
devices:
- /dev/video0:/dev/video0
restart: always
```
2017-06-03 07:28:43 +00:00
You can edit `motion.conf` to customize motion.
2016-01-03 07:07:50 +00:00
2017-06-03 07:28:43 +00:00
```ini
2016-01-03 07:07:50 +00:00
# set image width
2016-02-22 10:12:04 +00:00
width 640
2016-01-03 07:07:50 +00:00
# set image height
2016-02-22 10:12:04 +00:00
height 480
2016-01-03 07:07:50 +00:00
# set frame rate
framerate 5
# disable image output
output_pictures off
# disable video output
ffmpeg_output_movies off
# encode timelapse movie
ffmpeg_timelapse 60
```
2017-06-03 08:07:14 +00:00
Motion can work with Home-Assistant via [External Commands][2].
2017-06-03 08:32:58 +00:00
``yaml
binary_sensor:
- platform: mqtt
name: Motion
state_topic: /pi/sensor/motion
qos: 0
payload_on: ON
payload_off: OFF
device_class: motion
```
2017-06-03 08:07:14 +00:00
```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
2017-06-03 08:32:58 +00:00
# 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
2017-06-03 08:07:14 +00:00
# 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
2017-06-03 08:32:58 +00:00
# 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
2017-06-03 08:07:14 +00:00
```
Please read [this][3] to enable raspberry pi camera module.
2016-02-22 08:11:55 +00:00
```
####################
# /boot/config.txt #
####################
##Camera
gpu_mem=128
start_file=start_x.elf
fixup_file=fixup_x.dat
disable_camera_led=1
```
2016-01-03 05:23:48 +00:00
[1]: http://lavrsen.dk/foswiki/bin/view/Motion/WebHome
2017-06-03 08:07:14 +00:00
[2]: http://www.lavrsen.dk/foswiki/bin/view/Motion/ExternalCommands
[3]: https://wiki.archlinux.org/index.php/Raspberry_Pi#Raspberry_Pi_camera_module