Send HTTP from hub to LAN

I have some IP security cameras that are aggregated/managed by ispy. Ispy has a remote command syntax that allows me to do things like trigger a camera to take a snapshot. I would like to be able to send the HTTP string from the hub to the PC running ispy. I haven’t found documentation on how to send data on the LAN from the hub. Pointers anyone?

Eric

Reason is - By sending across the LAN I wouldn’t have to worry (as much) about authentication.

This feature has just recently been added, and there is no documentation, yet.

You can either take a look at existing device handlers, in order to figure out how it’s done, or wait for the documentation, which we have been promised will come soon.

You could do it with port forwarding but that is opening up a hole that you probably don’t want to open up.

httpGet(url) { 
        response -> 
        if (response.status != 200 ) {
            log.debug "Webserver failed, status = ${response.status}"
        }
    }

I’m after the same thing I believe as I want smartthings to send a HTTP command to my server once a change in presence is detected.
I found this: http://build.smartthings.com/forums/topic/smartthings-labs-and-lan-devices/

Maybe it helps you to move a bit further and please update here if it does.
I’m tinkering with my presence stuff in the meantime and see if I get anywhere… :wink:

idefix:

I responded to your other thread. Thank you so much for that tip and link - that got me over the top - I have it working. I posted the code on your other thread. Thanks!!

Eric

This link is no longer leading to its intended page and I was so excited that I might finally get to make my ispy work with presence detectors. Can someone help me with this ? I have tried thousands of permutations of httpget and so far nothing but working push messages with no effect on the ispy server. Pleeeeasse ! :slight_smile:

would you share the code that worked for you with me ? :cry:

/**

  • Take a Snapshot When There’s Motion
  • Author: Eric Miller (with much help from many others)
    */

// Automatically generated. Make future change here.
definition(
name: “Motion Triggers ispy to take Snapshot”,
namespace: “”,
author: “my e-mail address”,
description: “Using SmartThings Motion to trigger ip security cameras run by ispyconnect sending http command from local SmartThings hub”,
category: “My Apps”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience%402x.png”)

preferences {
section(“When there’s movement…”){
input “motion1”, “capability.motionSensor”, title: “Where?”
}
section(“Take a snapshot of…”){
input “camera1”, “camera”, title: “Camera number?”
// Camera number must be the ispy camera number shown on the ispy console
}
}

def installed()
{
// log.debug “Installed with settings: ${settings}”

subscribe(motion1, "motion.active", motionActiveHandler)

}

def updated()
{
// log.debug “Updated with settings: ${settings}”

unsubscribe()

subscribe(motion1, "motion.active", motionActiveHandler)

}

def motionActiveHandler(evt) {

// log.trace “$evt.value: $evt, $settings”
// log.debug “$motion1 detected motion, initiating snapshot on $camera1”
// Put this in for debug purposes to make sure it was firing and had the correct parameters

def deviceNetworkId = "C0A80112:1F90"  //  "192.168.1.18:8080"
// The deviceNetworkId is the hex encoded IP and port of the PC running ispy in the home

def ip = "192.168.1.18:8080"
// This is the ip of the PC running the ispy application in the home

sendHubCommand(new physicalgraph.device.HubAction("""GET /snapshot?ot=2&oid=$camera1 HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}"))
// Snapshot is an ispy command so the syntax is driven by ispy

// log.debug location.hubs*.firmwareVersionString.findAll { it }

}

def locationHandler(evt) {
def description = evt.description
def hub = evt?.hubId

// log.debug "cp desc: " + description
//log.debug description
}

I have now transitioned to the new hub and this code (which I believe is entirely cloud-based) is still working.

It does work, indeed ! Thanks a lot!