weekly-timer
Description
The weekly-timer block is used to create a weekly time schedule. It operates according to the device's local time, and its input can enable or disable the schedule.
The block can use from 1 to 10 independent time slots. Each slot defines days, a start time, and an end time. The block is active when the current time matches at least one active slot and the calendar is enabled.
Day conditions inside one slot are combined with logical OR. This means that a slot configured for Monday and a Polish holiday works on Mondays or on supported Polish holidays. All slots are also combined with logical OR, so one matching slot is enough.
A time interval may cross midnight. For example, a slot configured for Monday from 23:30 to 06:15 is active from Monday 23:30:00 until Tuesday 06:15:59. The final minute of the interval is included in the active period, and the state changes after that minute ends.
The block has an associated vlogic device available in the mobile application. The mobile application can enable or disable the calendar, edit time slots, and show the current work status. A change to the enabled state made in the mobile application is not persistent: it remains in effect until the next valid change from the input or the application, or until the project is reloaded. This device is not available from the web application.
Configuration parameters
| Parameter name | Value |
|---|---|
Name (name) |
Optional name visible in the mobile application. |
Settings version (json_settings_version) |
Configuration version number used when synchronizing settings with the mobile application. |
Time slots (active_time_1 ... active_time_10) |
From 1 to 10 independent time intervals. Each used slot contains a day list, a start time, and an end time. |
Each used time slot contains:
| Field name | Value |
|---|---|
Day list (day_mask) |
List of day conditions: 1 Monday, 2 Tuesday, 3 Wednesday, 4 Thursday, 5 Friday, 6 Saturday, 7 Sunday, 8 Polish holiday. |
Start time (startHour) |
Time in the HH:MM format, from 00:00 to 23:59. |
End time (endHour) |
Time in the HH:MM format, from 00:00 to 23:59. |
An empty day list means an unused slot. Slot numbers do not have to be continuous, so active_time_2 may be used without active_time_1.
The start and end times must be different. The block requires at least one active slot with a non-empty day list.
Input handling
The weekly-timer block has one input that controls the schedule's current enabled state.
If the input is not connected, the schedule starts enabled when the project starts. If at least one source is connected to the input, the schedule starts disabled. A valid initial value sent by a source can immediately change this state. If the connected sources do not send any value, the schedule remains disabled.
The input accepts only strict Boolean values: true enables the schedule and false disables it. Numeric values, text, null, and the set and reset commands sent from the command block are ignored. Sending a value equal to the current state again has no effect.
Multiple sources can be connected to the input. The block does not combine their states — the last valid Boolean value received takes effect. A change made in the mobile application follows the same rule, so the last valid change from the input or the application determines the current state. After the project is reloaded, the state is determined again only by whether the input is connected.
Block outputs
| Output number and name | Output description |
|---|---|
1. praca |
Returns true when at least one time slot currently applies and the calendar is enabled. Otherwise it returns false. |
2. przerwa |
Returns the opposite value of output no. 1. |
3. czy kalendarz jest włączony |
Returns the schedule's current effective enabled state. |
4. numer dnia tygodnia |
Returns the current weekday number: 1 Monday, ..., 7 Sunday. |
5. czy dzień roboczy |
Returns true from Monday to Friday. Holidays do not change this value. |
6. czy weekend |
Returns true on Saturday and Sunday. |
7. czy święto polskie |
Returns true when the current local date is one of the supported Polish holidays. |
When the calendar is disabled, the praca output returns false, the przerwa output returns true, and the czy kalendarz jest włączony output returns false. Informational outputs for weekday, workday, weekend, and Polish holiday remain up to date.
The czy dzień roboczy output depends only on the weekday. A Friday that is also a holiday returns both czy dzień roboczy = true and czy święto polskie = true.
Supported Polish holidays
The block recognizes the following holidays:
| Holiday | Date |
|---|---|
| New Year's Day | January 1 |
| Epiphany | January 6 |
| Easter Sunday | Easter date |
| Easter Monday | Easter + 1 day |
| Labour Day / State Holiday | May 1 |
| Constitution Day | May 3 |
| Pentecost | Easter + 49 days |
| Corpus Christi | Easter + 60 days |
| Assumption of the Blessed Virgin Mary | August 15 |
| All Saints' Day | November 1 |
| National Independence Day | November 11 |
| Christmas Eve | December 24 |
| Christmas Day | December 25 |
| Second Day of Christmas | December 26 |
Errors visible to the user
The block can display the following error messages:
| Error code | Error description |
|---|---|
Missing json_settings_version configuration. |
The settings version number is missing. |
Invalid json_settings_version configuration. |
The settings version number has an invalid value. |
Invalid active time configuration. |
A time slot configuration is invalid, for example because a day or time format is incorrect. |
Missing active time configuration. |
No active time slot has been configured. |
Start time equals end time. |
The slot start time and end time are the same. |
Examples
- A slot with day list 1, 2, 3, 4, 5 and interval
08:00-16:00activates thepracaoutput on weekdays from08:00:00to16:00:59. - A slot configured for Monday
23:30-06:15activates thepracaoutput from Monday evening until Tuesday06:15:59. - Two overlapping slots keep
praca = trueas long as at least one of them is active. - A slot with day list 1, 8 works on Mondays and on supported Polish holidays.
- With no input connection, the schedule starts enabled.
- When the input is connected, the schedule starts disabled and remains disabled if the source sends no value.
- The true value enables the schedule, and false disables it.
- A numeric value, text,
null, and thesetandresetcommands do not change the schedule state. - If two sources send true and then false, the last value takes effect, so the schedule remains disabled.
- A change made in the mobile application remains in effect until the next valid change from the input or the application, or until the project is reloaded.
- When the schedule is disabled,
praca = falseandprzerwa = true, but the weekday number and the workday, weekend, and holiday information continue to update.