[OBSOLETE] Foscam Camera Device Handler Universal DTH with Motion Detection - SD (FI89xx), HD Ambarella FI98xx, FI99xx, Cx, Gx, Rx, Ex, Zx, Fosbaby

Is there any existing ability (or plan) to provide a way to use the speaker on a 2-way camera for playback? I’d like to be able to play a specific sound thru the speaker on motion detection.

There’s no way to “send” audio to the camera through ST, the 2 way is limited to live viewing and ST doesn’t support sending audio return yet.

@RBoy I’ve been able to connect everything up for my C1 I just received. However, when I view the image in Foscam it’s pretty clear. When I view in ST, sometimes it looks good but most of the time it’s very green. Is there a specific setting I need to change somewhere?
Foscam App Screenshot
FoscamScreenshot
ST Screenshot
ST_screenshot

@RBoy now all of a sudden my camera wont even show up. it always shows Camera Unavailable. Are there any logs i can look into to see what the problem is?
Edit: I’ve looked into the live logging and i can see thats it’s reaching out to the right address (blocked out IP and password):
5d09f77d-d2c8-4cf8-96c7-4c67ba3b7598 1:50:58 PM: trace Called getInHomeURL, returning http://*****:80/videostream.cgi?user=camera1&pwd=&resolution=32
Edit: I completely removed the device from ST and added it back. I can now see the green screen again. It’s using rtsp link correctly now
rtsp://camera1:
@****:554/videoMain <-- correct address
But it is still showing up as green. When it initially connected, the color was correct but since it has stayed green no matter what i do

The green screen is an issue with the ST mobile app video tile (I’m guessing you’re on Android). What has worked for folks in the past is to

  1. Reboot the phone
  2. Reboot the camera
  3. Play with the MJPEG settings

One of these three things usually resolves the issue, but again it’s phone/ST dependent

Hi,

I’m using the Foscam Handler and everything works as expected. Just using it to enable/disable motion detection based on home/away. Issue i’ve run into is when I set detection area settings in the camera portal they are being reset to defaults the next day even on cameras that are in ST but have not had any actions taken on them by ST during that time period. Same thing happens on two different type of foscam cameras.

Any idea of how to get the detection area settings to stay?

You will need to define them in the device handler settings page (requirement of the Foscam API). If you have the detection parameters you can enter them directly.

If you need help to understand how to create the detection parameters, see this post for details:

1 Like

@RBoy so I have my camera working inhome and outhome but it sucks that I have to change the IP of the device based on where I am.
Like, if I have my phone and I’m not on my home wifi because im away i have to edit the device and put my home’s publish ip address. If i’m behind my router, obviously I have to put my in-home IP address. Is there a way to make it where both will work without changes to properties?

Not required. Not sure why you’re switching IP addresses. This is how internal and external IP addresses work:

  1. Using the the LAN IP address works inside and outside the house as all communication is routed through the hub
  2. Using an external IP address will work inside and outside the house IF your router supports loopback connections (i.e. it detects that the IP address is it’s own public IP and loops it back). If your router doesn’t support loopback connections then you won’t be able to communicate while inside the house (but will work outside the house).

You’re best off using 1 (except for video which requires a direct connection between your camera and your phone) for best compatibility with routers.

If you’re using video then get a router which supports loopback connections and use 2.

Hi RBoy

I noticed a while back someone asked about R2 support but couldn’t see any updates since then. Well I have an R2 and wanted to set that up with your DTH so have made some modifications and it all seems to work ok. Just thought I would share them with you so you can build them into the official release if you wanted to.

The problem stems from the fact Foscam made a new API for cameras that support multiple detection zones. Everything else is the same apart from the command name and the detection area formatting.

I added the following option after your “hdcamera” in the preferences to enable for an R2 device - note you need to enable both hdcamera and r2camera because I haven’t changed every reference to the API, just the motion detection bits that have changed. There is probably a better way of doing this (combine them both into an enum field?) but that would mean changing all the rest of your “if (hdcamera)” logic.

input("r2camera", "bool", title:"Enable this if the camera is a R2 model?", description: "R2 Model", required: false, displayDuringSetup: true)

The new alarmOn and alarmOff functions are as follows:

def alarmOn() {
	log.debug "Enabling Alarm"
	if(r2camera) {
        delayBetween([hubGet("cmd=setMotionDetectConfig1&isEnable=1&snapInterval=1&sensitivity=${getMotionLevel(motionLevel)}&linkage=${getMotionAlarmEvents()}&triggerInterval=${getReArmInterval("15s")}&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&${getDetectionArea(detectionArea)}&1421696056773"), hubGet("cmd=setAudioAlarmConfig&isEnable=${soundAlarm ? "1" : "0"}&sensitivity=0&linkage=${getMotionAlarmEvents()}&triggerInterval=${getReArmInterval("15s")}&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655"), poll()], delayInterval())
    }
    else if(hdcamera) {
        delayBetween([hubGet("cmd=setMotionDetectConfig&isEnable=1&snapInterval=1&sensitivity=${getMotionLevel(motionLevel)}&linkage=${getMotionAlarmEvents()}&triggerInterval=${getReArmInterval("15s")}&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655&${getDetectionArea(detectionArea)}&1421696056773"), hubGet("cmd=setAudioAlarmConfig&isEnable=${soundAlarm ? "1" : "0"}&sensitivity=0&linkage=${getMotionAlarmEvents()}&triggerInterval=${getReArmInterval("15s")}&schedule0=281474976710655&schedule1=281474976710655&schedule2=281474976710655&schedule3=281474976710655&schedule4=281474976710655&schedule5=281474976710655&schedule6=281474976710655"), poll()], delayInterval())
    }
    else {
    	delayBetween([hubGet("/set_alarm.cgi?motion_armed=1&motion_sensitivity=${getMotionLevel(motionLevel)}&motion_compensation=${lightCompensation ? "1" : "0"}&sounddetect_enabled=${soundAlarm ? "1" : "0"}&sounddetect_sensitivity=9&mail=${motionEMail ? "1" : "0"}&upload_interval=${motionSnap ? "1" : "0"}&"), poll()], delayInterval())
    }
}

