Hello all.
I have recently completed a comprehensive Frigate SVR binding (https://docs.frigate.video). It seems stable as I have been running it in my production environment for a while now, so I thought it might help others who are looking for something similar.
It supports autodiscovery of cameras, multiple Frigate server instances, event handling etc.
Hi, would you please provide snapshot (jar) from last stable version ? Thank you
I tried to build but got the following error:
Downloaded from central: https://repo1.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar (480 kB at 382 kB/s)
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireJavaVersion failed with message:
Detected JDK Version: 11.0.18 is not in the allowed range [17.0,18.0).
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:32 min
[INFO] Finished at: 2023-08-08T14:59:25+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java) on project org.openhab.binding.mqtt.frigatesvr: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation
Sure. I just haven’t got round to it yet. I am working on some further additional features at the moment (to allow camera streams to be routed via the openHAB instance and more easily viewed on UIs without needing to install the ipcamera binding as well). Once these are done I will build against both the development tree and the stable version. I’ll also attempt to release it via the Marketplace.
That having been said, my production system is running the stable version along with the FrigateSVR binding built against the 4.1.0 development snapshot with no issues.
yes Java 17 is required for OH 4.1, but I’ve tried to build on other station, this is a reason of above issue, anyway will try upgrade version my java to 17, and try again, will see
seems that module is Active,
337 │ Active │ 80 │ 4.1.0.SNAPSHOT-sources │ org.openhab.binding.mqtt.frigatesvr
but I can’t find the same binding via UI , do you have an idea why?
Do you have the MQTT binding installed? When clicking to add a new ‘thing’ if you select the MQTT binding, you then should see the frigateSVR server and camera options. The frigateSVR binding sits on top of MQTT.
I have just released v1.5 of this binding to support local video re-streaming for use with openHAB UI widgets - please take a look if you are interested. There is a .jar release built against 4.1.0-SNAPSHOT available. I will create a build against the stable tree soon.
Thanks for update, Yes I have already installed MQTT bindings and few things which use this, however I cant find your binding, anyway will waiting for your update and jar file,
I have just released v1.6 of this binding - this includes full video support and an API forwarder for UIs. There are also .jar releases built against openhab-addons 4.1.0-SNAPSHOT and 4.0.0 stable.
Give this release a try. I’m not sure why you can’t see the binding - did you copy the .jar to the openHAB addons directory?
Very nice! I’ll try to find some time to try it out. You plan on trying to get it into the main openhab distro, no?
A couple of suggestions, before you get to a PR:
I’m not sure why you need a serverKeepAlive configuration option at all. Frigate sets up a LWT, so you can simply subscribe to the frigate/available topic to know its current state.
the channels on the server thing all seem like they should be properties of the thing, not channels, though perhaps they’re necessary for main UI to get the URLs?
polling the camera FPS and other statistic can be an expensive request to Frigate if you have a lot of cameras. does it skip doing so if none of the cameras have the relevant channels linked to an item?
an event only channel on the server (for all events) and the camera (already filtered to only events for this camera) would be nice, passing the full JSON of the message that was sent to frigate/events.
break up the channels for current and previous states into two channel groups (and then re-use the channel types for each channel for both of those groups)
I’m aware of frigate/available, but on testing it didn’t work in all circumstances. My Frigate environment can be made to disappear, or even be cleanly shut down without sending the ‘offline’ message. I could use LWT but the regular keepalive has other purposes as well. Furthermore, the Frigate system sends the ‘online’ message an indeterminate time before the HTTP services become available, rather than once the Frigate server is fully operational. This created its own issues. The keepalive seemed to be the most ‘robust’ solution (albeit at the expense of a tiny bit of network traffic).
The channels (I assume you mean the URLs) can change depending on the Frigate configuration and its setup - I wanted an easy way to be able to pull the current value into an item so a UI could read it. and a channel seemed to be the obvious way. I’ll have a look at an alternative though (note below, I’m still not massively familiar with OH internals).
‘fg’ - easy to change; just preferred this in my environment.
The stats aren’t polled; Frigate pushes these via MQTT and the frigate/stats topic. I just grab it and make it available.
Event only channel on the server ‘thing’ - this isn’t a bad idea. I don’t need it in my environment but it would be a doddle to add. Should this just be a String channel with the JSON in it?
Channel groups: I like the idea of this; will investigate further.
I’m not massively familiar with OH internals, or indeed OH itself. It was a recent choice between OH and HA for my application; OH won by a wide margin, but that was contingent on me writing a Frigate binding as there wasn’t one and I needed it. Having done so, it only seemed right to release it so that anyone else in the same situation can make use of it. I’m more than happy if OH maintainers want to include it; in the meantime once I have run it for a little longer to check for any lurking issues, I had planned to release via the Marketplace.
Been playing around with this and it looks really interesting.
I am trying to build an openhab rule so that when a new event is detected it will send me the snapshot via telegram or email, etc. I can see there is fgCurHasSnapshot but I can’t see a way to get the current snapshot, only the previous snapshot fgLastSnapshot. Or is fgLastSnapshot the current snapshot?
Also might be useful to add a channel of type “trigger” when a new event comes in as currently it is tricky to have a rule which can detect when a new event has occurred, unless I am missing something.
Thanks for testing this and for your feedback.
You should be able to detect an event by placing a trigger on ‘fgEventType’. This will be updated whenever an event is detected by the Frigate system. It will be one of ‘new’, ‘update’ or ‘end’ depending on whether this is a new event, a current event that has changed, or an event that has ended. fgEventID will carry the event ID corresponding to this.
‘fgHasSnapshot’ will be set true if a snapshot is available, and fgLastSnapshot indeed will carry the last captured snapshot for the current event (these are documented in the Frigate API documentation).