mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 02:04:22 +01:00
refactor static source
This commit is contained in:
@@ -15,7 +15,9 @@ waste_collection_schedule:
|
||||
interval: INTERVAL
|
||||
start: START
|
||||
until: UNTIL
|
||||
count: COUNT
|
||||
excludes: EXCLUDES
|
||||
weekdays: WEEKDAYS
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
@@ -51,7 +53,11 @@ Required if *FREQUENCY* is set.
|
||||
*(string) (optional)*
|
||||
|
||||
Defines the end of the recurrence in the format "YYYY-MM-DD".
|
||||
Required if *FREQUENCY* is set.
|
||||
|
||||
**COUNT**
|
||||
*(int) (optional)*
|
||||
|
||||
Defines the (maximum) number of returned dates. Only used if `until` is not specified. Defaults to 10.
|
||||
|
||||
**EXCLUDES**
|
||||
*(list) (optional)*
|
||||
@@ -59,11 +65,33 @@ Required if *FREQUENCY* is set.
|
||||
A list of dates in format "YYYY-MM-DD" which should be excluded from the recurrence.
|
||||
|
||||
**WEEKDAYS**
|
||||
*(list | dictionary) (optional)*
|
||||
*(weekday | list of weekdays | dictionary of weekday and occurrence) (optional)*
|
||||
|
||||
Can either be used to define the week day for weekly frequency (can also be done by setting the start date and leaving this field empty). Or to specify weekday events in Monthly frequency. Should be in format MO, TU, WE, TH, FR, SA, SU or numbers 0-6. in Monthly frequency you may want to give additional parameters like 1 for first 2 for second -1 for last -2 for second to last or "every"(or any String) for all
|
||||
Used to define the weekday for weekly or monthly frequencies. A weekday is specified by the following weekday constants: `MO, TU, WE, TH, FR, SA, SU`.
|
||||
|
||||
## Example
|
||||
`WEEKDAYS` can be specified in one of the following 3 formats:
|
||||
|
||||
1. Single Weekday:
|
||||
|
||||
```yaml
|
||||
weekdays: MO
|
||||
```
|
||||
|
||||
2. List of Weekdays:
|
||||
|
||||
```yaml
|
||||
weekdays: [MO, TU, SA]
|
||||
```
|
||||
|
||||
3. Dictionary:
|
||||
|
||||
```yaml
|
||||
weekdays: { MO:1, FR:-2 }
|
||||
```
|
||||
|
||||
The additional numerical argument means the nth occurrence of this weekday in the specified frequency (normally only MONTHLY makes sense here). If frequency is set to `MONTHLY`, `MO:1` represents the first Monday of the month. `FR:-2` represents the 2nd last Friday of the month.
|
||||
|
||||
## Examples
|
||||
|
||||
This example defines a schedule, every 4 weeks starting on Friday, January 14, 2022 until the end of the year.
|
||||
Two days are removed from the schedule and two days are added instead, which are outside of the recurrence.
|
||||
@@ -72,7 +100,6 @@ Two days are removed from the schedule and two days are added instead, which are
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: static
|
||||
calendar_title: Altpapier
|
||||
args:
|
||||
type: Altpapier
|
||||
frequency: WEEKLY
|
||||
@@ -82,32 +109,50 @@ waste_collection_schedule:
|
||||
excludes: # Add exception for the recurrence
|
||||
- '2022-07-29'
|
||||
- '2022-09-23'
|
||||
dates: # Manually define dates that are not part of the recurrence
|
||||
dates: # Manually add dates that are not part of the recurrence
|
||||
- '2022-07-28'
|
||||
- '2022-09-22'
|
||||
```
|
||||
|
||||
This example defines a schedule, last Friday of the month and every second Monday of the month, and every Tuesday of the month. From January 14, 2022 until the end of the year.
|
||||
Two days are removed from the schedule and two days are added instead, which are outside of the recurrence.
|
||||
---
|
||||
|
||||
Defines a weekly schedule on Wednesday.
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: static
|
||||
args:
|
||||
type: Altpapier
|
||||
frequency: WEEKLY
|
||||
weekdays: WE
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Defines a schedule for the 2nd last Thursday of a month.
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: static
|
||||
calendar_title: Altpapier
|
||||
args:
|
||||
type: Altpapier
|
||||
frequency: MONTHLY
|
||||
weekdays: # add the weekdays
|
||||
- FR: -1
|
||||
- MO: 2
|
||||
- TU: Every
|
||||
start: '2022-01-14'
|
||||
until: '2022-12-31'
|
||||
excludes: # Add exception for the recurrence
|
||||
- '2022-07-29'
|
||||
- '2022-09-23'
|
||||
dates: # Manually define dates that are not part of the recurrence
|
||||
- '2022-07-28'
|
||||
- '2022-09-22'
|
||||
weekdays: {TH:-1}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Defines a bi-weekly schedule for starting on the 01-Jan-2023.
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: static
|
||||
args:
|
||||
type: Altpapier
|
||||
frequency: WEEKLY
|
||||
interval: 2
|
||||
start: 2023-01-01
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user