Skip to content

dcmartin/addon-motion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎬 - motion add-on

This Home Assistant add-on utilizes the motion project, YOLO, and other AI's to detect and classify entity(s) in images. The motion project software provides an extensive set of capabilities to capture video feeds from a variety of sources, including RSTP,HTTP, and MJPEG network cameras. Locally attached USB camera on /dev/video0 is also supported.

This add-on interacts with additional components and services:

  1. motion-ai - Automated Home Assistant configurator for use with motion addon (see below).
  2. MQTT Messaging service; use mosquitto or HiveMQ add-on
  3. FTP (optional) FTP daemon to receive webcam videos; use addon-ftp add-on

In addition, there are three AI services which may be used to identify entities, faces, and license plates.

  1. yolo4motion An Open Horizon service; use sh/yolo4motion.sh in motion
  2. face4motion An Open Horizon service; use sh/face4motion.sh in motion
  3. alpr4motion An Open Horizon service; use sh/alpr4motion.sh in motion

Containers

This addon is built for the following architectures and available in Docker Hub, e.g. amd64 version.

motion-ai

The motion-ai repository provides automated mechanisms to download, install, and configure Home Assistant. The webcams.json file defines cameras known to the system; file contents of [] indicate none and only discovered will appear. After modifying and/or creating this file, Home Assistant should be reconfigured. Run make restart in the top-level HA directory -- typically /usr/share/hassio when using the motion-aiinstallation instructions.

There are three attributes required to integrate a camera into HA:

  • name - identifier for the camera as defined by the addon (n.b. MQTT topic reserved characters)
  • mjpeg_url - address of live MJPEG stream; local access only by default
  • username - authentication for access to MJPEG stream
  • password - authentication for access to MJPEG stream

In addition, there are two additional attributes which are optional:

[
  {
    "name": "kelispond",
    "mjpeg_url": "http://127.0.0.1:8090/1",
    "username": "!secret motioncam-username",
    "password": "!secret motioncam-password",
    "icon": "xbox",
    "w3w": ["varieties","usage","racks"]
  }
]

MQTT

Specify the host and port for sending MQTT messages.

logins:
  - username: username
    password: password
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

All topics begin with the devicedb specified, which defaults to "motion".

  • <devicedb>/{name}/{camera} -- JSON payload of motion detected
  • <devicedb>/{name}/{camera}/lost -- JSON payload of motion detected
  • <devicedb>/{name}/{camera}/event/start -- JSON payload of motion detected
  • <devicedb>/{name}/{camera}/event/end -- JSON payload of motion detected
  • <devicedb>/{name}/{camera}/image -- JPEG payload of image (see post_pictures)
  • <devicedb>/{name}/{camera}/image-average -- JPEG payload of average event
  • <devicedb>/{name}/{camera}/image-blend -- JPEG payload of blended event (50%)
  • <devicedb>/{name}/{camera}/image-composite -- JPEG payload of composite event
  • <devicedb>/{name}/{camera}/image-animated -- GIF payload of event
  • <devicedb>/{name}/{camera}/image-animated-mask -- GIF payload of event (as B/W mask)

Sample output

motion sample

Additional information

The Motion package has extensive documentation on available parameters. Almost all parameters are avsailable. The JSON configuration options are provided using the same name as in the Motion documentation.

Changelog & Releases

Releases are based on Semantic Versioning, and use the format of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented based on the following:

  • MAJOR: Incompatible or major changes.
  • MINOR: Backwards-compatible new features and enhancements.
  • PATCH: Backwards-compatible bugfixes and package updates.

Authors & contributors

David C Martin (github@dcmartin.com)