HomeAssistant configuration for basic monitoring of a motion
addon environment.
The motion
addon for Home Assistant provides means to
configure and collect motion detection images from a variety of sources, including RSTP feeds, MJPEG via HTTP, and
FTP submissions of motion video segments.
These sources are described by a group, device, and camera combination; by default the group is motion
, but may be used to distinguish between collections of devices.
A device is a host computer running the motion-project.io
software, typically a RaspberryPi running a version of the motion
addon for Home Assistant, for example rpi1
.
Device identifiers cannot include spaces
, hyphens -
, plus +
, hash #
, or slash /
characters.
A camera is associated with a device and may be one of the following types:
rtsp
- a camera providing a real-time stream using RTSPmjpeg
- a camera providing a motion JPEG stream using HTTPlocal
- locally attached camera, e.g./dev/video0
ftpd
- a remote camera sending motion videos via FTP (n.b. requiresftp
addon)
Each motion event is composed of multiple JPEG images which are processed to produce the following:
- key image
- average image
- blended image
- composite image
- GIF animation
- GIF mask animation
All these images are published via MQTT on varying topics:
- group
/
device/
camera/image/end
- group
/
device/
camera/image/average
- group
/
device/
camera/image/blend
- group
/
device/
camera/image/composite
- group
/
device/
camera/image/animated
- group
/
device/
camera/image/animated_mask
In addition, a JSON payload is created with the event metadata and a single, key, frame from the sequence; the image is BASE64 encoded. This payload is published on the following topic:
- group
/
device/
camera/event/end
The payload is collected by the yolo4motion
service.
This service utilizes the YOLO object detection and classification software to identify any of the
entities defined and trained; the default are listed in the input_select/detect_entity.yaml
file.
The resulting image is added to the original payload and published to MQTT on the corresponding topic:
- group
/
device/
camera/event/end/
entity
The image itself is also published to MQTT on the following topic:
- group
/
device/
camera/image/end/
entity
In the above templates, the entity defaults to all
, indicating YOLO is searching for any known entity.
Below is a screenshot from the system.
Setup Home Assistant using a recent, standard, appropriate Raspbian or Ubuntu LINUX distribution. For more details refer to the instructions in a related repository. Once Home Assistant has become operational, access the host system using ssh
, for example:
% ssh pi41.local -l pi
<login>
- Clone this repository to a local directory on the host device, for example:
$ cd /tmp
$ mkdir motion-monitor
$ cd motion-monitor
$ git clone http://github.com/dcmartin/motion-monitor .
- Copy the contents of the directory into the Home Assistant configuration directory; root privilege is required, for example:
$ sudo mv .??* * /usr/share/hassio/homeassistant
- Change directory to the Home Assistant configuration (
/usr/share/hassio/homeassistant
) and edit thesecrets.yaml
file for local specifics, notably:
mqtt-broker
mqtt-username
mqtt-password
- Restart Home Assistant using the
make
command, for example:
$ sudo make restart