If you (@FranzS ) want to use the recordingGif function you have to install FFmpeg (see IP Camera Binding). recordingMP4 does not work for me. The files are copied into the FFmpeg Output Folder (things settings).
Unfortunately I don’t have an idea how to display the created files (if there are several) one by one. There is the HABpanel widget Custom Widget: Camera History and Live Popup but I don’t want to use HABpanel.
My FFmpeg setting in the things setting
The ECMA 2021 rule looks like this.
var zonedDateTime = Java.type('java.time.ZonedDateTime');
var dateTimeType = Java.type('org.openhab.core.library.types.DateTimeType');
var doorbellTest = 'ON';
if (doorbellTest == 'ON') {
console.info("Doorbell recording(1): " + items.getItem('DoorbellFoscam_GIFRecording').state);
console.info("Doorbell recording(1a): " + items.getItem('DoorbellFoscam_MP4Recording').state);
// Clear history
if (items.getItem('DoorbellFoscam_GIFHistoryLength').state > 5) {
console.info("Clear GIF history");
items.getItem('DoorbellFoscam_GIFHistoryLength').sendCommand(0);
}
// Clear history
if (items.getItem('DoorbellFoscam_MP4HistoryLength').state > 5) {
console.info("Clear MP4 history");
items.getItem('DoorbellFoscam_MP4HistoryLength').sendCommand(0);
}
if (items.getItem('DoorbellFoscam_GIFRecording').state == 0 || items.getItem('DoorbellFoscam_GIFRecording').state == 'NULL') {
var currentDateTime = (new Date);
var timeStamp = "" + currentDateTime.getFullYear() + (currentDateTime.getMonth() + 1) + currentDateTime.getDate() + currentDateTime.getHours() + currentDateTime.getMinutes() + currentDateTime.getSeconds();
actions.Things.getActions('ipcamera', 'ipcamera:foscam:DoorbellFoscam').recordGIF(timeStamp, 3);
console.info("Doorbell recording(2): " + items.getItem('DoorbellFoscam_GIFRecording').state);
}
/*
if (items.getItem('DoorbellFoscam_MP4Recording').state == 0 || items.getItem('DoorbellFoscam_MP4Recording').state == 'NULL') {
var currentDateTime = (new Date);
var timeStamp = "" + currentDateTime.getFullYear() + (currentDateTime.getMonth() + 1) + currentDateTime.getDate() + currentDateTime.getHours() + currentDateTime.getMinutes() + currentDateTime.getSeconds();
actions.Things.getActions('ipcamera', 'ipcamera:foscam:DoorbellFoscam').recordMP4(timeStamp, 3);
console.info("Doorbell recording(2): " + items.getItem('DoorbellFoscam_MP4Recording').state);
}
*/
}
