]> git.basschouten.com Git - openhab-addons.git/blob
9ddcc5a63ef29dd6ea991ea557fa1a86d59e7ecf
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.sensibo.internal.model;
14
15 import java.time.LocalTime;
16 import java.time.ZonedDateTime;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.sensibo.internal.dto.poddetails.ScheduleDTO;
21
22 /**
23  * The {@link SensiboSky} represents a Sensibo Sky schedule
24  *
25  * @author Arne Seime - Initial contribution
26  */
27 @NonNullByDefault
28 public class Schedule {
29     private final LocalTime targetTimeLocal;
30     private final String[] recurringDays;
31     private final AcState acState;
32     private final boolean enabled;
33     private @Nullable ZonedDateTime nextTime;
34
35     public Schedule(ScheduleDTO dto) {
36         this.enabled = dto.enabled;
37         if (enabled) {
38             this.nextTime = ZonedDateTime.parse(nextTime + "Z"); // API field seems to be in Zulu
39         }
40         this.targetTimeLocal = LocalTime.parse(dto.targetTimeLocal);
41         this.recurringDays = dto.recurringDays;
42         this.acState = new AcState(dto.acState);
43     }
44
45     public LocalTime getTargetTimeLocal() {
46         return targetTimeLocal;
47     }
48
49     public @Nullable ZonedDateTime getNextTime() {
50         return nextTime;
51     }
52
53     public String[] getRecurringDays() {
54         return recurringDays;
55     }
56
57     public AcState getAcState() {
58         return acState;
59     }
60
61     public boolean isEnabled() {
62         return enabled;
63     }
64 }