#VSCP Howto: Do something every five minutes

The when selection block of the decision matrix of the VSCP server looks like this

<allowed_from>0000-01-01 00:00:00</allowed_from>
<allowed_to>9999-12-31 23:59:59</allowed_to>
<allowed_weekdays>mtwtfss</allowed_weekdays>
<allowed_time>*-*-* *:*:*</allowed_time>
allowed_from – allowed_to

Here the action is allowed to is allowed from prehistoric times and way into the future. We can say it is allowed to occur forever/always. This is always specified in a time range pair <allowed_from> and <allowed_to>. To say forever/always you can also use a ‘*’ like in

<allowed_from>*</allowed_from>
<allowed_to>*</allowed_to>

which also means forever. Leaving them out and not specifying an allowed time range at all also will be interpreted as forever/always.

allowed_weekdays

The next thing you can do is to select which weekdays the action can occur at. This is always seven characters or a ‘*’ meaning every weekday.  Again leaving it out also means all days.

Some samples

Every day of the week <allowed_weekdays>mtwtfss</allowed_weekdays>

Every day of the week <allowed_weekdays>*</allowed_weekdays>

Only on mondays <allowed_weekdays>m------</allowed_weekdays>

Mondays and Fridays  <allowed_weekdays>m---f--</allowed_weekdays>
allowed_time

The last tag the <allowed_time> gives most control of when the action should occur. You can be VERY specific as in

<allowed_time>2028-12-02 14:32:30</allowed_time>

and the action can only happen this specific year, date and time down to the second. The allowed date range must always be valid and also the weekday must be set to allowed on this day.

You can also be looser and specify

<allowed_time>2028-*-* *:*:*</allowed_time>

which is anytime in year 2028.

But you can also specify

<allowed_time>*-*-* *:30:*</allowed_time>

which means that things can occur every half hour.

For anytime you can specify

<allowed_time>*</allowed_time>

or

<allowed_time>*-*-* *:*:*</allowed_time>

oer leave the tag out all together.

So how do one specify that something should happen every five minutes?

Just specify

<allowed_time>
*-*-* *:0/5/10/15/20/25/30/35/40/45/50/55:*
</allowed_time>

and trigger on the internal minute event with.

<mask priority="0" 
 class="0xFFFF" 
 type="0xFFFF" 
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

<filter priority="0" 
 class="0xffff" 
 type="6" 
 GUID=" 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00" />

It’s as easy as that and you can of course use this technique for the other parts of the allowed_time tag as well.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *