]> git.basschouten.com Git - openhab-addons.git/blob
3b2e0cb49f0ae070f7ae83c73889ab3eb1ded711
[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 org.openhab.binding.millheat.internal.model.Heater;
16
17 /**
18  * This DTO class wraps the set device temp request
19  *
20  * @see SetRoomTempRequest
21  * @author Arne Seime - Initial contribution
22  */
23 public class SetDeviceTempRequest implements AbstractRequest {
24     public final int subDomain;
25     public final long deviceId;
26     public final boolean testStatus = true;
27     public final int operation;
28     public final boolean status;
29     public final boolean windStatus;
30     public final int holdTemp;
31     public final int tempType = 0; // FIXED?
32     public final int powerLevel = 0; // FIXED?
33
34     @Override
35     public String getRequestUrl() {
36         return "deviceControl";
37     }
38
39     public SetDeviceTempRequest(final Heater heater, final int targetTemperature, final boolean masterSwitch,
40             final boolean fanActive) {
41         this.subDomain = heater.getSubDomain();
42         this.deviceId = heater.getId();
43         this.holdTemp = targetTemperature;
44         this.status = masterSwitch;
45         this.windStatus = fanActive;
46         if (fanActive != heater.fanActive()) {
47             // Changed
48             operation = 4;
49         } else if (heater.getTargetTemp() != targetTemperature) {
50             operation = 1;
51         } else {
52             operation = 0;
53         }
54     }
55 }