mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
add support for mqtt user/pass. closes #7
This commit is contained in:
parent
1a55008cd5
commit
85259ca00c
@ -36,6 +36,8 @@ docker run --rm \
|
|||||||
-e RTSP_URL='<rtsp_url>' \
|
-e RTSP_URL='<rtsp_url>' \
|
||||||
-e REGIONS='<box_size_1>,<x_offset_1>,<y_offset_1>,<min_person_size_1>,<min_motion_size_1>,<mask_file_1>:<box_size_2>,<x_offset_2>,<y_offset_2>,<min_person_size_2>,<min_motion_size_2>,<mask_file_2>' \
|
-e REGIONS='<box_size_1>,<x_offset_1>,<y_offset_1>,<min_person_size_1>,<min_motion_size_1>,<mask_file_1>:<box_size_2>,<x_offset_2>,<y_offset_2>,<min_person_size_2>,<min_motion_size_2>,<mask_file_2>' \
|
||||||
-e MQTT_HOST='your.mqtthost.com' \
|
-e MQTT_HOST='your.mqtthost.com' \
|
||||||
|
-e MQTT_USER='username' \
|
||||||
|
-e MQTT_PASS='password' \
|
||||||
-e MQTT_TOPIC_PREFIX='cameras/1' \
|
-e MQTT_TOPIC_PREFIX='cameras/1' \
|
||||||
-e DEBUG='0' \
|
-e DEBUG='0' \
|
||||||
frigate:latest
|
frigate:latest
|
||||||
@ -57,6 +59,8 @@ Example docker-compose:
|
|||||||
RTSP_URL: "<rtsp_url>"
|
RTSP_URL: "<rtsp_url>"
|
||||||
REGIONS: "<box_size_1>,<x_offset_1>,<y_offset_1>,<min_person_size_1>,<min_motion_size_1>,<mask_file_1>:<box_size_2>,<x_offset_2>,<y_offset_2>,<min_person_size_2>,<min_motion_size_2>,<mask_file_2>"
|
REGIONS: "<box_size_1>,<x_offset_1>,<y_offset_1>,<min_person_size_1>,<min_motion_size_1>,<mask_file_1>:<box_size_2>,<x_offset_2>,<y_offset_2>,<min_person_size_2>,<min_motion_size_2>,<mask_file_2>"
|
||||||
MQTT_HOST: "your.mqtthost.com"
|
MQTT_HOST: "your.mqtthost.com"
|
||||||
|
MQTT_USER: "username" #optional
|
||||||
|
MQTT_PASS: "password" #optional
|
||||||
MQTT_TOPIC_PREFIX: "cameras/1"
|
MQTT_TOPIC_PREFIX: "cameras/1"
|
||||||
DEBUG: "0"
|
DEBUG: "0"
|
||||||
```
|
```
|
||||||
|
@ -24,6 +24,8 @@ from frigate.object_detection import detect_objects
|
|||||||
RTSP_URL = os.getenv('RTSP_URL')
|
RTSP_URL = os.getenv('RTSP_URL')
|
||||||
|
|
||||||
MQTT_HOST = os.getenv('MQTT_HOST')
|
MQTT_HOST = os.getenv('MQTT_HOST')
|
||||||
|
MQTT_USER = os.getenv('MQTT_USER')
|
||||||
|
MQTT_PASS = os.getenv('MQTT_PASS')
|
||||||
MQTT_TOPIC_PREFIX = os.getenv('MQTT_TOPIC_PREFIX')
|
MQTT_TOPIC_PREFIX = os.getenv('MQTT_TOPIC_PREFIX')
|
||||||
|
|
||||||
# REGIONS = "350,0,300,50:400,350,250,50:400,750,250,50"
|
# REGIONS = "350,0,300,50:400,350,250,50:400,750,250,50"
|
||||||
@ -145,6 +147,9 @@ def main():
|
|||||||
client = mqtt.Client()
|
client = mqtt.Client()
|
||||||
client.on_connect = on_connect
|
client.on_connect = on_connect
|
||||||
client.will_set(MQTT_TOPIC_PREFIX+'/available', payload='offline', qos=1, retain=True)
|
client.will_set(MQTT_TOPIC_PREFIX+'/available', payload='offline', qos=1, retain=True)
|
||||||
|
if not MQTT_USER is None:
|
||||||
|
client.username_pw_set(MQTT_USER, password=MQTT_PASS)
|
||||||
|
|
||||||
client.connect(MQTT_HOST, 1883, 60)
|
client.connect(MQTT_HOST, 1883, 60)
|
||||||
client.loop_start()
|
client.loop_start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user