This adapter uses the service Sentry.io to automatically report exceptions and code errors and new device schemas to me as the developer. More details see below!
Connects to Unifi Protect Controller and pulls all Data from added Cameras.
Standard Ports if not changed by yourself:
- Cloud Key Plus Gen2: 7443
- UDM Pro: 443
// Settings
const path = '/opt/iobroker/tmp/temp.jpg';
const threshold = 50;
// Send to Telegram ( or what you prefer )
function sendImage(path) {
sendTo('telegram.0', path);
}
//Trigger Script
on({ id: 'unifi-protect.0.motions.lastMotion.thumbnail', change: "ne" }, function () {
const thumb = getState('unifi-protect.0.motions.lastMotion.thumbnail'/*thumbnail*/).val;
const end = getState('unifi-protect.0.motions.lastMotion.end'/*thumbnail*/).val;
const cameraid = getState('unifi-protect.0.motions.lastMotion.camera'/*thumbnail*/).val;
const score = getState('unifi-protect.0.motions.lastMotion.score'/*thumbnail*/).val;
if (score < threshold) { return; }
// if Event has ended send the Thumbnail otherwise get current Snapshot
if (end != null) {
sendTo('unifi-protect.0', 'getThumbnail', { "thumbnail": thumb, "path": path }, function (res) {
sendImage(path);
});
} else {
sendTo('unifi-protect.0', 'getSnapshot', { "cameraid": cameraid, "path": path }, function (res) {
sendImage(path);
});
}
});
sendTo('unifi-protect.0', 'getSnapshot', { "cameraid": "5e4a861c01d12503870003f9", "path": path }, function (res) {
sendImage(path);
});
Sentry.io is a service for developers to get an overview about errors from their applications. And exactly this is implemented in this adapter.
When the adapter crashes or an other Code error happens, this error message that also appears in the ioBroker log is submitted to Sentry. When you allowed iobroker GmbH to collect diagnostic data then also your installation ID (this is just a unique ID without any additional infos about you, email, name or such) is included. This allows Sentry to group errors and show how many unique users are affected by such an error. All of this helps me to provide error free adapters that basically never crashs.
- dependencies updates
- first implementation of realtime updates api
- lastMotion, lastRing, lcdMessage and smartDetectZone in realTimeEvents
- (Scrounger) Button to take manual snapshot added
- (Scrounger) real time events datapoints for every cam added
- (Scrounger) take snapshot and thumbnail for real time events added (base64 images)
- (Scrounger) thumbnail image for list of motion events added (base64 images)
- (Scrounger) small thumbnail image for list of motion events and real time events added (base64 images)
- (Scrounger) camera name for list of motion events added
- added smart detections
- fixed some lastMotion stuff
- added UnifiOs Support for CloudKey
- changed Admin interface a little
- added description for port
- fixed UDM Pro writeable states
- travis ci for integration tests fixed
- actually use last x motion setting
- lastMotion of camera only updating if neccessary
- first UDM integrations, changing settings NOT working yet
- made motion Events optional (Last Motion is always stored)
- made interval and "last x seconds of motions" adjustable
- properly delete old motions
- continuosly refresh motion events
- changed data structur
- added lastMotion Datapoint to each camera
- make some settings changeable (name, osdSettings.*, recordingSettings.mode, ledSettings.isEnabled)
- new logo
- added motion event data points
- release-script test and some Readme changes
- (Peter Baumert) first working rls on npm
- (Peter Baumert) initial release
The code in protect_api is mostly copied from hjdhjd's homebridge-unifi-protect. Thank you very much for providing this code. His codes license you can find here.
MIT License
Copyright (c) 2020-2022 Peter Baumert
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.