From ab3e70b4db8869db98b1f7cd15ae4d9958b32f0e Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 20 Dec 2019 20:02:27 -0600 Subject: [PATCH] check to see if we have a frame before trying to send --- frigate/mqtt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frigate/mqtt.py b/frigate/mqtt.py index c6ab519ab..c053172fa 100644 --- a/frigate/mqtt.py +++ b/frigate/mqtt.py @@ -33,8 +33,8 @@ class MqttObjectPublisher(threading.Thread): if new_status != current_object_status[obj_name]: current_object_status[obj_name] = new_status self.client.publish(self.topic_prefix+'/'+obj_name, new_status, retain=False) - # send the snapshot over mqtt as well - if not self.best_frames.best_frames[obj_name] is None: + # send the snapshot over mqtt if we have it as well + if obj_name in self.best_frames.best_frames: ret, jpg = cv2.imencode('.jpg', self.best_frames.best_frames[obj_name]) if ret: jpg_bytes = jpg.tobytes()