BigSwitch and Smart Alarm

I have installed BigSwitch and Smart Alarrn and would like to tie the two together so that when I press my BigSwitch my Smart Alarm is set to the ‘Arm Away’ mode

I have created a new SmartThings mode called ‘Armed’ and have set the Smart Alarm to ‘Arm Away’ in that mode.

Currently, the only way I have to set the mode to ‘Armed’ using my Android is to navigate a series of screens, click change mode and more, and then use my Hello Home phrase ‘Arm System’ I created to put the system into the ‘Armed’ mode.

I have installed ‘Big Switch’ and set up a virtual switch that is supposed to run my action ‘Arm System’ that simply locks a door and changes the mode to Armed.

This seems to work fine, ie the door is locked and mode is set to Armed, however, when this sequence of events occurs my Smart Alarm is not set. Does anyone know what I’m missing?

Put simply, I just want one button on my Android that will turn on my Smart Alarm or turn it off, ie set mode to Armed or Home.



Hi Chris,

Can you explain what you would need this for?

I’m wondering if there is an easier way to accomplish what you want to do. If there isn’t then we can work on modifying some code :smile:

Hi Tim, and thanks for writing back. I’m new to ST and appreciate your help.

It’s easy enough for me to plod through a few menus and run an action to change mode from Home to something else (ie, Night, Armed (custom), etc. I do find it a little awkward that I can’t just change the mode, ie I need to run one of the Hello Home commands (I’m using Android).

Anyway, I want to make it very easy for me wife to set the mode to ‘Armed’ and, when she wants, to set it back to ‘Home’. Doing so should also ensure that SmartAlarm recognizes that the mode is no longer in ‘Armed’ and will ignore the house.

Ideally I’d like to have a button that says ‘Arm System’. When On it sets the mode to ‘Armed’ and when off it sets the mode to ‘Home’. I thought I accomplished this using a virtual switch but my SmartAlarm seems to behave differently than if I had run the Hello Home command to set the mode to Armed.

I know this is a long answer. Thanks again for writing back.


This is what you are looking for Change modes via REST API?

You will need to create a virtual switch for each mode that you want to switch to. You can then use tasker to do an http get to send an on/off to the virtual switch and then create a tasker widget on your home screen for this. This gives you a widget on your home screen that allows you to arm and disarm the smart alarm based on the mode that you switch to. I actually have an android tablet mounted inside my garage door that works as my alarm panel. I have the arm and disarm buttons with nice green and red shield .png for the widget icons and then a system lock tasker widget with a lock .png. I also have pushbullet notifications that update a minimal text widget to show the current mode.

This would be much easier if there were native android widgets for this type of behavior though… wouldn’t it @Ben?

This is not right. You have the hello home phrase setup to change the mode? Its an option within the phrase settings.

@jjhtpc, that looks cool and I’d like to check it out.
@tslagle13, thank you. I have done more troubleshooting and I think it’s an issue with SmartAlarm. When I set the system to ‘Armed mode’ via BigSwitch and subsequently open a door I experience the following behavior.

If entrance delay is on the alarm/siren does not go off (I’ve waited for longer than the 45 seconds).
If entrance delay is off the alarm/siren is activated immediately upon opening the door.

So, my challenge for now is to figure out why the entrance delay is not working. Back to my real job…



What version of smart alarm did you pull?

There was a problem with the runin function and @geko created his own time function to handle this.

Make sure you’re running the latest version of SmartAlarm. There’re multiple “clones” shared by some users that are out of date. Current version is 1.2.1. If in doubt, copy it from the Github repository

Was just going to recommend this. If you get the smart alarm working correctly i can share a snippet of code that will allow you to use a VS to change hello home modes. (can’t right now) :smile:

Or you can go to my GitHub and get the code there. The app is called “Big Switch for Hello Home Modes”

@geko, thank you. I was using one of the out of date clones.

I have now installed the latest version. Unfortunately when I click ‘DONE’ after going through the setup screens I get an Unexpected Error.

My log then shows the following (for what it’s worth I’m using Android 4.4)

624de437-8840-4110-91a7-1efeafc45c35 4:33:08 PM: error java.lang.NullPointerException: Cannot get property ‘clientId’ on null object @ line 1002
624de437-8840-4110-91a7-1efeafc45c35 4:33:08 PM: trace Smart Alarm. Version 1.2.1. Copyright © 2014

Thank you Tim. I appreciate all the help. I’ve got the latest version of SmartAlarm installed now and have just one issue with an Unexpected Error at line 1002. I’ve replied to geko’s thread and advised him in case he can help.

Great user group, thanks again.


Make sure to enable Oauth in the app setting.


This did the trick. Thank you Tim.


Awesome. So, question is now, do home phrases work as expected now? Are they triggering smart alarm the right way?

I tested this afternoon and everything is working as expected with the phrases. Thank you again.


Good to hear Chris. If you are android I highly recommend tasker with widgets for the endpoints.

My app will help you change hello home phrases with a virtual switch. Exactly what you want :smile:

 *  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: "tslagle13",
    author: "Tim Slagle",
    description: "Uses a virtual/or physical 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: false, 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") : ""

Thanks Tim. I’m actually using this already to Arm/Disarm the system.

Thanks for the help and for BigSwitch


Awesome! Glad we coud get you working! God Bless!