Schedule Lights on and off


I am new to Losant, but managed to get pretty far with my experiment, right now I am trying to figure out how to add a scheduler to the dashboard. The use case is I want users to be able to schedule lights to come on and off at their user defined times (lights would be triggered via RPC in the workflow) .

I cannot see anything out of the box or obvious that allows this bar the basic input fields with out validation.

Any pointers?

Hi @Jamie_Hook,

There are a couple of ways you can accomplish this, but keep in mind the appropriate approach will depend on your use case! :smile:

I’ll follow up shortly with some screenshots of an example, but I wanted to explain how both options would work.

Data Table

In order to compare the time now to the schedule, you will need somewhere to store the user-defined schedule times. You could store these scheduled times in a Data Table, allowing for easy additions and updates (using the Table: Update Row and Table: Insert Row Nodes). You would then build your workflow with a Timer Node, and query the data table for that time using the Table: Get Rows Node. Using some conditionals, you could then turn on and off the lights depending on the time.

This approach is ideal for a more custom and scalable scheduler.

Cron String

The Timer Node also supports advance scheduling with a Cron string. This approach is ideal for a simple custom schedule, but keep in mind the value is not temptable, and would need to be configured before the workflow is triggered. I use this approach in my own personal reminder workflow to water my plants! Every three days, I send myself a text at 10:30am, triggered by a Timer Node. The Cron string was ideal for my use case here, but I would have moved to the Data Table approach if my schedule needed more customization.

Again, I’ll follow up with an example of this shortly.

Thanks so much!

Perfect thanks, I did start playing with the data table to achieve that so some screenshots would be perfect.

Hi @Jamie_Hook,

Here is an example of how this workflow might be configured at its most basic:

From this workflow, you will notice I have a Data Table that contains two important columns: userId and time. The userId value would correlate to the user that has set this time value as a schedule. I use the Table: Get Rows Node to query the table for any rows that may match.

I currently have this workflow configured with a Virtual Button Trigger to manually trigger this action flow. If you would like to automate this workflow further, you could utilize the Timer Trigger. This will allow you to fire the workflow (and thus query the Data Table) at your own configured intervals. However, keep in mind that each trigger of this node, as well as the Virtual Button, does count toward your payload limit.

Please let me know if you have any additional questions on this!

Thanks so much,