Skip to content

Instantly share code, notes, and snippets.

View jimmyjames's full-sized avatar

Jim Anderson jimmyjames

View GitHub Profile
@jimmyjames
jimmyjames / timeOfDayIsBetween.groovy
Last active August 29, 2015 14:13
SmartApp example of using timeOfDayIsBetween
/**
* timebetween
*
* Copyright 2015 james anderson
*
* 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
*
@jimmyjames
jimmyjames / gist:39fa29e8ae926435bdc7
Created March 31, 2015 21:36
hue-minimote.groovy
/**
* My Living Room Lighting
*
* Copyright 2015 SmartThings
*
* 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
*
@jimmyjames
jimmyjames / gist:f78eb7313bc0dd53e1d3
Last active August 29, 2015 14:21
check if light is on
/**
* Check Lights at Night
*
* Copyright 2015 james anderson
*
* 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
*
@jimmyjames
jimmyjames / subscribe-to-events
Created July 7, 2015 19:04
subscribe to events
def installed() {
subscribe(theDoor, "contact.open", doorOpenHandler)
}
def doorOpenHandler(evt) {
// ...
// send a notification that the door openend, maybe only when everyone is away
sendSms(phoneNumber, "The door is open!")
}
@jimmyjames
jimmyjames / execute-in-time-window.groovy
Created September 22, 2015 14:17
Simple SmartApp showing how to execute within a specified time window
definition(
name: "execute-in-time-window",
namespace: "smartthings",
author: "SmartThings",
description: "Example for executing a SmartApp only within a specified time window",
category: "",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
@jimmyjames
jimmyjames / turn-on-with-motion-off-after-specified-time.groovy
Created September 22, 2015 14:25
Simple SmartApp that turns a light on with motion, and off when no motion has been detected for a certain time period.
/**
* Text Me When There's Motion
*
* Author: SmartThings
*/
definition(
name: "My First SmartApp",
namespace: "mygithubusername",
author: "Peter Gregory",
description: "This is my first SmartApp. Woot!",
@jimmyjames
jimmyjames / Your first SmartApp
Created September 29, 2015 15:34
first-smartapp.groovy
definition(
name: "My First SmartApp",
namespace: "mygithubusername",
author: "Peter Gregory",
description: "This is my first SmartApp. Woot!",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
/**
* runin test
*
* Copyright 2015 james anderson
*
* 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
*
@jimmyjames
jimmyjames / variable-inputs.groovy
Last active December 29, 2015 17:42
testing dynamic inputs
/**
* dynamic pages
*
* Copyright 2015 james anderson
*
* 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
*
/**
* Collections Fun
*
* Copyright 2016 james anderson
*
* 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
*