[Config Support]: MQTT settings not taking effect #22133
-
Describe the problem you are havingI want to arm/disarm cameras for various reasons. All cameras started out as enabled and known to frigate and the UI. I always want to be able to manually view camera conent live. However, there are many times where I want object detection turned off. After attempting to use the API in v0.16.4 to turn off detection, I am forced to change over to MQTT sicne that is where current dev efforts are focused. I have written a Python script to ineract with frigate via MQTT and the comms are all working great. The script gathers all the camera names and decides the ones where detection should be ON and which ones should have detection OFF. All that logic is working right and the messages are published without errors. Then, for debug, the script published a "frigate/onConnect" message to trigger a bunch of camera stats. They all say the right thing regarding detect/set. But, that's the first weird thing: it doesn't say detect/state; instead it is detect/set. Also, the huge list of properties that were initially received are not included on this onConnect check. It is only reporting the changed property. Not that I care, but just unexpected. The main concern is that, when all detection is OFF, it still detects everything everywhere. Version0.16.4 Frigate config filecameras:
Back_Door:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.202/stream2
roles:
- detect
- path: rtsp://name:password@10.0.0.202/stream1
roles:
- record
detect:
enabled: true
width: 1280
height: 720
fps: 5
record:
enabled: true
motion:
mask:
- 1,0,1,1,0.744,1,0.785,0
- 0.369,0,0.372,0.419,0.779,0.411,0.742,1,0,1,0,0
objects: {}
notifications:
enabled: false
# cooldown: 30 # wait 30 secs between notifications
Hallway:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.203/stream2
roles:
- detect
- path: rtsp://name:password@10.0.0.203/stream1
roles:
- record
detect:
enabled: true
width: 1280
height: 720
fps: 5
record:
enabled: true
motion:
mask: 0.849,0,1,0,1,1,0.301,1,0.356,0.679,0.716,0.636,0.896,0.434
objects: {}
notifications:
enabled: true
cooldown: 30 # wait 30 secs between notifications
Front_Lawn:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.204/stream2
roles:
- detect
- path: rtsp://name:password@10.0.0.204/stream1
roles:
- record
detect:
enabled: true
width: 1280
height: 720
fps: 5
record:
enabled: true
motion:
mask: 0,0,1,0,1,0.321,0.68,0.27,0.291,0.344,0,0.418
objects: {}
notifications:
enabled: false
Garage:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.201/stream2
roles:
- detect
- path: rtsp://name:password@10.0.0.201/stream1
roles:
- record
detect:
enabled: true
width: 1280
height: 720
fps: 5
record:
enabled: true
# mode: objects
motion:
mask:
- 0.238,0,0.586,0,1,0,1,0.336,1,1,0.246,1
objects:
mask:
- 0,0,0.12,0,0.235,0,0.242,0.519,0.25,1,0,1
notifications:
enabled: true
Backyard:
ffmpeg:
inputs:
- path:
rtsp://name:password@10.0.0.205:554/cam/realmonitor?channel=1&subtype=0
roles:
- detect
- record
detect:
enabled: true
width: 1280
height: 720
fps: 5
record:
enabled: true
# mode: objects
motion:
mask: 0,0.402,0,0,1,0,1,1,0.694,1,0.716,0.322,0.326,0.348
objects: {}
notifications:
enabled: true
AMCrest_Driveway:
ffmpeg:
inputs:
- path:
rtsp://name:password@10.0.0.206/cam/realmonitor?channel=1&subtype=00&authbasic=YWRtaW46YWRtaW4=
roles:
- detect
- path:
rtsp://name:password@10.0.0.206/cam/realmonitor?channel=1&subtype=00&authbasic=YWRtaW46SHQhYWF3NjY=
roles:
- record
detect:
enabled: true
width: 2048
height: 1536
fps: 2
record:
enabled: true
# mode: objects
notifications:
enabled: false
cooldown: 30
ICAMI_New_Garage:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.207:554/11 # 1920x1080.
roles:
- record
- path: rtsp://name:password@10.0.0.207:554/12 # 640x352.
roles:
- detect
detect:
enabled: true
width: 1920
height: 1080
fps: 5
record:
enabled: true
# mode: objects
notifications:
enabled: false
# cooldown: 30 # wait 30 secs between notifications
ICSee_SW_Corner:
ffmpeg:
inputs:
- path: rtsp://name:password@10.0.0.208:554/stream2
roles:
- detect
- path: rtsp://name:password@10.0.0.208:554/stream1
roles:
- record
detect:
enabled: true
width: 2304
height: 1296
fps: 5
record:
enabled: true
notifications:
enabled: false
# cooldown: 30 # wait 30 secs between notifications
camera_groups:
ManCave:
order: 0
icon: LuCarFront
cameras:
- ICAMI_New_Garage
- ICSee_SW_Corner
- AMCrest_Driveway
- birdseye
Back_Door:
order: 2
icon: LuDoorClosed
cameras:
- Back_Door
- Hallway
Basement:
order: 2
icon: LuDoorClosed
cameras:
- Back_Door
- Hallway
Tapo:
order: 3
icon: LuCamera
cameras:
- Garage
- Front_Lawn
- Back_Door
- Hallway
- birdseye
database:
# The path to store the SQLite DB (default: shown below)
path: /media/frigate/frigate.db
detectors:
coral-usb:
type: edgetpu
device: usb
coral-pci0:
type: edgetpu
device: pci:0
objects:
track:
- person
- dog
- cat
- car
- bear
- bus
snapshots:
enabled: true
timestamp: true
bounding_box: true
retain:
default: 30
mqtt:
enabled: false
host: 192.168.1.100
user: "{FRIGATE_MQTT_USER}"
password: "{FRIGATE_MQTT_PASSWORD}"
ffmpeg:
output_args:
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1
-strftime 1 -c:v copy -c:a aac
record:
enabled: true
sync_recordings: true
detections:
pre_capture: 5
post_capture: 15
retain:
days: 30
mode: motion
birdseye:
# Optional: Enable birdseye view (default: shown below)
enabled: true
# Optional: Width of the output resolution (default: shown below)
width: 1920
# Optional: Height of the output resolution (default: shown below)
height: 1080
# Optional: Encoding quality of the mpeg1 feed (default: shown below)
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
quality: 8
# Optional: Mode of the view. Available options are: objects, motion, and continuous
# objects - cameras are included if they have had a tracked object within the last 30 seconds
# motion - cameras are included if motion was detected in the last 30 seconds
# continuous - all cameras are included always
mode: continuous
detect:
enabled: true
notifications:
enabled: false
email: myemail@mac.com
cooldown: 300 # wait 300 seconds before sending another
version: 0.16-3
semantic_search:
enabled: true
model_size: small
reindex: trueRelevant Frigate log outputNothing in the frigate logs, but my Python script logs this:
disarm
Connected with result code Success
frigate/Back_Door/enabled/state b'ON'
frigate/Back_Door/recordings/state b'ON'
frigate/Back_Door/snapshots/state b'ON'
frigate/Back_Door/audio/state b'OFF'
frigate/Back_Door/detect/state b'ON'
frigate/Back_Door/motion/state b'ON'
frigate/Back_Door/improve_contrast/state b'ON'
frigate/Back_Door/ptz_autotracker/state b'OFF'
frigate/Back_Door/motion_threshold/state b'30'
frigate/Back_Door/motion_contour_area/state b'10'
frigate/Back_Door/birdseye/state b'ON'
frigate/Back_Door/birdseye_mode/state b'CONTINUOUS'
frigate/Back_Door/review_alerts/state b'ON'
frigate/Back_Door/review_detections/state b'ON'
frigate/Back_Door/person/snapshot b'\xff\xd8\xffm\xc6\x94\x13\x8a...'
frigate/Hallway/enabled/state b'ON'
frigate/Hallway/recordings/state b'ON'
frigate/Hallway/snapshots/state b'ON'
frigate/Hallway/audio/state b'OFF'
frigate/Hallway/detect/state b'ON'
frigate/Hallway/motion/state b'ON'
frigate/Hallway/improve_contrast/state b'ON'
frigate/Hallway/ptz_autotracker/state b'OFF'
frigate/Hallway/motion_threshold/state b'30'
frigate/Hallway/motion_contour_area/state b'10'
frigate/Hallway/birdseye/state b'ON'
frigate/Hallway/birdseye_mode/state b'CONTINUOUS'
frigate/Hallway/review_alerts/state b'ON'
frigate/Hallway/review_detections/state b'ON'
frigate/Hallway/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF...'
frigate/Front_Lawn/enabled/state b'ON'
frigate/Front_Lawn/recordings/state b'ON'
frigate/Front_Lawn/snapshots/state b'ON'
frigate/Front_Lawn/audio/state b'OFF'
frigate/Front_Lawn/detect/state b'ON'
frigate/Front_Lawn/motion/state b'ON'
frigate/Front_Lawn/improve_contrast/state b'ON'
frigate/Front_Lawn/ptz_autotracker/state b'OFF'
frigate/Front_Lawn/motion_threshold/state b'30'
frigate/Front_Lawn/motion_contour_area/state b'10'
frigate/Front_Lawn/birdseye/state b'ON'
frigate/Front_Lawn/birdseye_mode/state b'CONTINUOUS'
frigate/Front_Lawn/review_alerts/state b'ON'
frigate/Front_Lawn/review_detections/state b'ON'
frigate/Front_Lawn/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF...'
frigate/Garage/enabled/state b'ON'
frigate/Garage/recordings/state b'ON'
frigate/Garage/snapshots/state b'ON'
frigate/Garage/audio/state b'OFF'
frigate/Garage/detect/state b'ON'
frigate/Garage/motion/state b'ON'
frigate/Garage/improve_contrast/state b'ON'
frigate/Garage/ptz_autotracker/state b'OFF'
frigate/Garage/motion_threshold/state b'30'
frigate/Garage/motion_contour_area/state b'10'
frigate/Garage/birdseye/state b'ON'
frigate/Garage/birdseye_mode/state b'CONTINUOUS'
frigate/Garage/review_alerts/state b'ON'
frigate/Garage/review_detections/state b'ON'
frigate/Garage/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/Garage/cat/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00d...'
frigate/Backyard/enabled/state b'ON'
frigate/Backyard/recordings/state b'ON'
frigate/Backyard/snapshots/state b'ON'
frigate/Backyard/audio/state b'OFF'
frigate/Backyard/detect/state b'ON'
frigate/Backyard/motion/state b'ON'
frigate/Backyard/improve_contrast/state b'ON'
frigate/Backyard/ptz_autotracker/state b'OFF'
frigate/Backyard/motion_threshold/state b'30'
frigate/Backyard/motion_contour_area/state b'10'
frigate/Backyard/birdseye/state b'ON'
frigate/Backyard/birdseye_mode/state b'CONTINUOUS'
frigate/Backyard/review_alerts/state b'ON'
frigate/Backyard/review_detections/state b'ON'
frigate/Backyard/car/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00'
frigate/Backyard/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/Backyard/bus/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/Backyard/dog/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/AMCrest_Driveway/enabled/state b'ON'
frigate/AMCrest_Driveway/recordings/state b'ON'
frigate/AMCrest_Driveway/snapshots/state b'ON'
frigate/AMCrest_Driveway/audio/state b'OFF'
frigate/AMCrest_Driveway/detect/state b'ON'
frigate/AMCrest_Driveway/motion/state b'ON'
frigate/AMCrest_Driveway/improve_contrast/state b'ON'
frigate/AMCrest_Driveway/ptz_autotracker/state b'OFF'
frigate/AMCrest_Driveway/motion_threshold/state b'30'
frigate/AMCrest_Driveway/motion_contour_area/state b'10'
frigate/AMCrest_Driveway/birdseye/state b'ON'
frigate/AMCrest_Driveway/birdseye_mode/state b'CONTINUOUS'
frigate/AMCrest_Driveway/review_alerts/state b'ON'
frigate/AMCrest_Driveway/review_detections/state b'ON'
frigate/AMCrest_Driveway/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01'
frigate/AMCrest_Driveway/car/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01'
frigate/AMCrest_Driveway/cat/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00'
frigate/ICAMI_New_Garage/enabled/state b'ON'
frigate/ICAMI_New_Garage/recordings/state b'ON'
frigate/ICAMI_New_Garage/snapshots/state b'ON'
frigate/ICAMI_New_Garage/audio/state b'OFF'
frigate/ICAMI_New_Garage/detect/state b'ON'
frigate/ICAMI_New_Garage/motion/state b'ON'
frigate/ICAMI_New_Garage/improve_contrast/state b'ON'
frigate/ICAMI_New_Garage/ptz_autotracker/state b'OFF'
frigate/ICAMI_New_Garage/motion_threshold/state b'30'
frigate/ICAMI_New_Garage/motion_contour_area/state b'10'
frigate/ICAMI_New_Garage/birdseye/state b'ON'
frigate/ICAMI_New_Garage/birdseye_mode/state b'CONTINUOUS'
frigate/ICAMI_New_Garage/review_alerts/state b'ON'
frigate/ICAMI_New_Garage/review_detections/state b'ON'
frigate/ICAMI_New_Garage/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01'
frigate/ICAMI_New_Garage/car/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01'
frigate/ICSee_SW_Corner/enabled/state b'ON'
frigate/ICSee_SW_Corner/recordings/state b'ON'
frigate/ICSee_SW_Corner/snapshots/state b'ON'
frigate/ICSee_SW_Corner/audio/state b'OFF'
frigate/ICSee_SW_Corner/detect/state b'ON'
frigate/ICSee_SW_Corner/motion/state b'ON'
frigate/ICSee_SW_Corner/improve_contrast/state b'ON'
frigate/ICSee_SW_Corner/ptz_autotracker/state b'OFF'
frigate/ICSee_SW_Corner/motion_threshold/state b'30'
frigate/ICSee_SW_Corner/motion_contour_area/state b'10'
frigate/ICSee_SW_Corner/birdseye/state b'ON'
frigate/ICSee_SW_Corner/birdseye_mode/state b'CONTINUOUS'
frigate/ICSee_SW_Corner/review_alerts/state b'ON'
frigate/ICSee_SW_Corner/review_detections/state b'ON'
frigate/ICSee_SW_Corner/person/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/ICSee_SW_Corner/car/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/ICSee_SW_Corner/cat/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/ICSee_SW_Corner/bus/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF...'
frigate/ICSee_SW_Corner/dog/snapshot b'\xff\xd8\xff\xe0\x00\x10JFIF\x00...'
frigate/available b'online'
{'Front_Lawn', 'ICAMI_New_Garage', 'ICSee_SW_Corner', 'Back_Door', 'Hallway', 'Garage', 'AMCrest_Driveway', 'Backyard'}
pollCount = 1
0 = publish( frigate/Front_Lawn/detect/set OFF
frigate/Front_Lawn/detect/set b'OFF'
0 = publish( frigate/ICAMI_New_Garage/detect/set OFF
0 = publish( frigate/ICSee_SW_Corner/detect/set OFF
0 = publish( frigate/Back_Door/detect/set OFF
0 = publish( frigate/Hallway/detect/set OFF
0 = publish( frigate/Garage/detect/set OFF
0 = publish( frigate/AMCrest_Driveway/detect/set OFF
0 = publish( frigate/Backyard/detect/set OFF
Done setting camera detection. Now, see if frigate knows the new values.
frigate/ICAMI_New_Garage/detect/set b'OFF'
frigate/ICSee_SW_Corner/detect/set b'OFF'
frigate/Back_Door/detect/set b'OFF'
frigate/Hallway/detect/set b'OFF'
frigate/Garage/detect/set b'OFF'
frigate/AMCrest_Driveway/detect/set b'OFF'
frigate/Backyard/detect/set b'OFF'
frigate/onConnect b''Relevant go2rtc log outputNone.Frigate statsNo response Operating systemDebian Install methodDocker Compose docker-compose file or Docker CLI commandMQTT itself is work. Nothing else interesting in the docker file.Object DetectorCoral Screenshots of the Frigate UI's System metrics pagesNo response Any other information that may be helpful#!/usr/bin/python import sys, time knownCameraIDs = set() MQTT CallbacksThe callback for when the client receives a CONNACK response from the MQTT server.def on_connect( client, userdata, flags, reason_code, properties ): def on_connect_fail( client, userdata ): The callback for when any message is received from the server.def on_message( client, userdata, msg ): def on_subscribe( client, userdata, mid, reason_code_list, properties ): def on_unsubscribe( client, userdata, mid, reason_code_list, properties ): End of MQTT Callbacks################################################################ def printHelp(): def setCameraEnabled( cameraID, enabled ): ################### if len( sys.argv ) < 2: groupsToArm = [] print( f"{actionVerb}", end='' ) mqttc = mqtt.Client( mqtt.CallbackAPIVersion.VERSION2 ) mqttc.username_pw_set( creds["user"], creds["password"] ) pollCount = 0 if len( knownCameraIDs ) == 0: if "healthy" in knownCameraIDs: #print( knownCameraIDs ) Now, revise all cameras according to the command.camerasToArm = set() if actionVerb == "arm": elif actionVerb == "disarm": print( "\nDone setting camera detection. Now, see if frigate knows the new values.\n" ) Debug. Triggering camera stats.res = mqttc.publish( "frigate/onConnect" ) mqttc.loop_stop() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Looking at your configuration, I can see the issue: MQTT is disabled in your config file(1). Your config shows: mqtt:
enabled: false
host: 192.168.1.100
user: "{FRIGATE_MQTT_USER}"
password: "{FRIGATE_MQTT_PASSWORD}"The To fix this, change mqtt:
enabled: true
host: 192.168.1.100
user: "{FRIGATE_MQTT_USER}"
password: "{FRIGATE_MQTT_PASSWORD}"After making this change, restart Frigate. Then your MQTT commands to The documentation confirms that to turn object detection for a camera on and off via MQTT, you publish to 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
Looking at your configuration, I can see the issue: MQTT is disabled in your config file(1).
Your config shows:
The
enabled: falsesetting means Frigate is not listening to MQTT commands, even though your Python script is successfully publishing messages to the MQTT broker(1).To fix this, change
enabled: falsetoenabled: truein your MQTT configuration(1):After making this change, restart Frigate. Then your MQTT commands to
frigate/<camera_name>/detect/setshould w…