I have developed an App that is triggered at a specified time, gets weather information and sends a text message if certain conditions are met. If I understand event logging correctly only “state changes” are logged (i.e. light on, light off) in the IDE. In my app, there are no state changes and nothing appears in the event log even though it has run. Does anyone know if there is a way to have a comment (Smart App has run) added to the event log?
This would be useful because although my app runs every day, text notifications are infrequent. Having a comment added to the log would allow me to see that that the app is running as scheduled.
Thanks
1 Like
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
Try writing an arbitrary Location Event.
You can use any benign event name; it won’t actually trigger anything. But I bet it will be logged in the Location Event Log! sendLocationEvent()
Thanks for the quick response, I set this code up and it worked great!
def logEventToIDE() {
//Log that this App ran into the IDE Event log
sendEvent(name: “App”, value: “Active”)
log.debug “Event has been logged to IDE”
}
I take back my “worked great” comment. The code I used logs my event into the log only in simulation mode. However when I publish the app and run it in the real environment there is no logging. Anybody know why this would be?
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
5
SmartThings works in mysterious ways. The Simulator is a particularly mysterious beast and does not represent the real world.
Hi tired this last night and had the same results. The event should up in the event log when I run the app using the simulator but not when it is run for real. My app checks the weather at 5:25 AM and if the temp is 34 or below and the dew-point is within 2 degs of the temp I send an SMS warning. I know the app is working because I sent my conditions up to 90 degs or below with a 20 deg variance on dew-point and it sent me a notification this morning.
The only reason I’d like to log apps that run were no state change occurs is to verify that they are running as scheduled. If my app produced a tanigable event like a light coming on, I would know it was operating fine. With this one, my conditions will only occur in the winter and not all the time. The app could be buggy, weather data not available, etc and I would never know.
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
7
Posting this in case someone else wants to do this. These few lines of code, when called will log events to the Notification section of the SmartThings App:
def logEventToApp() {
//Log that this App ran into the Notification Section of the SmartThings App
sendNotificationEvent(“Your Text Here”)
log.debug “Log to App has run”
}
Have tried this for several days and it works consistently. It’s also very convenient to use the app to see the notification rather then log into the IDE.