# Timer event (Event)

### Structure of an individual event (of one event)

     {
         "event_id":  Number,
         "date_type": Number,
         "weekdays":  Array of Number,
         "date1":     String,
         "date2":     String,
         "day":       Number,
         "month":     Number,
         "year":      Number,
         "time_type": Number,
         "time":      String,
         "offset":    Number,
         "random":    Number,
         "filter":    Number,
         "action":    Number
     }

### Explanation

- event_id - ID of the event.
- date_type - Indicates the type of date

                  1 => Wochentage
                  2 => Zeitraum
                  3 => Einzeldatum

- Only if date_type = 1:
  - weekdays - List of activated weekdays (0=Monday, 6=Sunday).
- Only if date_type = 2:
  - date1 - First day on which the event is to be triggered (date to be specified in the format "yymmdd").
  - date2 - Last day on which the event is to be triggered (date to be specified in the format "yymmdd").
- Only if date_type = 3:
  - day - Day (1-31) on which the event is to be triggered. If the field is not set, the event is triggered on every day on which the month and year match.
  - month - Month (1-12) on which the event is to be triggered. If the field is not set, the event is triggered in every month in which the day and year match.
  - year - Year (0-99 for 2000 to 2099) in which the event is to be triggered. If the field is not set, the event is triggered in every year in which the day and month match.
- time_type - Indicates the type of time specification

                  1 => Uhrzeit
                  2 => Sonnenaufgang
                  3 => Sonnenuntergang

- Only if time_type = 1:
  - time - Time in the format "hhmm".
- Only if time_type = 2 or 3:
  - offset - Number in minutes in which the event is to be triggered before (negative value) or after sunrise/sunset.
- random - Max. number in minutes which are to be added to or subtracted from the trigger time.
- filter - Defines whether an action is carried out

                  0 => Immer
                  1 => Normale Tage (kein Feiertag, kein Urlaubstag)
                  2 => Feiertag
                  3 => Urlaubstag
                  4 => Nie

- action - ID of the action to be triggered. All the actions defined in the timer are transferred when the metadata is retrieved.

### Examples of different structure variants of an event

#### On workdays (Monday-Friday if not a public holiday or holiday) at 12:00

    'date_type': 1
    'weekdays': [0, 1, 2, 3, 4],
    'time_type': 1,
    'time': '1200',
    'filter': 1,
    'action': 1

#### At the weekend (Saturday-Sunday) at 10:00 plus/minus random 30 minutes. The following example triggers every Saturday and Sunday between 9:30 and 10:30

    'date_type': 1,
    'weekdays': [5, 6],
    'time_type': 1,
    'time': '1000',
    'random': 30,
    'filter': 0,
    'action': 1

#### Only in April 2016 one day after sunrise in each case

    'date_type': 2,
    'date1': '160401',
    'date2': '160430',
    'time_type': 2,
    'offset': 60,
    'filter': 0,
    'action': 1

#### On the first day of each month 30 minutes after sunset plus/minus random 15 minutes

    'date_type': 3,
    'day': 1,
    'time_type': 3,
    'offset': 30,
    'random': 15,
    'filter': 0,
    'action': 1