Foscam VD1 doorbell information from button

Hello all,

I have a Foscam VD1 from which I would like to get the information that someone has operated the doorbell button.

Has anyone ever integrated the function. Unfortunately, I do not get on here. I have made the setting under VMS (Foscam software) but do not get on.

The VD1 with the IP Camera Binding works, also the readout of cgi information.

Greetings Holger

2 Likes

I have managed to read the function doorbell button (or in VMS video call).

First you have to know that the VD1 sends a GET request when the doorbell button is pressed. So I installed webhook (https://github.com/adnanh/webhook) and looked what happens here and saw how the data looks like in wireshark.

The integration itself I have integrated via httplistener binding (https://community.openhab.org/t/webhook-new-very-simple-binding-for-listening-incomming-http-requests/123597) the configuration in the http listeren binding looks like this.

UID: httplistener:HttpListener:doorbell
label: Doorbell HttpListener
thingTypeUID: httplistener:HttpListener
configuration:
  jsonConfig: |-
    {
      "channels": [
        {
          "key":"motion_detection",
          "kind": "STATE",
          "state": "req.parameters.motion_detection[0]"
        },
        {
         "key": "sound_detection",
         "kind": "STATE",
         "state": "req.parameters.sound_detection[0]"
        },
            {
         "key": "video_call",
         "kind": "STATE",
         "state": "req.parameters.video_call[0]"
        },
            {
         "key": "face_detection",
         "kind": "STATE",
         "state": "req.parameters.face_detection[0]"
        }
      ]
    }

With the channel video_call I have linked an item with which I can e.g. trigger a bell or a speaker or simply send a notification.

Hi @Jeff_Smart ,
short question does the FOSCAM VD1 also work with the IPCamera Plugin?
BR
/Franz

Hello,

the binding from the principle runs.
However, I do not know how I can read e.g. the MP3 history or what settings I have to make for this.

Greetings Holger

1 Like

Thanks for the Answer @Jeff_Smart , I’m also just starting with the ipcamera plugin.
Good to hear that the doorbell is at least compatible with that.

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);
  }
*/  
}
1 Like

Hi @Jeff_Smart,

i struggle with similar issues with my safety cam.
I’m currently thinking about to replace also my doorbell but for sure I want to make sure it works with OH. The Foscam is quite nice because it’s not so super expensive then the doorbird.

FFMpeg installation worked mp4 recording sometimes.
Gif also sometimes. I also tried to use tmpfs to avoid writing aways to a Memroy Card or SSD.
But yes I guess we need something like a “how Videos in a Folder” tool.

BR
/Franz

My solution is as follows.

When pressing the VideoCall button I get the item DoorbellHttpListener_videocall set to ON via
HttpListener. This is my trigger for the rule which starts the recording. I record max 5 records the oldest is deleted.

configuration: {}
triggers:
  - id: "3"
    configuration:
      itemName: DoorbellHttpListener_videocall
      state: ON
      previousState: OFF
    type: core.ItemStateChangeTrigger
conditions: []
actions:
  - inputs: {}
    id: "1"
    configuration:
      type: application/javascript;version=ECMAScript-2021
      script: >-
        /*
         * We use a function otherwise return is not working
         */
        function mainCheck() {

          // Reset trigger
          items.getItem('DoorbellHttpListener_videocall').sendCommand('OFF');

          // Clear history
          if (items.getItem('DoorbellFoscam_GIFHistoryLength').state > 5) {
            console.info("Clear GIF history");
            items.getItem('DoorbellFoscam_GIFHistoryLength').sendCommand(0);
          }
          
          // Make a GIF record
          if (items.getItem('DoorbellFoscam_GIFRecording').state == 0 || items.getItem('DoorbellFoscam_GIFRecording').state == 'NULL') {
            for ( let i=5; i>=1; i-- ) {
              let argSrc  = '/tmpfs/doorbell/image' +  i    + '.gif'
              let argDest = '/tmpfs/doorbell/image' + (i+1) + '.gif'
              actions.Exec.executeCommandLine('cp', argSrc, argDest);
            }    
            
            actions.Things.getActions('ipcamera', 'ipcamera:foscam:DoorbellFoscam').recordGIF('image1', 3);
            console.info('Record taken');
          }
        }

        // Call your main function from the script

        mainCheck();
    type: script.ScriptAction

The ClickableCameraImage widget I have changed as follows. Surely you can also include a loop here but I do not know how to do it.

...
slots:
  default:
    - component: oh-image-card
      config:
        action: photos
        actionPhotoBrowserConfig:
          lazy: true
          theme: dark
          type: popup
        actionPhotos:
          - http://192.168.53.21:8080/ipcamera/DoorbellFoscam/image1.gif
          - http://192.168.53.21:8080/ipcamera/DoorbellFoscam/image2.gif
          - http://192.168.53.21:8080/ipcamera/DoorbellFoscam/image3.gif
          - http://192.168.53.21:8080/ipcamera/DoorbellFoscam/image4.gif
          - http://192.168.53.21:8080/ipcamera/DoorbellFoscam/image5.gif
...

Hi @Jeff_Smart ,

In my case there was an issue with the audio encoding

I‘ve needed to sét the

MP4 Out Options to:

-c:v copy -c:a aac

BR
/Franz

With the change MP4 now also works.

1 Like

Hi everyone, I am interested in this doorbell, but the negative amazon reviews leave me thinking…
So what are your experiences after a few months with this bell?
Does it work reliably? Does it need an internet connection to work and store videos? (All my china cameras are in an isolated network without internet)
Sorry for hijacking this thread, but I think the main issue has been solved.