I just wanted to check I’m not missing something. I want to do different automation at weekends. There’s no way for RulesAPI to know either weekday or day of week, is there?
I can make a virtual switch or change the location mode in the app, but I just wanted to check there’s no way to run an action only on a Sunday, say?
You can use routines with the previous condition of time, at any time and choosing the days of the week that you need.
If you want to use the rules API, I don’t know, but you could make a routine to activate a virtual device on weekends and use the API rules with this device
Are you writing JSON directly and publishing via Rules API or are you creating routines in the mobile app? As Marianom mentioned, you can add days under the Time option on the IF side of Routines. And Routines calls the Rules API in the background, so I assume you can do it via raw JSON too.
There should be, as Routines can do it and they use the Rules API. However they have access to some bits and bobs that aren’t available to the public. Let’s see …
Yes, it looks like you use something like:
"daysOfWeek": [ "Sun" ]
So three letter abbreviations for the days of the week in an array.
Hi, thanks everyone. Yes, I’m just getting started writing JSON in the Rules API.
I’ve made a virtual switch that activates at weekends and gone from there. It’s not difficult, but I had that feeling I was doing everything the wrong way.
Ah, that looks the sort of thing I was expecting, yes, thanks.
Was there any way I should have been able to find that out?
Well it is in the API reference, though that can be as clear as mud.
API | SmartThings Developers
Oh I see. I hadn’t understood how to click around in that document, or that the search doesn’t work until you do.
So now I’ve learned something.
Could you let me know how you managed that? I am trying to write a rule to manage daylight time and “daysOfweek” is tripping me up.
And the answer is…
Hi, you were ahead of me. Here’s mine that’s working now (as YAML)