mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-12-29 00:06:19 +01:00
Remove topic prefix (#4515)
This commit is contained in:
parent
4e5512e35d
commit
91982c4f7e
@ -218,7 +218,6 @@ class FrigateApp:
|
||||
self.detected_frames_processor = TrackedObjectProcessor(
|
||||
self.config,
|
||||
self.dispatcher,
|
||||
self.config.mqtt.topic_prefix,
|
||||
self.detected_frames_queue,
|
||||
self.event_queue,
|
||||
self.event_processed_queue,
|
||||
|
@ -634,7 +634,6 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
self,
|
||||
config: FrigateConfig,
|
||||
dispatcher: Dispatcher,
|
||||
topic_prefix,
|
||||
tracked_objects_queue,
|
||||
event_queue,
|
||||
event_processed_queue,
|
||||
@ -646,7 +645,6 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
self.name = "detected_frames_processor"
|
||||
self.config = config
|
||||
self.dispatcher = dispatcher
|
||||
self.topic_prefix = topic_prefix
|
||||
self.tracked_objects_queue = tracked_objects_queue
|
||||
self.event_queue = event_queue
|
||||
self.event_processed_queue = event_processed_queue
|
||||
@ -669,9 +667,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
"after": after,
|
||||
"type": "new" if obj.previous["false_positive"] else "update",
|
||||
}
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/events", json.dumps(message), retain=False
|
||||
)
|
||||
self.dispatcher.publish("events", json.dumps(message), retain=False)
|
||||
obj.previous = after
|
||||
self.event_queue.put(
|
||||
("update", camera, obj.to_dict(include_thumbnail=True))
|
||||
@ -724,9 +720,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
"after": obj.to_dict(),
|
||||
"type": "end",
|
||||
}
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/events", json.dumps(message), retain=False
|
||||
)
|
||||
self.dispatcher.publish("/events", json.dumps(message), retain=False)
|
||||
|
||||
self.event_queue.put(("end", camera, obj.to_dict(include_thumbnail=True)))
|
||||
|
||||
@ -747,15 +741,13 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
)
|
||||
else:
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{camera}/{obj.obj_data['label']}/snapshot",
|
||||
f"{camera}/{obj.obj_data['label']}/snapshot",
|
||||
jpg_bytes,
|
||||
retain=True,
|
||||
)
|
||||
|
||||
def object_status(camera, object_name, status):
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{camera}/{object_name}", status, retain=False
|
||||
)
|
||||
self.dispatcher.publish(f"{camera}/{object_name}", status, retain=False)
|
||||
|
||||
for camera in self.config.cameras.keys():
|
||||
camera_state = CameraState(camera, self.config, self.frame_manager)
|
||||
@ -854,7 +846,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
# only send ON if motion isn't already active
|
||||
if self.last_motion_detected.get(camera, 0) == 0:
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{camera}/motion",
|
||||
f"{camera}/motion",
|
||||
"ON",
|
||||
retain=False,
|
||||
)
|
||||
@ -867,7 +859,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
# If no motion, make sure the off_delay has passed
|
||||
if frame_time - self.last_motion_detected.get(camera, 0) >= mqtt_delay:
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{camera}/motion",
|
||||
f"{camera}/motion",
|
||||
"OFF",
|
||||
retain=False,
|
||||
)
|
||||
@ -963,7 +955,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
new_count = sum(zone_label.values())
|
||||
if new_count != current_count:
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{zone}/{label}",
|
||||
f"{zone}/{label}",
|
||||
new_count,
|
||||
retain=False,
|
||||
)
|
||||
@ -976,7 +968,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
if label in obj_counter:
|
||||
zone_label[camera] = obj_counter[label]
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{zone}/{label}",
|
||||
f"{zone}/{label}",
|
||||
obj_counter[label],
|
||||
retain=False,
|
||||
)
|
||||
@ -993,7 +985,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
|
||||
if new_count != current_count:
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{zone}/all",
|
||||
f"{zone}/all",
|
||||
new_count,
|
||||
retain=False,
|
||||
)
|
||||
@ -1001,7 +993,7 @@ class TrackedObjectProcessor(threading.Thread):
|
||||
else:
|
||||
zone_label[camera] = total_label_count
|
||||
self.dispatcher.publish(
|
||||
f"{self.topic_prefix}/{zone}/all",
|
||||
f"{zone}/all",
|
||||
total_label_count,
|
||||
retain=False,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user