]> git.basschouten.com Git - openhab-addons.git/blob
06b0936727759431d3d8acd06812e275efdd3794
[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("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("execute thermostat overrule {} during {} min for {}", overrule, overruletime, id);
57
58         nhcComm.executeThermostat(id, overrule, overruletime);
59     }
60
61     /**
62      * @return model as returned from Niko Home Control
63      */
64     public String getModel() {
65         return model;
66     }
67
68     /**
69      * @return technology as returned from Niko Home Control
70      */
71     public String getTechnology() {
72         return technology;
73     }
74 }