New comprehensive Frigate binding

Unlikely - see my earlier post on the matter of the Frigate binding being included in mainline. It would seem that I would have to undertake a significant amount of work simply to get it included; and I have neither the time nor the inclination to do this when I could be spending the limited amount of time I have to work on this project developing and improving it.

That having been said - I hope to release as a third-party add-on via the ‘marketplace’ when it is sufficiently stable.

1 Like

It would be worth the effort long term, I believe.

1 Like

Unlikely - see my earlier post on the matter of the Frigate binding being included in mainline. It would seem that I would have to undertake a significant amount of work simply to get it included;

That’s fair, but on the other hand you would not have to do any work to keep it up to date with new OH releases. It would be useful to be able to install eg milestone builds and not lose the binding.

Perhaps we can crowdsource the work? Would you be willing to submit the PR for mainline, and then I can help address any review comments, as long as it’s not a major rewrite? I’ve contributed a binding before so I have some experience with the codebase.

Hello there!
if you have the time, I would like you to comment on the result you got, if your scenario is different than mine: I am trying to get this binding to work with OpenHAB 4.2.1 and Frigate 0.14.1; I’m open to suggestions on ways to debug this behaviour, if is not the intended one. Otherwise, I’d be glad to know what I am missing.

I compiled the repository at the main branch and commit 14007fd, checking it out inside the openhab-addons repo at version 4.2.1.

Following the build instructions I obtained a JAR for OpenHAB 4.2.1 and after copying it inside the addon folder of a running OpenHAB 4.2.1 instance, it was detected and loaded without errors.

However, I am not able to add cameras after creating the Frigate server Thing in OpenHAB:

I am running Frigate 0.14.1

After creating correctly the frigate server Thing and going back to Things > + > MQTT Binding > Search the Camera I am using from the Frigate configuration is discovered automatically, then I click on it and choose a name and in the end it never gets past the offline status “CONFIGURATION_PENDING waiting for status”. The OpenHAB logs do not report any error or warning, nor the Frigate logs do.

Using the TRACE log level when adding the camera device does not reveal any information either; the following is what appear on the log at DEBUG level when adding the camera device I would like to use:

16:53:22.986 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' to inbox.
16:53:22.987 [INFO ] [openhab.event.InboxAddedEvent        ] - Discovery Result with UID 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' has been added.
...
16:54:29.405 [DEBUG] [rnal.handlers.frigateSVRServerHandler] - keep-alive: device is online
16:54:30.287 [INFO ] [openhab.event.InboxRemovedEvent      ] - Discovery Result with UID 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' has been r
emoved.
16:54:30.294 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' changed from UNINITIALIZED to 
INITIALIZING
16:54:30.297 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - camera libreria_sala INITIALIZATION handler called 
16:54:30.297 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - camera: SetOffline called, stopping streamer
16:54:30.297 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - camera libreria_sala: unsubscribing from MQTT
16:54:30.298 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - unsubscribe: connection is null
16:54:30.298 [DEBUG] [rnal.handlers.frigateSVRCameraHandler] - offlining device
16:54:30.298 [INFO ] [vr.internal.servlet.frigateSVRServlet] - StopServer called: stopping streaming server
16:54:30.298 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - camera libreria_sala: bridge going online
16:54:30.299 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' changed from INITIALIZING to O
FFLINE (BRIDGE_OFFLINE)
16:54:30.299 [INFO ] [rnal.handlers.frigateSVRCameraHandler] - cam going online: requesting status: frigateSVR/mqtt:frigateServer:460b8fd214:frigate_auriga/lib
reria_sala/camOnLine
16:54:30.299 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' changed from OFFLINE (BRIDGE_O
FFLINE) to OFFLINE (CONFIGURATION_PENDING)
16:54:30.300 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000' changed from OFFLINE (CONFIGUR
ATION_PENDING) to OFFLINE (CONFIGURATION_PENDING): waiting for status
16:54:34.417 [DEBUG] [rnal.handlers.frigateSVRServerHandler] - keep-alive: device is online

For reference, this is the YAML of the frigate server Thing:

UID: mqtt:frigateServer:460b8fd214:frigate_auriga
label: frigateSVR Auriga
thingTypeUID: mqtt:frigateServer
configuration:
  ffDASHPackageCommands: -seg_duration 1 -streaming 1
  serverClientID: ""
  ffDASHTranscodeCommands: -acodec copy -vcodec copy
  enableAPIForwarder: true
  ffMJPEGTranscodeCommands: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ffmpegLocation: /usr/bin/ffmpeg
  ffHLSStartProducerOnLoad: false
  enableStream: true
  streamWhitelist: DISABLE
  ffTempDir: ""
  ffMJPEGStartProducerOnLoad: false
  ffHLSTranscodeCommands: -acodec copy -vcodec copy
  ffMinFramesToStart: 10
  serverURL: http://127.0.0.1:5000
  serverKeepAlive: 5
  HTTPTimeout: 100
  ffDASHStartProducerOnLoad: false
  ffKeepalivesBeforeExit: 2
