]> git.basschouten.com Git - openhab-addons.git/blob
ad67ec6bac51f89b00b742cac9c6c356a15fcccd
[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.millheat.internal.dto;
14
15 import java.util.ArrayList;
16 import java.util.List;
17
18 import com.google.gson.annotations.SerializedName;
19
20 /**
21  * This DTO class wraps the set holiday parameter request
22  *
23  * @see HomeDTO
24  * @see GetHomesResponse
25  * @author Arne Seime - Initial contribution
26  */
27 public class SetHolidayParameterRequest implements AbstractRequest {
28
29     public static final String PROP_TEMP = "holidayTemp";
30     public static final String PROP_MODE = "isHoliday";
31     public static final String PROP_MODE_ADVANCED = "holidayTempType";
32     public static final String PROP_START = "holidayStartTime";
33     public static final String PROP_END = "holidayEndTime";
34
35     // {"timeZoneNum":"-01:00","value":11,"homeList":[{"homeId":XXXXXXXXXXXX}],"key":"holidayTemp"}
36     public List<HomeID> homeList = new ArrayList<>();
37     @SerializedName("timeZoneNum")
38     public final String timeZone;
39     public final String key;
40     public final Object value;
41
42     /*
43      * Valid parameters: holidayTemp (degrees), holidayStartTime (secs since epoch), holidayEndTime (secs since epoch),
44      * isHoliday (boolean), holidayTempType (0 == advanced vacation mode - room uses it's own away temp, 1 == uses
45      * holidayTemp)
46      */
47     public SetHolidayParameterRequest(Long homeId, String timeZone, String parameter, Object value) {
48         homeList.add(new HomeID(homeId));
49         this.timeZone = timeZone;
50         this.key = parameter;
51         this.value = value;
52     }
53
54     @Override
55     public String getRequestUrl() {
56         return "holidayChooseHome";
57     }
58
59     private class HomeID {
60         @SuppressWarnings("unused")
61         public Long homeId;
62
63         public HomeID(Long homeId) {
64             super();
65             this.homeId = homeId;
66         }
67     }
68 }