Help with Tslagles Big Switch for Hello Home Phrases

Hi all,

I’m trying to use this app to facilitate a virtual switch to change mode, and it works great, with the exception of when I try to set a time block for it (IE only works between 3 pm and 6 pm). For some reason when I select that option nothing comes up to select a time block. It just swirlies and nothing happens. The other options work fine. Below is the code I pulled, is there an error in it?


  • Big Switch for Hello Home Phrases
  • Copyright 2014 Tim Slagle
  • 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:
  • 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.

name: “Big Switch for Hello Home Phrases”,
namespace: “”,
author: “Tim Slagle”,
description: “Uses a virtual switch to run hello home phrases.”,
category: “Convenience”,
iconUrl: “”,
iconX2Url: “

preferences {
page(name: “selectPhrases”)

page( name:"Settings", title:"Settings", uninstall:true, install:true ) {
section(title: "More options", hidden: hideOptionsSection(), hideable: true) {

		def timeLabel = timeIntervalLabel()

		href "timeIntervalInput", title: "Only during a certain time", description: timeLabel ?: "Tap to set", state: timeLabel ? "complete" : null

		input "days", "enum", title: "Only on certain days of the week", multiple: true, required: false,
			options: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]

		input "modes", "mode", title: "Only when mode is", multiple: true, required: false


def selectPhrases() {
def configured = (settings.HHPhraseOff && settings.HHPhraseOn)
dynamicPage(name: “selectPhrases”, title: “Configure”, nextPage:“Settings”, uninstall: true) {
section(“When this switch is turned on or off”) {
input “master”, “capability.switch”, title: “Where?”
def phrases = location.helloHome?.getPhrases()*.label
if (phrases) {
section(“Run These Hello Home Phrases When…”) {
log.trace phrases
input “HHPhraseOn”, “enum”, title: “The Switch Turns On”, required: true, options: phrases, refreshAfterSelection:true
input “HHPhraseOff”, “enum”, title: “The Switch Turns Off”, required: true, options: phrases, refreshAfterSelection:true



def installed(){
subscribe(master, “switch.on”, onHandler)
subscribe(master, “”, offHandler)

def updated(){
subscribe(master, “switch.on”, onHandler)
subscribe(master, “”, offHandler)

def onHandler(evt) {
log.debug evt.value“Running Light On Event”)
sendNotificationEvent(“Performing “${HHPhraseOn}” because ${master} turned on.”)

def offHandler(evt) {
log.debug evt.value“Running Light Off Event”)
sendNotificationEvent(“Performing “${HHPhraseOff}” because ${master} turned off.”)

private getAllOk() {
modeOk && daysOk && timeOk

private getModeOk() {
def result = !modes || modes.contains(location.mode)
log.trace "modeOk = $result"

private getDaysOk() {
def result = true
if (days) {
def df = new java.text.SimpleDateFormat(“EEEE”)
if (location.timeZone) {
else {
def day = df.format(new Date())
result = days.contains(day)
log.trace "daysOk = $result"

private getTimeOk() {
def result = true
if (starting && ending) {
def currTime = now()
def start = timeToday(starting).time
def stop = timeToday(ending).time
result = start < stop ? currTime >= start && currTime <= stop : currTime <= stop || currTime >= start
log.trace "timeOk = $result"

private hhmm(time, fmt = “h:mm a”)
def t = timeToday(time, location.timeZone)
def f = new java.text.SimpleDateFormat(fmt)
f.setTimeZone(location.timeZone ?: timeZone(time))

private hideOptionsSection() {
(starting || ending || days || modes) ? false : true

private timeIntervalLabel() {
(starting && ending) ? hhmm(starting) + “-” + hhmm(ending, “h:mm a z”) : “”