diff --git a/core/config/devices/reolink/reolink.trackMix.json b/core/config/devices/reolink/reolink.trackMix.json new file mode 100644 index 0000000..4a9b585 --- /dev/null +++ b/core/config/devices/reolink/reolink.trackMix.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/core/config/devices/reolink/reolink.trackMix.php b/core/config/devices/reolink/reolink.trackMix.php new file mode 100644 index 0000000..7ff46d6 --- /dev/null +++ b/core/config/devices/reolink/reolink.trackMix.php @@ -0,0 +1,46 @@ +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)'); + } + +} +?> \ No newline at end of file diff --git a/core/config/devices/reolink/reolink.trackMix.png b/core/config/devices/reolink/reolink.trackMix.png new file mode 100644 index 0000000..329967e Binary files /dev/null and b/core/config/devices/reolink/reolink.trackMix.png differ