Skip to content

Initial TLS support #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ frigate:
mqtt_auth: false
mqtt_username: username
mqtt_password: password
mqtt_port: 1883 # Optional, default: 1883
mqtt_use_tls: False # Optional, default: False. Use TLS for broker connection
mqtt_tls_insecure: False # Optional, default: False. Don't verify broker certificate
main_topic: frigate
camera:
- birdcam
Expand All @@ -13,4 +16,4 @@ classification:
threshold: 0.7
webui:
port: 7766
host: 0.0.0.0
host: 0.0.0.0
11 changes: 10 additions & 1 deletion speciesid.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
firstmessage = True

DBPATH = './data/speciesid.db'
DEFAULT_MQTT_PORT = 1833
DEFAULT_INSECURE_TLS = False


def classify(image):
Expand Down Expand Up @@ -236,7 +238,14 @@ def run_mqtt_client():
password = config['frigate']['mqtt_password']
client.username_pw_set(username, password)

client.connect(config['frigate']['mqtt_server'])
mqtt_port = config['frigate'].get('mqtt_port', DEFAULT_MQTT_PORT)
if config['frigate'].get('mqtt_use_tls', False):
ca_certs = config['frigate'].get('mqtt_tls_ca_certs')
client.tls_set(ca_certs)
client.tls_insecure_set(config['frigate'].get('mqtt_tls_insecure',
DEFAULT_INSECURE_TLS))

client.connect(config['frigate']['mqtt_server'], mqtt_port)
client.loop_forever()


Expand Down