bridgeUID: mqtt:broker:460b8fd214
location: Sala

And here it is the YAML of the Camera Thing:

UID: mqtt:frigateCamera:460b8fd214:libreria_sala-127-0-0-15000
label: "Camera : libreria_sala"
thingTypeUID: mqtt:frigateCamera
configuration:
  ffDASHPackageCommands: -seg_duration 1 -streaming 1
  ffmpegCameraNameOverride: ""
  ffDASHTranscodeCommands: -acodec copy -vcodec copy
  ffMJPEGTranscodeCommands: -q:v 5 -r 2 -vf scale=640:-2 -update 1
  ffHLSStartProducerOnLoad: false
  enableStream: true
  serverID: mqtt:frigateServer:460b8fd214:frigate_auriga
  ffTempDir: ""
  ffMJPEGStartProducerOnLoad: false
  ffHLSTranscodeCommands: -acodec copy -vcodec copy
  ffMinFramesToStart: 10
  ffDASHStartProducerOnLoad: false
  ffKeepalivesBeforeExit: 2
  cameraName: libreria_sala
bridgeUID: mqtt:broker:460b8fd214

Finally, the configuration snippet in Frigate for that camera I am exposing to MQTT

go2rtc:
  streams:
    libreria_sala:
      - rtsp://user:passwd@192.168.1.90:554/live2.sdp

cameras:
  libreria_sala:
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/libreria_sala
          input_args: preset-rtsp-restream
          roles:
            - detect
    detect:
      enabled: true
      width: 1280
      height: 720

I’ll have a look at this in more depth when I next have some time available to do so. What seems to be happening is that the camera Thing does not appear to be receiving the MQTT status messages from the server Thing that would online the camera. Does your Frigate server have a client_id set?

Thanks for your response! I will keep an eye on the email notifications for when you or maybe another user will have time to give me a new idea or to help investigate.


I did not set the client id parameter in Frigate’s config nor inside the Thing settings in OH, relying on the default which should have the value frigate (according to Frigate’s own Full config reference )

In this first case I describe above, the server Thing connects to the Frigate instance without errors, at least on the OpenHAB logs:

22:52:50.077 [INFO ] [rnal.handlers.frigateSVRServerHandler] -  - Frigate server is offline
22:52:50.094 [INFO ] [rnal.handlers.frigateSVRServerHandler] - onlining server thing
22:52:50.094 [INFO ] [rnal.handlers.frigateSVRServerHandler] - enabling API forwarder
22:52:50.094 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'mqtt:frigateServer:460b8fd214:frigate_auriga' changed from OFFLINE (CONFIGURATION_PENDING) to ONLINE
22:52:50.094 [INFO ] [rnal.handlers.frigateSVRServerHandler] - enabling birdseye streaming server
22:52:50.095 [INFO ] [vr.internal.servlet.streams.HLSStream] - stream entry point set to birdseye.m3u8
22:52:50.095 [INFO ] [nternal.servlet.streams.FFmpegManager] - created working path STM2020091456089636599
22:52:50.095 [INFO ] [r.internal.servlet.streams.DASHStream] - sending stream to birdseye.mpd
22:52:50.096 [INFO ] [nternal.servlet.streams.FFmpegManager] - created working path STM705503912119675277
22:52:50.096 [INFO ] [rnal.handlers.frigateSVRServerHandler] - starting streaming server
22:52:50.096 [INFO ] [vr.internal.servlet.frigateSVRServlet] - Starting server at /frigate
22:52:50.098 [INFO ] [vr.internal.servlet.frigateSVRServlet] - streaming servlet started

At the time of writing this, I just tested the addition of a client_id parameter in both Frigate’s MQTT config and in the OH MQTT frigateSVR Thing, using both the default frigate value and also trying a custom one: in both cases, the server Thing will never connect to the Frigate instance, reporting the following warning at each retry on OH’s logs:

22:49:06.345 [INFO ] [rnal.handlers.frigateSVRServerHandler] -  - Frigate server is offline
22:49:06.352 [WARN ] [rnal.handlers.frigateSVRServerHandler] - server config block not valid (java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $)

NOTE: the rest of the Thing’s configuration is the same as my post above, with the addition of the key-value

serverClientID: frigate