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 video sources are also supported (e.g. /dev/video0
).
This add-on interacts with additional components and services:
motion-ai
- Automated Home Assistant configurator for use withmotion
addon (see below).MQTT
Messaging service; usemosquitto
or HiveMQ add-onFTP
(optional) FTP daemon to receive webcam videos; useaddon-ftp
add-on
In addition, there are three Open Horizon AI services specified in the in motion-ai
repository; they may be used to identify entities, faces, and license plates.
yolo4motion
- using the scriptsh/yolo4motion.sh
face4motion
- using the scriptsh/face4motion.sh
alpr4motion
- using the scriptsh/alpr4motion.sh
This addon is built for the following architectures and available in Docker Hub, e.g. amd64
version.
The configuration instructions provide information on all options; however, for brevity there are three components that need to be defined for successful operation:
mqtt
- the IP address (FQDN), username, password, and port of theMQTT
brokergroup
- identifier for a subset of cameras; default:motion
device
- unique identifier for each device in the group; shall not use reserved MQTT characters (e.g.-,+,#,/
)client
- identifier fordevice
to listen; may be+
to indicate all devices; default:+
cameras
- array of individual camera specifications (see below)
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)type
- camera source type; may belocal
,netcam
,ftpd
,mqtt
netcam_url
- address of live stream for source, e.g.rtsp://192.168.1.223/live
netcam_userpass
- authentication credentials for source, e.g.username:password
In addition, there are two additional attributes which are optional:
icon
- select from Material Design Iconsw3w
- location of camera as identified by What3Words
[
{
"name": "sheshed",
"type": "netcam",
"netcam_url": "rtsp://192.168.1.223/live",
"netcam_userpass": "!secret netcam-userpass",
"icon": "cctv",
"w3w": ["varieties","usage","racks"]
}
]
All MQTT
messages sent use topics beginning with the group
specified, for example:
<group>/{name}/{camera}
-- JSON payload of motion detected<group>/{name}/{camera}/lost
-- JSON payload of motion detected<group>/{name}/{camera}/event/start
-- JSON payload of motion detected<group>/{name}/{camera}/event/end
-- JSON payload of motion detected<group>/{name}/{camera}/image
-- JPEG payload of image (seepost_pictures
)<group>/{name}/{camera}/image-average
-- JPEG payload of average event<group>/{name}/{camera}/image-blend
-- JPEG payload of blended event (50%)<group>/{name}/{camera}/image-composite
-- JPEG payload of composite event<group>/{name}/{camera}/image-animated
-- GIF payload of event<group>/{name}/{camera}/image-animated-mask
-- GIF payload of event (as B/W mask)
A MQTT
broker is required; the default Mosquitto add-on is sufficient, but must be configured with appropriate authentication, for example:
logins:
- username: username
password: password
anonymous: false
customize:
active: false
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
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.
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.
David C Martin (github@dcmartin.com)