From 6584f70aae7389fe99af702f720c0f2d526fc04f Mon Sep 17 00:00:00 2001 From: timberjoegithub Date: Sun, 12 Feb 2017 13:05:09 -0500 Subject: [PATCH] Update PhotonDS18B20.groovy --- PhotonDS18B20.groovy | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/PhotonDS18B20.groovy b/PhotonDS18B20.groovy index 24456a9..fc060b6 100644 --- a/PhotonDS18B20.groovy +++ b/PhotonDS18B20.groovy @@ -11,6 +11,13 @@ * for the specific language governing permissions and limitations under the License. * */ +preferences { + input("token", "text", title: "Access Token") + input("deviceId", "text", title: "Device ID") +// input("relaynum", "text", title: "Relay Number 1-6") + input("deviceName", "text", title: "Name of device in the Photon cloud") + // device name in api like: https://api.spark.io/v1/devices/${deviceId}/${deviceName} +} metadata { definition (name: "DS18B20 Temperature Sensor", namespace: "smartthings", author: "github@josephsteele.com") { capability "Temperature Measurement" @@ -76,3 +83,10 @@ private String parseValue(String description) { } null } +private put(relaystate) { + //Spark Core API Call + httpPost( + uri: "https://api.spark.io/v1/devices/${deviceId}/strelay${relaynum}", + body: [access_token: token, command: relaystate], + ) {response -> log.debug (response.data)} +}