Last weekend I deleted the custom SmartApp from SmartThings so that I could clean up the installation, extend the wires on the shield and put the covers back on the appliances. I reinstalled the app, whose sole job is to send a notification whenever the washer or dryer reports that its done. While this worked in the past, it seems that the SmartApp is not receiving events for some reason.
To be clear, the ThingShield is sending events correctly – that is confirmed by watching the activity log. I can also easily force the hardware to send an event by touching two contacts for testing purposes. I see the activity show up as expected, but it’s like the app just isn’t getting the message.
I was going to look at it in the IDE, but for some reason I can’t choose the ThingShield as a physical device from the Home location, but only a virtual device. The physical device is available from the SmartThings app, and was chosen when I reinstalled the app through my phone yesterday (just to be sure it was working).
Everything else appears to be working properly. It’s just this one app. The icons on the Washer/Dryer device are changing as expected, so I know the device is working – it’s just the app. I tried republishing the app, but hat didn’t see to have any effect. The app also has as print statements, but I don’t see anything showing up in the output from them.
Is there a way to debug the SmartApp, monitor its output, etc? Or any way to tell why my app isn’t getting messages from the device all of a sudden?
I tried rebooting the Hub (i.e.: I unplugged it for a moment), but I’m getting the same results. At least I know my shield is working, insomuch as the icons are changing color for the device in the iPhone app, but I have no idea how to diagnose the problem with the SmartApp.
I do have some log.debug() calls to indicate when functions are called, at least. The log (at https://graph.api.smartthings.com/ide/logs ) simply shows “Updated with settings: [wdmon:Washer/Dryer Finished]”, and nothing else, implying that I’m not receiving events from the device. The log for the device does show the state changing, so I know that part is working.
The link above has the code for the app and device type, but it would make more sense if I posted the app code here. It’s awful simple, and did work before:
/**
* Washer/Dryer Finished Alert
*
* Copyright 2015 Joe Angell
*
* 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
*
* 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.
*
*/
definition(
name: "Washer and Dryer Finished Alert",
namespace: "",
author: "Joe Angell",
description: "Sends a notification when the washer or dryer have finished. Linked to my custom ThingShield.",
category: "My Apps",
iconUrl: "http://cdn.device-icons.smartthings.com/Appliances/appliances1-icn.png",
iconX2Url: "http://cdn.device-icons.smartthings.com/Appliances/appliances1-icn@2x.png",
iconX3Url: "http://cdn.device-icons.smartthings.com/Appliances/appliances1-icn@2x.png")
preferences {
section("Title") {
input "wdmon", "device.WasherAndDryerFinishedMonitor"
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe( washerAndDryerFinishedMonitor, "washer", handleWasher )
subscribe( washerAndDryerFinishedMonitor, "dryer", handleDryer )
}
def handleWasher(evt) {
log.debug "washer monitor reports done"
if (wdmon.currentValue("washer") == "done") {
sendPush( "Washer is done!" )
}
}
def handleDryer(evt) {
log.debug "dyer monitor reports done"
if (wdmon.currentValue("dryer") == "done") {
sendPush( "Dryer is done!" )
}
}
I don’t see any mention of wdmon as a command in your Device Type.
I’m not a groovy expert but if I would expect wdmon to be a device attribute which it is not. I think that’s your problem, I don’t know your solution. I personally would just try to forward the washer and the dryer to two virtual switches then you could use standard applications.
ST needs “Location wide variables” that you could just toggle true false or write a number to and every SmartApp in your location could read/write to it if so desired. just wishing.
So, my app takes a device of type “device.WasherAndDryerFinishedMonitor” and stores it in “wdmon”. My calls to things like wdmon.currentValue() is to get the state of the device.WasherAndDryerFinishedMonitor instance stored in wdmon.
Instead of wdmon, it was using washerAndDryerFinishedMonitor, which is an undeclared variable and really should have been giving me an error, IMO. I think I used washerAndDryerFinishedMonitor at one point, got it working, and change dir to the much shorter wdmon so that the code was easier to maintain, but didn’t change it in all places. Since it wasn’t subscribing to device, it wasn’t receiving evens (obviously). I clearly did not realize I had made this change after I’d gotten it working (probably doing too many other things at once and lost track).
I just tested it and everything seems to be working. Thanks for pointing me towards wdmon.