1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00
dockerfiles/motion-arm64/README.md

103 lines
2.7 KiB
Markdown
Raw Normal View History

2016-01-03 07:23:48 +02:00
motion-arm
==========
2017-06-03 10:07:14 +02:00
![](http://www.lavrsen.dk/foswiki/pub/Motion/WebPreferences/motion-trans.gif)
2016-01-03 07:23:48 +02: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 09:07:50 +02:00
## docker-compose.yml
2017-06-03 09:28:43 +02:00
```yaml
2022-02-11 08:50:51 +02:00
version: "3.8"
services:
motion:
2022-10-28 09:47:11 +02:00
image: easypi/motion-arm64
2022-02-11 08:50:51 +02:00
ports:
- "8080:8080"
- "8081:8081"
volumes:
- ./data/etc/motion.conf:/etc/motion/motion.conf
- ./data/var:/var/lib/motion
- /etc/localtime:/etc/localtime
devices:
- /dev/video0:/dev/video0
restart: unless-stopped
2016-01-03 09:07:50 +02:00
```
2017-06-03 09:28:43 +02:00
You can edit `motion.conf` to customize motion.
2016-01-03 09:07:50 +02:00
2017-06-03 09:28:43 +02:00
```ini
2016-01-03 09:07:50 +02:00
# set image width
2016-02-22 12:12:04 +02:00
width 640
2016-01-03 09:07:50 +02:00
# set image height
2016-02-22 12:12:04 +02:00
height 480
2016-01-03 09:07:50 +02:00
# set frame rate
2022-10-28 09:47:11 +02:00
framerate 15
2016-01-03 09:07:50 +02:00
# disable image output
output_pictures off
# disable video output
ffmpeg_output_movies off
# encode timelapse movie
2022-10-28 09:47:11 +02:00
timelapse_interval 60
timelapse_mode daily
timelapse_fps 30
timelapse_codec mpg
timelapse_filename %Y%m%d-timelapse
2016-01-03 09:07:50 +02:00
```
2017-06-03 10:07:14 +02:00
Motion can work with Home-Assistant via [External Commands][2].
2022-10-28 16:01:34 +02:00
```yaml
2017-06-03 10:32:58 +02:00
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 10:07:14 +02: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 10:32:58 +02: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 10:07:14 +02: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 10:32:58 +02: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 10:07:14 +02:00
```
Please read [this][3] to enable raspberry pi camera module.
2016-02-22 10:11:55 +02: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 07:23:48 +02:00
[1]: http://lavrsen.dk/foswiki/bin/view/Motion/WebHome
2017-06-03 10:07:14 +02:00
[2]: http://www.lavrsen.dk/foswiki/bin/view/Motion/ExternalCommands
[3]: https://wiki.archlinux.org/index.php/Raspberry_Pi#Raspberry_Pi_camera_module