def alarmOff() {
	log.debug "Disabling Alarm"

    if(r2camera) {
		delayBetween([hubGet("cmd=setMotionDetectConfig1&isEnable=0"), hubGet("cmd=setAudioAlarmConfig&isEnable=0"), poll()], delayInterval())
    }
    else if(hdcamera) {
		delayBetween([hubGet("cmd=setMotionDetectConfig&isEnable=0"), hubGet("cmd=setAudioAlarmConfig&isEnable=0"), poll()], delayInterval())
    }
    else {
    	delayBetween([hubGet("/set_alarm.cgi?motion_armed=0&sounddetect_enabled=0&"), poll()], delayInterval())
    }
    
}

And finally the only other change was to the getDetectionArea function, which now reads as follows. Note for this to work I also removed the default value for the detectionArea preference - as the full frame default for other cameras already seems to be defined in this function anyway

private String getDetectionArea(area) {
	log.trace "User entered detection:$area"
    
    if (area?.trim()) {
    	// Remove any trailing or leading & if entered accidentally
        area = area.replaceAll("^&+", "") // Leading &
    	area = area.replaceAll("&+\$", "") // Trailing &
        return area
    } else if (r2camera) {
    	return "x1=0&y1=0&width1=10000&height1=10000" // Default is full frame detection
    } else {
    	return "area0=1023&area1=1023&area2=1023&area3=1023&area4=1023&area5=1023&area6=1023&area7=1023&area8=1023&area9=1023" // Default is full frame detection
    }
}

Hopefully if you don’t want to include this in the release version this post might be handy to someone else out there who has an R2 as well :slight_smile:

Nick

1 Like

Great to see, but we added R2 support quite some time ago (Jan 2016). There an option in the settings (if you’re on the latest version) that asks you to select the camera Model. R2 models are also known as the Ambarella series. There are many more changes to the API for the Ambarella series, check out the below.

Here’s the release notes for the R2 support:

Here are the configuration instructions for the R2 (and other Ambarella cameras):

You may be on an older version. update to the latest version and let us know if you have any issues.

Hi @RBoy I would assume the biggest use of these camera’s is going to be the videos. Given that most ISP provider routers do not support loopback connections (I have Comcast, it 100% doesnt as well as others I researched), I would assume there would be a simple way for the enduser to plug in InHomeURL / OutHomeURL? That would seem like low hanging fruit to me.
Is there a planned update to support this? On the same screen that asks for IP address there could be an advanced option that lets you key in both those IPs instead of relying on the functionality of the router to support loopback? Is it possible to provide an update that supports this?

@RBoy I was able to update the device handler to have a separate field for external ip. The video settings are now correct:
Video settings: [OutHomeURL:rtsp://camera1:XXXXXXXXXX@98.XXX.XXX.XXX:554/videoMain, InHomeURL:rtsp://camera1:XXXXXXXXXX@10.0.0.5:554/videoMain, ThumbnailURL:http://cdn.device-icons.smartthings.com/camera/dlink-hdpan@2x.png, cookie:[key:key, value:value]]

However, I can’t see how to make whatever is consuming that event switch from the inhomeurl to the outhomeurl. Any help with this?

Edit: it actually works sometime, but some time it says there was a problem with the livestream url

ST does not differentiate between them currently. That’s reserved for future use. Given your setup your best bet is to use the LAN IP Address to control the cameras and use the native Foscam app for viewing live video using your external IP address.

If you’re interested you can buy a cheap router and run Tomato firmware and put your comcast modem in bridge mode. Then you’ll have loopback support.

@RBoy for some reason it seems to work with the changes i made about 75% of the time now. I’m not sure why, it seems i just need to relaunch ST(mobile app) if i do rapid changes. I don’t know if they have an update to ping the internal ip now or something but i’ve been able to see my video when I take my phone off of my home wifi

1 Like

@RBoy I just had two more cameras delivered. I have all them running on different ports that are forwarded and i can see all three cameras live on wifi and off wifi using the changes I made

1 Like

Excellent, thanks for the feedback. We did think about including an option for internal and external IP address but that creates a problem with the basic camera communication hence for ease of configuration for the users we’ve limited the input to only one address. However for the future as we redesign the app we will consider having a separate input for internal and external address specifically for the video camera feed unless ST finds a better way to handle the video streaming functionality.

Old post but assume the question was regarding the zoom on the camera itself.

I was looking at this one to replace an existing camera (even though my current one has a 18x zoom). It is Foscam but any idea if it may be possible to add the ‘zoom’ function to the DH?

Thanks.

http://www.vesternet.com/foscam-fi9928p-1080p-hd-ptz-wireless-ip-outdoor-camera

@RBoy, the “Assign camera preset for modes” option for the Foscam Motion Alarm Monitor does not work properly. I have Preset 1 and Preset 2 saved for Home and Away modes but only the Away mode moves the camera to Preset 2. When a ST Routine or SHM change the mode to Home, the camera does not go to Preset 1. Is there a bug in the code or something I can do?

@RBoy; does the device handler & app support FI9900EP &FI9901EP
cheers