We all have an old smartphone or a dusty IP camera sitting in a drawer. Instead of buying a expensive cloud subscription (like Ring or Nest), you can turn that camera into a real-time security alert system using a free bot on Telegram .
pip install python-telegram-bot requests opencv-python Save this as security_cam.py . Replace the variables (URL, TOKEN, CHAT_ID). ipcam telegram
Happy building! 📸🔒 Disclaimer: Use this for monitoring your own property only. Be aware of local privacy laws regarding recording. We all have an old smartphone or a
frame1 = frame2 sleep(CHECK_INTERVAL)
from telegram.ext import Application, CommandHandler async def snap(update, context): img = get_frame() cv2.imwrite("manual.jpg", img) await update.message.reply_photo(photo=open('manual.jpg', 'rb')) Replace the variables (URL, TOKEN, CHAT_ID)
Run the script:
def get_frame(): response = requests.get(CAMERA_URL, auth=('username', 'password')) # Remove auth if none return cv2.imdecode(np.frombuffer(response.content, np.uint8), -1) print("[+] Security camera active. Watching via Telegram...") ret, frame1 = get_frame(), None sleep(1)