Hi alle,
ist es schon jemandem gelungen die Doorbird mit den letzten Besuchern in die VIS einzubinden? (Bild und daneben Zeitpunkt des Klingels)
Es gibt ja die Möglichkeit mittels IP/bha-api/history.cgi?event=doorbell&index=1
das Bild des letzten Klingels aufzurufen.
Im Doorbird eigenen Webinterface erhält man auch die Uhrzeit des Klingels mittels
IP/bha-api/view.html
Wie bekommt man die Uhrzeit in die VIS eingebunden?
Leider reichten meine Programmierkenntnisse nicht aus um den Code dahingehend auszulesen.
Ab Code Zeile 700 scheint es dort los zu gehen:
(Auszug)
function showHistoryImage(httpResponse) {
if (httpResponse && httpResponse.status == AjaxHTTPResponseStatusCode.OK && httpResponse.content != null) {
var parameter = httpResponse.getParameter();
if (parameter != null) {
var container = parameter.get("container");
var timeContainer = parameter.get("timeContainer");
if (container != null) {
var arrayBufferView = new Uint8Array(httpResponse.content);
var blob = new Blob([arrayBufferView], {
'type': 'image\/jpeg'
});
objectURL = window.URL.createObjectURL(blob);
container.src = objectURL;
if (timeContainer) {
try {
var timestamp = httpResponse.getHeader("X-Timestamp");
if (timestamp == null) {
timestamp = httpResponse.getHeader("x-timestamp");
}
if (timestamp) {
var time = parseInt(timestamp) * 1000;
var date = new Date(time);
var weekdays = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
timeContainer.innerHTML = weekdays[date.getDay()] + " " + fillLeadingZeros(date
.getDate(),
2) + "." + fillLeadingZeros(date.getMonth() + 1, 2) + "." + date
.getFullYear() +
" " + fillLeadingZeros(date.getHours(), 2) + ":" + fillLeadingZeros(date
.getMinutes(),
2) + ":" + fillLeadingZeros(date.getSeconds(), 2);
}
} catch (e) {
//ignore
}
}
}
}
} else {
loadFailedHistory();
}
}
function fillLeadingZeros(value, size) {
var res = '';
for (var i = 1; i < size; i++) {
if (value < Math.pow(10, i)) {
res += '0';
}
}
res += '' + value;
return res;
}
function changeDesktopNotificationSetting(showAlert) {
if (checkNoDesktopNotificationSupport()) {
if (showAlert)
alert("This browser does not support desktop notification.");
return;
} else if (Notification.permission === "granted") {
showDesktopNotification = !showDesktopNotification;
} else if (Notification.permission === "denied") {
alert("You have prohibited desktop notifications of this page in your browser settings.");
} else {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
showDesktopNotification = true;
}
switchDesktopNotificationEntry();
delete showDesktopNotification;
});
return;
}
switchDesktopNotificationEntry();
}
function switchDesktopNotificationEntry() {
updateCookieSettings();
if (showDesktopNotification && !monitorRunning)
startNotificationMonitor();
var notificationImg = document.getElementById("checkmark_notification_desktop");
if (notificationImg) {
if (showDesktopNotification) {
notificationImg.style.display = "inline";
} else {
notificationImg.style.display = "none";
}
}
}