Enforce minimum value for mqtt stats update (#12253)

This commit is contained in:
Nicolas Mowen 2024-07-01 16:08:14 -06:00 committed by GitHub
parent ef7846bb41
commit 012aa63571
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,7 @@ from frigate.const import (
CACHE_DIR,
CACHE_SEGMENT_FORMAT,
DEFAULT_DB_PATH,
FREQUENCY_STATS_POINTS,
MAX_PRE_CAPTURE,
REGEX_CAMERA_NAME,
YAML_EXT,
@ -193,7 +194,9 @@ class MqttConfig(FrigateBaseModel):
port: int = Field(default=1883, title="MQTT Port")
topic_prefix: str = Field(default="frigate", title="MQTT Topic Prefix")
client_id: str = Field(default="frigate", title="MQTT Client ID")
stats_interval: int = Field(default=60, title="MQTT Camera Stats Interval")
stats_interval: int = Field(
default=60, ge=FREQUENCY_STATS_POINTS, title="MQTT Camera Stats Interval"
)
user: Optional[str] = Field(None, title="MQTT Username")
password: Optional[str] = Field(None, title="MQTT Password", validate_default=True)
tls_ca_certs: Optional[str] = Field(None, title="MQTT TLS CA Certificates")

View File

@ -82,6 +82,10 @@ UPSERT_REVIEW_SEGMENT = "upsert_review_segment"
CLEAR_ONGOING_REVIEW_SEGMENTS = "clear_ongoing_review_segments"
UPDATE_CAMERA_ACTIVITY = "update_camera_activity"
# Stats Values
FREQUENCY_STATS_POINTS = 15
# Autotracking
AUTOTRACKING_MAX_AREA_RATIO = 0.6

View File

@ -10,6 +10,7 @@ from typing import Optional
from frigate.comms.inter_process import InterProcessRequestor
from frigate.config import FrigateConfig
from frigate.const import FREQUENCY_STATS_POINTS
from frigate.stats.util import stats_snapshot
from frigate.types import StatsTrackingTypes
@ -17,7 +18,6 @@ logger = logging.getLogger(__name__)
MAX_STATS_POINTS = 80
FREQUENCY_STATS_POINTS = 15
class StatsEmitter(threading.Thread):