PROBLEM IN SEND PICTURE TO TELEGRAM (WHEN MOTION DETECT) - Raspberry Pi Forums


this python program problem. when motion detect, usb camera snap picture. did not send telegram apps. can solve problem.

code: select all

import sys import os import time  import random import telepot import rpi.gpio gpio subprocess import call  gpio.setmode(gpio.board) gpio.setwarnings(false) gpio.setup(38,gpio.in)  chat_id = 1 bot = telepot.bot(token= '423913668:aaettvpzkuyaolpmcw7wlln7ktn5fvllzau')  while true:        i=gpio.input(38)        if i==0:                 #when output motion sensor low            print "no intruders",i       elif i==1:               #when output motion sensor high             print "intruder detected",i             call(["fswebcam","image.jpg"])             bot.sendmessage(chat_id=chat_id, text="some activity detected past 5 seconds!")             bot.sendphoto(chat_id=chat_id,photo=open("/home/pi/telegrambot/image.jpg"))  bot.message_loop(handle) print 'i listening...'  while 1:    time.sleep(10)

is not same question asked in viewtopic.php?f=28&t=192548&p=1207196#p1207196

did try suggested tests ?


raspberrypi



Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'