Pairing a Vistacam

@ImBrian ahhh… I had never understood using the Simulator to setup your own smartapps, now I find that through the simulator I can setup the preset based on mode. Real nice!

I hope we can get the local control working, I hate having my cameras be open, even with unique accounts, passwords and random ports…

The two cameras I have so far are both baby monitors, so when we’re home they point at beds, but when we’re away they point to doors to see down hallways for the motion detection. Now it all works well!

@erikmichael - working on it as we speak. Some success.

@Imbrian, not sure if this makes a difference but on line 33 of foscam.groovy there is a spelling mistake.

attribute "alarmStats", "string"

It should read

attribute "alarmStatus", "string"

I have two foscam models that I would like to test out.

FI9821W v2 - indoor model pan,tilt, no zoom
FI9804 - outdoor model, no pan/tilt

If I read what @trotsky40 / Blake said I should be able to replace the command strings in groovy.foscam with the equivalent command strings from the models above correct? Is there anything else I should be aware of when testing this?

@trotsky40

I read on the dropcam blog post that you had the “Busrt When” smart app working with the foscams. Is this true? I see the command coming to the camera but do not see the picture being saved. Any ideas?

@tslagle13

Yes, it is working for me though slightly inconsistently. It is supposed to take 5 images but most of the time it only takes 3 or 4.

In my set-up I am having a Foscam f8910w taking pictures when triggered from a Aeon Labs MulitSensor. In the picture below, the camera took 4 pictures when triggered by motion at 2:40pm.

@trotsky40

I get that as well. Where are you able to view the images that are taken? I can’t find them anywhere. The only way I can see the images is if I have said camera open in the app when the take command is sent.

If the app is closed when triggered I can’t find said captures anywhere. Are you seeing the same thing?

@tslagle13

I can always view at least the latest event from the camera whether the app is opened or closed. Right now the camera has 10 images available and it looks like it has the last 2 or 3 events stored.

@trotsky40

Interesting… This is not the case for me.

@trotsky40

Are you using the code @imbrian has on his GIT for the device type? Or do you have something you can share?:):slight_smile:

Edit: I figured it out. Android app fail… Looks like the android app cannot display it but my work phone (iPhone) can.

@theredmoose - thanks! I’d actually corrected that locally, but haven’t pushed to git just yet. I’ve been working on the local IP version and have something working “okay”. Want to make sure it’s polished before it’s public.

I tried this but when I get to ‘edit preferences’, the only option is username and password. There’s no where to enter the ip address of the camera. The device is in ST but doesn’t allow me to do anything, of course. Any idea where I went wrong?

I got everything working as it should, or the best it can for now. The problem I had that I mentioned above was solved once I realized that Foscam existed under ‘device type’ both in it’s alphabetical place and at the end of the list. Once I chose the one at the end, it worked. One thing that confused me is when creating a device type, you don’t really need to enter anything; just hit create and then paste the code provided by imbrian. I realize others may have found this obvious, but being new to this, I was confused by the duplicative entries.

Figuring out the app took some time as well, but once I did, I was able to make one for arm and one for disarm.

We need a gofundme page or something for developers like you all to make youtube videos for situations like this or have a pay per view type system. Reading through the forums obviously will eventually work but watching someone do it live is so helpful. I realize that money doesn’t motivate everyone but time is money and videos on this site would go a long way. Agree?

I have been watching this forum for some time…looking forward to your local IP version! Like many, my cameras are all behind a firewall…one that I would like to keep without holes. Please do keep us updated when you have working code. Thanks!

Just an FYI for everyone, This basically works for Tenvis camera’s with latest firmware as well. Only things I had to change was the Pan Up/Down as they were backwards and change the snapshot from POST to GET. Tenvis are basically generic rebrands of Foscam as well. Cheaper too :smile:

I’d be tempted for us to make a more ‘powerful’ script eventually, that allows a selection of cameras, and sends the commands appropriate to each camera.

1 Like

Has anyone found a way to add any level of dashboard integration?

In case this helps someone else, I put together a smartapp that will move your foscam camera to different presets based on motion sensors or contact/acceleration sensors. For me if a motion sensor is tripped in the front of the house the camera automatically pans to preset1 to view that location, and goes to another preset for the motion sensor and multi sensor in the back of the house. Now that my camera is pointed to the correct position, my foscam’s built-in motion sensor takes over. Here’s the code:

/**
 *  Foscam Smart Preset
 *
 *  Copyright 2014 Jake Rorrer
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
definition(
    name: "Foscam Smart Preset",
    namespace: "",
    author: "Jake Rorrer",
    description: "Moves Foscam cameras to a preset based on activity detected by motion or multi-sensors.  That way your Foscam will be properly positioned and ready to snap a photo when a burglar comes into frame.",
    category: "Safety & Security",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")


preferences {
	section("When there's movement or a door opens...") {
        input "motion", "capability.motionSensor", title: "Motion Here", required: false, multiple: true
        input "contact", "capability.contactSensor", title: "Contact Opens", required: false, multiple: true
        input "acceleration", "capability.accelerationSensor", title: "Acceleration Detected", required: false, multiple: true
	}
    
	section("Move to this preset...") {
    	input "newPreset", "enum", metadata:[values:[1, 2, 3]], required: false
  	}

  	section("For these Foscam cameras...") {
    	input "foscams", "capability.imageCapture", multiple: true, required: false
  	}
}

def installed() 
{
	subscribeToEvents()
}

def updated() 
{
	unsubscribe()
    subscribeToEvents()
}

def subscribeToEvents() {
	subscribe(contact, "contact.open", motionActiveHandler)
	subscribe(acceleration, "acceleration.active", motionActiveHandler)
	subscribe(motion, "motion.active", motionActiveHandler)
}

def motionActiveHandler(evt) {
	log.trace "$evt.value: $evt, $settings"

	log.debug "Detected movement or door opening, moving Foscam to preset $newPreset position"
    
    
    if(newPreset) {
    def preset = new Integer(newPreset)

    log.info("Preset: ${preset}")
    foscams?.preset(preset)
  }

}
4 Likes

This is awesome. Shared it with the team!

1 Like

Very cool, thanks @Tyler!