Skip to content

Commit

Permalink
Refactor mqtt to handle reconnects and not cause frigate to stop. (#4440
Browse files Browse the repository at this point in the history
)

* Refactor mqtt client

* Protect callback method

* Use async to handle reconnects

* Set types and clenup

* Don't set connected until rc code is checked
  • Loading branch information
NickM-27 authored Nov 20, 2022
1 parent 6582504 commit ebdf36e
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 153 deletions.
4 changes: 2 additions & 2 deletions frigate/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from frigate.http import create_app
from frigate.log import log_process, root_configurer
from frigate.models import Event, Recordings
from frigate.mqtt import MqttSocketRelay, create_mqtt_client
from frigate.mqtt import FrigateMqttClient, MqttSocketRelay
from frigate.object_processing import TrackedObjectProcessor
from frigate.output import output_frames
from frigate.plus import PlusApi
Expand Down Expand Up @@ -169,7 +169,7 @@ def init_restream(self) -> None:
self.restream.add_cameras()

def init_mqtt(self) -> None:
self.mqtt_client = create_mqtt_client(self.config, self.camera_metrics)
self.mqtt_client = FrigateMqttClient(self.config, self.camera_metrics)

def start_mqtt_relay(self) -> None:
self.mqtt_relay = MqttSocketRelay(
Expand Down
Loading

0 comments on commit ebdf36e

Please sign in to comment.