Triggering an Event at a Specific Time?

I will begin by saying I just got my SmartThings hub a few days ago, and the first thing that I wanted it to do did not have a built in app. I then tried to find one, which I did, but it didn’t work properly. Once I scanned through the code, I slowly realised the follies, and tasked myself to learn syntax to fix the app, and add some functionality. I would also mention that I have some programming knowledge, though limited.

Now, most of that is irrelevant to what I want to know, but may shed light on why I don’t already know how to do this.

My app controls my dehumidifier; turns it on when it goes above xx, turns it off when it goes below xx. As well, it has a timer to ensure it only runs when electricity is cheap. All is fine and dandy, and the app works, however the app only evaluates the criteria when it gets an update from the humidity sensor, and it can take a while for it to report a 1% humidity change.

What I would like for it to do is to trigger at the “end” time (lets say it’s 6:00am, for argument’s sake). If the dehumidifier is already off, then that’s awesome. However, if it’s on, it would then fall outside of the time range, and turn off … instead of waiting for and update, which might happen at 7:15, meaning the dehumidifier was on for 1 hr 15 min during “expensive” time.

The band-aid for this would be to have a trigger always try to force the dehumidifier off at 6:00am, but that seems a bit kludgey.

A simple SmartLighting routine would do that. Set it to only run between A and B times

Welcome! SmartThings is very versatile, but unfortunately, as you’ve discovered, not very intuitive.

Since you have a technical background, you’re going to have the most options with core:

There are other ways to do it as well, and you might want to also take a look at the welcome FAQ:

1 Like

Thanks everyone! However, as per usual, I spend 2 hours searching for something, then I write a forum post, and I find the solution.

The solution seems to be the “schedule” command; I can put in a time, and it will trigger the app to do what I want at that specific time.

@JDRoberts I was looking at CoRE, and just managed to get it “installed”, but realised this simple functionality that I want would be a good learning opportunity to build something and learn. CoRE looks to be awesome, but I’d just prefer this specific task be relegated to something that I’ve programmed myself. As well, I am not sure if CoRE would have the ability to check power usage on the plug while the item is scheduled to operate so I could figure out of the tank is full (without needing a water sensor).

I’m sure Core could do it, but if you want to write your own you can. You’re going to run into some challenges, because much of SmartThings is undocumented. A lot of people look at core as a scripting language in and of itself, and use it to write. But if you prefer to start from scratch, your call.

In the future, then, you might want to post your questions in the developer section of the forum and the experienced coders will be glad to help. :sunglasses:

https://community.smartthings.com/c/developers

1 Like