Last Watch AI is a locally hosted application for creating if-then automations based on computer vision events. Last Watch can be used in tandem with IP camera software to trigger actions if the AI detects certain objects, like cars, people, or animals.
This project was heavily inspired by gentlepumpkin/bi-aidetection.
Last Watch watches for new image files in a configurable directory, then checks each image for a range of objects such as cars or people. Different automations can be set up to trigger if the AI detects relevant objects in the images.
A primary use case for Last Watch is to enhance Video Management Systems such as Blue Iris. For example, Last Watch can be set up to trigger security recordings only when a person is detected on security camera, thereby eliminating irrelevant motion events.
Last Watch can also be integrated with automation platforms suchs as Home Assistant, Node-RED, or openHAB. For instance, you can create virtual sensors which are set when a person is in a room, or when a car is parked in the garage.
Supported Automations:
Last Watch has been tested on Windows, Debian, and Arch Linux. Dual-core CPU and 2GB of memory are recommended.
$ git clone https://github.com/akmolina28/last-watch-ai.git
$ cd last-watch-ai
$ cp configs/.env.linux .env
$ nano .env
$ cp src/.env.example src/.env &&
sudo docker-compose up -d mysql &&
sudo docker-compose run --rm composer install --optimize-autoloader --no-dev &&
sudo docker-compose run --rm artisan route:cache &&
sudo docker-compose run --rm artisan key:generate --force &&
sudo docker-compose run --rm artisan storage:link &&
sudo docker-compose run --rm artisan migrate --force &&
sudo docker-compose run --rm npm install --verbose &&
sudo docker-compose run --rm npm run prod --verbose
$ sudo docker-compose up -d --build site
$ cd /path/to/last-watch-ai
$ sudo docker-compose down
$ git pull
$ sudo docker-compose run --rm composer install --optimize-autoloader --no-dev &&
sudo docker-compose run --rm artisan route:cache &&
sudo docker-compose run --rm artisan migrate --force &&
sudo docker-compose run --rm npm install --verbose &&
sudo docker-compose run --rm npm rebuild &&
sudo docker-compose run --rm npm run prod --verbose
$ sudo docker-compose up -d --build site
Install Docker and Docker Compose
Download the latest release un-zip and extract the files
Set the watch folder and web port by editing the .env file
Start the containers with Docker Compose
docker-compose up -d --build site
Full Walkthrough with Blue Iris
Automation Examples:
Contributions are welcome and will be credited.
Last Watch is written in PHP on the Laravel framework and the interface is written in Vue.js. The Laravel application also functions as a headless API such that the interface can be completely bypassed if needed.
The application is made up of several Docker containers. Each container serves a different purpose:
To get started with development, follow the steps to install the project from source. Use your favorite IDE to edit the source files and recompile the front-end using Webpack. You can run docker-compose run --rm npm run watch
to automatically recompile when scripts are changed.
To execute tests, use the built in phpunit container by running docker-compose run --rm phpunit
. This container will also stand up separate testing containers for mysql and deepstack to run the feature tests.