Add config option to disable version check (#5208)

* Add config option to disable version check

* Add note to docs
This commit is contained in:
James L 2023-01-26 00:36:26 +00:00 committed by GitHub
parent 6ed8977548
commit 07c635d822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 3 deletions

View File

@ -491,4 +491,10 @@ ui:
timezone: None
# Optional: Use an experimental recordings / camera view UI (default: shown below)
experimental_ui: False
# Optional: Telemetry configuration
telemetry:
# Optional: Enable the latest version outbound check (default: shown below)
# NOTE: If you use the HomeAssistant integration, disabling this will prevent it from reporting new versions
version_check: True
```

View File

@ -155,7 +155,9 @@ class FrigateApp:
self.db.bind(models)
def init_stats(self) -> None:
self.stats_tracking = stats_init(self.camera_metrics, self.detectors)
self.stats_tracking = stats_init(
self.config, self.camera_metrics, self.detectors
)
def init_web_server(self) -> None:
self.flask_app = create_app(

View File

@ -74,6 +74,10 @@ class UIConfig(FrigateBaseModel):
use_experimental: bool = Field(default=False, title="Experimental UI")
class TelemetryConfig(FrigateBaseModel):
version_check: bool = Field(default=True, title="Enable latest version check.")
class MqttConfig(FrigateBaseModel):
enabled: bool = Field(title="Enable MQTT Communication.", default=True)
host: str = Field(default="", title="MQTT Host")
@ -818,6 +822,9 @@ class FrigateConfig(FrigateBaseModel):
default_factory=dict, title="Frigate environment variables."
)
ui: UIConfig = Field(default_factory=UIConfig, title="UI configuration.")
telemetry: TelemetryConfig = Field(
default_factory=TelemetryConfig, title="Telemetry configuration."
)
model: ModelConfig = Field(
default_factory=ModelConfig, title="Detection model configuration."
)

View File

@ -22,7 +22,11 @@ from frigate.object_detection import ObjectDetectProcess
logger = logging.getLogger(__name__)
def get_latest_version() -> str:
def get_latest_version(config: FrigateConfig) -> str:
if not config.telemetry.version_check:
return "disabled"
try:
request = requests.get(
"https://api.github.com/repos/blakeblackshear/frigate/releases/latest",
@ -40,6 +44,7 @@ def get_latest_version() -> str:
def stats_init(
config: FrigateConfig,
camera_metrics: dict[str, CameraMetricsTypes],
detectors: dict[str, ObjectDetectProcess],
) -> StatsTrackingTypes:
@ -47,7 +52,7 @@ def stats_init(
"camera_metrics": camera_metrics,
"detectors": detectors,
"started": int(time.time()),
"latest_frigate_version": get_latest_version(),
"latest_frigate_version": get_latest_version(config),
}
return stats_tracking