We monitor the house via Telegram

$chatID – ID of our chat with the bot

// Use https://t.me/myidbot > /getgroupid@myidbot for Telegram groups
// https://api.telegram.org/bot[токен_бота]/getUpdates
$chatID   = '';

$botToken – the private key of our bot, received from @BotFather

// Take BotToken from https://t.me/BotFather
$botToken = 'xxxxxxx:xxxxxxxxxxxxxxxxxx-xxxxxxx';

$http_url – link to an external service for storing our files

// Exteranl web-server for files (Yandex Disk, Google Drive and etc.)
// paste shared access url
$http_url="https://disk.yandex.ru/";

$ftp_root – way to root folder FTP server, which we specified in the section FTP connection settings

// Set full FTP path for files
$ftp_root = "C:\\Users\\user\\YandexDisk-user\\Folder";

$ftp_root_sub – subdirectory in root folder, it is created DVR

// Set unique subfolder, which set up yours video recorder
$ftp_root_sub = '/192.168.0.36_001241aa67dd/';

$ftp_user_name – the username we indicated in FTP connection settings

// Set FTP user name
$ftp_user_name="video";

$fz_logs_folder – path to the folder with logs FileZilla server

// Set path to FileZilla logs (setup FileZila Options / Logging - Use a different logfile each day, without size limit)
$fz_logs_folder = "C:\\Program Files (x86)\\FileZilla Server\\Logs";

$fz_log_id_file – the name of the file for storing settings cannot be changed unless necessary

// script data file
$fz_log_id_file="filezilla_log_id.save";

The script is configured!

Running the script

  1. Right-click on the icon OSPanel and press Launch

  2. After the flag OSPanel moved from red to green, open the browser and follow the link: http://localhost/filezilla_log_parser.php

  3. If all settings are correct, responses will be displayed in the browser upon completion of the script. Telegram APIand to chat Telegram Images and links to video files will arrive.

Example of messages from a bot
Example of messages from a bot

Example of messages from a bot

FTP session ID – value for monitoring correct parsing of the FTP server log. Through “-” the file creation time is indicated, which can be compared with the time of the message from the bot and the delay in work can be calculated.

Setting up CRON

For regular operation of the script, we configure CRON V OSPanel > Settings > Task Scheduler:

Setting up the task scheduler

Setting up the task scheduler

Set the frequency of running the script */5 – every 5 minutes. Paste the script call line into the field Execute and press the button Add.

 */5 * * * * %progdir%\modules\wget\bin\wget.exe -q --no-cache http://localhost/tg_send_tempdata.php -O %progdir%\userdata\temp\tg_tempsend.txt

When checking operation, the interval can be reduced to one minute */1

We check in complex

We run with the phone to the camera and catch the bot’s chat messages!

PS

I hope this instruction will be accessible to beginner but confident users. This is exactly how I imagined the owner of a country house who decided to acquire a video surveillance system for his site. I will be happy to answer questions and make adjustments if necessary.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *