]> git.basschouten.com Git - openhab-addons.git/blob
4f05e4421359dc9df1c6c12158a928fad4902bf2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.nikohomecontrol.internal.protocol.nhc2;
14
15 import static org.openhab.binding.nikohomecontrol.internal.protocol.NikoHomeControlConstants.THERMOSTATMODES;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.nikohomecontrol.internal.protocol.NhcThermostat;
20 import org.openhab.binding.nikohomecontrol.internal.protocol.NikoHomeControlCommunication;
21 import org.slf4j.Logger;
22 import org.slf4j.LoggerFactory;
23
24 /**
25  * The {@link NhcThermostat2} class represents the thermostat Niko Home Control II communication object. It contains all
26  * fields representing a Niko Home Control thermostat and has methods to set the thermostat in Niko Home Control and
27  * receive thermostat updates.
28  *
29  * @author Mark Herwege - Initial Contribution
30  */
31 @NonNullByDefault
32 public class NhcThermostat2 extends NhcThermostat {
33
34     private final Logger logger = LoggerFactory.getLogger(NhcThermostat2.class);
35
36     private String model;
37     private String technology;
38
39     protected NhcThermostat2(String id, String name, String model, String technology, @Nullable String location,
40             NikoHomeControlCommunication nhcComm) {
41         super(id, name, location, nhcComm);
42         this.model = model;
43         this.technology = technology;
44     }
45
46     @Override
47     public void executeMode(int mode) {
48         logger.debug("Niko Home Control: execute thermostat mode {} for {}", mode, id);
49
50         String program = THERMOSTATMODES[mode];
51         nhcComm.executeThermostat(id, program);
52     }
53
54     @Override
55     public void executeOverrule(int overrule, int overruletime) {
56         logger.debug("Niko Home Control: execute thermostat overrule {} during {} min for {}", overrule, overruletime,
57                 id);
58
59         nhcComm.executeThermostat(id, overrule, overruletime);
60     }
61
62     /**
63      * @return model as returned from Niko Home Control
64      */
65     public String getModel() {
66         return model;
67     }
68
69     /**
70      * @return technology as returned from Niko Home Control
71      */
72     public String getTechnology() {
73         return technology;
74     }
75 }