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 contains the “Days”, “Start hour”, and “End hour” settings. The block is active when the current time matches at least one active slot and the calendar is enabled.
Conditions selected in “Days” inside one slot are combined with logical OR. This means that selecting 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 with “Days” set to Monday, “Start hour” to 23:30, and “End hour” 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 displayed on the block in the editor and in the mobile application. |
Time slots (active_time_1 ... active_time_10) |
From 1 to 10 independent time intervals. Set “Days”, “Start hour”, and “End hour” in each used slot. The “Add slot” button adds another slot, and “Remove slot” removes the selected slot. |
Synchronization of schedule settings with the mobile application is managed automatically.
Each used time slot contains:
| Field name | Value |
|---|---|
Days (day_mask) |
Select the days on which the slot should operate. Multiple day conditions can be selected: 1 Monday, 2 Tuesday, 3 Wednesday, 4 Thursday, 5 Friday, 6 Saturday, 7 Sunday, 8 Polish holiday. |
Start hour (startHour) |
Time in the HH:MM format, from 00:00 to 23:59. |
End hour (endHour) |
Time in the HH:MM format, from 00:00 to 23:59. |
No selections in “Days” means an unused slot. Slot numbers do not have to be continuous, so “Time slot 2” may be used without “Time slot 1”.
“Start hour” and “End hour” must be different. The block requires at least one active slot with a selection in “Days”.
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 automatically managed configuration is incomplete. |
Invalid json_settings_version configuration. |
The automatically managed configuration contains invalid synchronization data. |
Invalid active time configuration. |
A time slot configuration is invalid, for example because “Days”, “Start hour”, or “End hour” contains an invalid value. |
Missing active time configuration. |
No active time slot has been configured. |
Start time equals end time. |
The slot's “Start hour” and “End hour” are the same. |
Examples
- A slot with “Days” set to 1, 2, 3, 4, 5, “Start hour” to
08:00, and “End hour” to16:00activates thepracaoutput on weekdays from08:00:00to16:00:59. - A slot with “Days” set to Monday, “Start hour” to
23:30, and “End hour” to06: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 “Days” set to 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.