Created
January 19, 2017 19:52
-
-
Save hdurdle/d11eb215f154fdbd51d8fa17b811a65e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Activate selected Fibaro pattern or preset colour on switch activation | |
* | |
* Author: Howard Durdle | |
* Based on the Pattern Trigger by Michael Hudson | |
* Based on the Turn-on-Police-Light-When-Switch-Is-On.groovy smartapp by twack | |
* https://github.com/twack/smarthings-apps/blob/master/Turn-on-Police-Light-When-Switch-Is-On.groovy | |
* | |
*/ | |
definition( | |
name: "Fibaro pattern and colour trigger", | |
namespace: "hdurdle", | |
author: "Howard Durdle", | |
description: "Trigger Fibaro Controller to activate selected pattern when a switch, real or virtual, is turned on.", | |
category: "My Apps", | |
iconUrl: "http://cdn.device-icons.smartthings.com/Lighting/light11-icn.png", | |
iconX2Url: "http://cdn.device-icons.smartthings.com/Lighting/[email protected]" | |
) | |
preferences { | |
section("When a Switch is turned on...") { | |
input "switch1", "capability.switch", title: "Which switch?" | |
} | |
section("Activate this/these Fibaro Light(s)...") { | |
input "switches", "device.fibaroRGBWController", title: "Which Target(s)?", multiple: true | |
} | |
// note - added warmwhite to the enum - can add any of the other presets from the device handler | |
section("Set pattern to the following...") { | |
input "pattern1", "enum", title: "Which pattern?", description: "Select the pattern to use", options: ["warmwhite", "fireplace", "storm", "deepfade", "litefade", "police"], multiple: false, required: true | |
} | |
} | |
def installed() { | |
subscribe(switch1, "switch.on", switchOnHandler) | |
subscribe(switch1, "switch.off", switchOffHandler) | |
} | |
def updated() { | |
unsubscribe() | |
subscribe(switch1, "switch.on", switchOnHandler) | |
subscribe(switch1, "switch.off", switchOffHandler) | |
} | |
def switchOnHandler(evt) { | |
log.trace "Turning on switches: $switches" | |
switches."$pattern1" () | |
} | |
def switchOffHandler(evt) { | |
log.trace "Turning on switches: $switches" | |
switches.off() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What do I do if there are “no devices of this type” listed under “which targets?” I am using the “Fibaro RGBW 3 beta” device handler by

Twack. Thanks!