From d3c228e6b14b6b0b1be123f1bbba2e0e8d159016 Mon Sep 17 00:00:00 2001 From: GsDublin <100287261+GsDublin@users.noreply.github.com> Date: Tue, 1 Mar 2022 14:44:28 +0100 Subject: [PATCH] Update runHomeSecurity.py png is to big! I got an error of sending 11 MB isnt supported. --- runHomeSecurity.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/runHomeSecurity.py b/runHomeSecurity.py index 754d94e..b3b8d89 100644 --- a/runHomeSecurity.py +++ b/runHomeSecurity.py @@ -41,6 +41,9 @@ def runMainLoop(IPList, pictureMode, TimeoutLength, MotionSensitivity, MinimumOb num = len(IPList) camImg = [None]*num frameCount = [0]*num + + print("Starting HomeSecurity") + telegram.send_message(groupID, "Starting HomeSecurity") #Need a class so the object can hold the callback function #We need the callback function to pass into the video stream @@ -96,6 +99,9 @@ def inner_callback(self, img): lastAttempt = time.time() deadOn = False + print("Running HomeSecurity") + telegram.send_message(groupID, "Running HomeSecurity") + #main loop while True: #if any of the cameras have disconnected, attempt to reconnect @@ -173,20 +179,20 @@ def inner_callback(self, img): try: telegram.send_message(groupID, target + " detected on Camera" + str(index+1)) except Exception as e: - print("Error with telegram send_message") + print("Error with telegram send_message: " + e.description) #if we are reporting pictures, send the picture if pictureMode: #draw rectangle cv2.rectangle(curImage, (int(o.rect.x), int(o.rect.y)), (int(o.rect.x + o.rect.w), int(o.rect.y + o.rect.h)), [255,0,0], 3) #prep image - is_success, im_buf_arr = cv2.imencode(".png", curImage) + is_success, im_buf_arr = cv2.imencode(".jpg", curImage) byte_im = im_buf_arr.tobytes() #send image try: telegram.send_photo(groupID, photo=byte_im) except Exception as e: - telegram.send_message(groupID, "Error sending photo:" + e.message + e.args) + telegram.send_message(groupID, "Error sending photo:" + e.description) #add timeout TimeOuts[str(index+1)][target] = time.time()+TimeoutLength #end of runMainLoop