Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions core/config/devices/reolink/reolink.trackMix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"name" : "Reolink TrackMix",
"manufacturer" : "Reolink",
"buylink" : "https://reolink.com/fr/product/reolink-trackmix-poe/",
"configuration": {
"port": "",
"urlStream": "\/cgi-bin\/api.cgi?cmd=Snap&channel=0&user=#username#&password=#password#",
"cameraStreamAccessUrl" : "rtsp:\/\/#username#:#password#@#ip#\/h264Preview_01_sub",
"protocole": "https"
},
"commands": [
{
"eqType": "camera",
"name": "Motion alarme",
"type": "info",
"subType": "binary",
"isHistorized": "1",
"isVisible": "1",
"logicalId" : "motionDetectAlarm",
"display" : {
"invertBinary" : "1"
},
"template" : {
"dashboard" : "timePresence",
"mobile" : "timePresence"
},
"configuration": {
"repeatEventManagement": "never"
}
},
{
"eqType": "camera",
"name": "Motion Pet alarme",
"type": "info",
"subType": "binary",
"isHistorized": "0",
"isVisible": "1",
"logicalId" : "motionDogcatAlarm",
"display" : {
"invertBinary" : "1"
},
"template" : {
"dashboard" : "timePresence",
"mobile" : "timePresence"
},
"configuration": {
"repeatEventManagement": "never"
}
},
{
"eqType": "camera",
"name": "Motion People alarme",
"type": "info",
"subType": "binary",
"isHistorized": "0",
"isVisible": "1",
"logicalId" : "motionPeopleAlarm",
"display" : {
"invertBinary" : "1"
},
"template" : {
"dashboard" : "timePresence",
"mobile" : "timePresence"
},
"configuration": {
"repeatEventManagement": "never"
}
},
{
"eqType": "camera",
"name": "Motion Vehicle alarme",
"type": "info",
"subType": "binary",
"isHistorized": "0",
"isVisible": "1",
"logicalId" : "motionVehicleAlarm",
"display" : {
"invertBinary" : "1"
},
"template" : {
"dashboard" : "timePresence",
"mobile" : "timePresence"
},
"configuration": {
"repeatEventManagement": "never"
}
},
{
"eqType": "camera",
"name": "Motion Face alarme",
"type": "info",
"subType": "binary",
"isHistorized": "0",
"isVisible": "1",
"logicalId" : "motionFaceAlarm",
"display" : {
"invertBinary" : "1"
},
"template" : {
"dashboard" : "timePresence",
"mobile" : "timePresence"
},
"configuration": {
"repeatEventManagement": "never"
}
}
]
}
46 changes: 46 additions & 0 deletions core/config/devices/reolink/reolink.trackMix.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
function reolink_trackMix_update($_eqLogic) {
$url = $_eqLogic->getConfiguration('ip') . ':' . $_eqLogic->getConfiguration('port',80);
$url .= '/cgi-bin/api.cgi?cmd=GetMdState&user=' . $_eqLogic->getConfiguration('username') . '&password=' . $_eqLogic->getConfiguration('password');
$request_http = new com_http($url);
try {
$result = $request_http->exec();
$data = json_decode($result, true);
$cmd = $_eqLogic->getCmd('info', 'motionDetectAlarm');
if (is_object($cmd)){
if (isset($data[0])) {
if(array_key_exists("value", $data[0])) {
if(array_key_exists("state", $data[0]['value'])) {
$_eqLogic->checkAndUpdateCmd($cmd, $data[0]['value']['state']);
}
}
}
}
} catch (Exception $e) {
log::add('camera', 'debug', 'Erreur com_http ! (GetMdState)');
}

$url = $_eqLogic->getConfiguration('ip') . ':' . $_eqLogic->getConfiguration('port',80);
$url .= '/cgi-bin/api.cgi?cmd=GetAiState&user=' . $_eqLogic->getConfiguration('username') . '&password=' . $_eqLogic->getConfiguration('password');
$request_http = new com_http($url);
try {
$result = $request_http->exec();
$data = json_decode($result, true);
if (isset($data[0])) {
if(array_key_exists("value", $data[0])) {
foreach ($data[0]['value'] as $key => $value) {
if(is_array($value) && array_key_exists("support", $value) && $value['support'] == 1) { // return support or not
$cmd = $_eqLogic->getCmd('info', 'motion' . ucfirst(str_replace('_', '', $key)) . 'Alarm');
if (is_object($cmd) && array_key_exists("alarm_state", $value)) {
$_eqLogic->checkAndUpdateCmd($cmd, $value['alarm_state']);
}
}
}
}
}
} catch (Exception $e) {
log::add('camera', 'debug', 'Erreur com_http ! (GetAiState)');
}

}
?>
Binary file added core/config/devices/reolink/reolink.trackMix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading