HomeManager is a simple platform to manage cameras at home. HomeManager defines and controls device policies, including video streaming, motion detection, and night mode. Settings shared to a device depend on whether a user at home.
HomeManager is a solution designed for personal use at the private network (i.e., without access from the internet). The software might not be ready for production usage due to a lack of security focus during development. Use at your own risk.
HomeManager supports Xiaomi Xiaofang 1S cameras flashed with the custom firmware and Mikrotik routers. However, it should be possible to use other camera models without server-side changes or with minimal adaptation. Also, almost any router allowing execution of shell commands could work (e.g., models operated by OpenWRT). But if you are going to use any devices except Mikrotik and Xiaomi Xiaofang 1S, you need to adapt the client scripts.
- Edit
homemanager.service
,ffmpeg-rtsp-hls.path
,ffmpeg-rtsp-hls.service
and save to/etc/systemd/system
. - Copy
homemanager/conf.default.py
tohomemanager/conf.py
and edit conf.py.
# dnf install python3-tornado python3-aiopg python3-psycopg2 python3-astral python3-pynacl
# systemctl enable --now ffmpeg-rtsp-hls.path
$ ./db_manage.py init
$ ./db_manage.py router-add -n mikrotik
$ ./db_manage.py camera-add -n camera1 -p /path/to/video.m3u8 -a /path/from/ffmpeg-rtsp-hls.path
# systemd enable --now homemanager.service
$ ./db_manage.py token-add -n mikrotik
$ ./db_manage.py token-add -n camera1
$ ./db_manage.py user-add -u username
- Edit
scripts/mikrotik_script
- Add the script to Mikrotik
- Winbox: System - Scripts - plus, enter
check_device
to "Name" field, enter script's content to "Source" field, Ok
- Winbox: System - Scripts - plus, enter
- Set scheduler
- Winbox: System - Scheduler - plus, enter
run_check_device
to name field, set interval00:05:00
('00:10:00' equals to 10 mins, '00:01:00' equals to 1 min), enter/system script run check_device
into "On Event" field - Terminal:
/system scheduler add name=run_check_device interval=10m on-event=check_device
- Winbox: System - Scheduler - plus, enter
- Edit
scripts/camera_module
- Put
scripts/camera_module
,scripts/camera_setup_script
andscripts/camera_startup_script
to/system/sdcard/config/userscripts
- Put
scripts/camera_motion_script
to/system/sdcard/config/userscripts/motiondetection
- Append
/system/sdcard/config/userscripts/camera_startup_script
to the end of/system/sdcard/run.sh
- Run
/system/sdcard/config/userscripts/camera_startup_script
- Add
/system/sdcard/config/userscripts/camera_setup_script
to crontab# crontab -c /system/sdcard/config/cron/crontabs -e
- Append
*/5 * * * * /system/sdcard/config/userscripts/camera_setup_script > /system/sdcard/config/userscripts/camera_setup_log
- in this example the command executes every 5 minutes and saves the last configuration json to the log file.
Cameras require swap for motion detection. See this issue. Note, script/camera_startup_script
includes all required steps. If you followed the installation instructions, additional actions are not required.
- Set
NOTIFICATIONS_SETTINGS['telegram']
=True
inhomemanager/conf.py
- Register your bot
- Set correct
TELEGRAM_SETTINGS['bot_id']
inhomemanager/conf.py
- Add the bot to a chat
- Set
TELEGRAM_SETTINGS['chat_id']
inhomemanager/conf.py
(checkhttps://api.telegram.org/bot<bot_id>/getUpdates
, look for a chat_id in logs once you have added the bot to the chat) - Enter proxies to
TELEGRAM_SETTINGS['proxy']
if telegram is blocked in your region
Mikrotik firewall
/ip firewall filter add chain=forward src-address=camera_ip dst-address=!192.168.1.0/24 action=drop comment="Drop
tries to reach the internet from ip camera (local network is allowed)"
mount -o remount,rw /system/sdcard
Check this issue.
HomeManager is free and opensource software. Check LICENSE for details.
Bundled libraries: Bootstrap - MIT, HLS.js - Apache 2.0.