]> git.basschouten.com Git - openhab-addons.git/blob
c5ef2d46e8b66d97b9f410ee8314ed3d5b3462d2
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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 deviceType;
37     private String deviceTechnology;
38     private String deviceModel;
39
40     protected NhcThermostat2(String id, String name, String deviceType, String deviceTechnology, String deviceModel,
41             @Nullable String location, NikoHomeControlCommunication nhcComm) {
42         super(id, name, location, nhcComm);
43         this.deviceType = deviceType;
44         this.deviceTechnology = deviceTechnology;
45         this.deviceModel = deviceModel;
46     }
47
48     @Override
49     public void executeMode(int mode) {
50         logger.debug("execute thermostat mode {} for {}", mode, id);
51
52         String program = THERMOSTATMODES[mode];
53         nhcComm.executeThermostat(id, program);
54     }
55
56     @Override
57     public void executeOverrule(int overrule, int overruletime) {
58         logger.debug("execute thermostat overrule {} during {} min for {}", overrule, overruletime, id);
59
60         nhcComm.executeThermostat(id, overrule, overruletime);
61     }
62
63     /**
64      * @return type as returned from Niko Home Control
65      */
66     public String getDeviceType() {
67         return deviceType;
68     }
69
70     /**
71      * @return technology as returned from Niko Home Control
72      */
73     public String getDeviceTechnology() {
74         return deviceTechnology;
75     }
76
77     /**
78      * @return model as returned from Niko Home Control
79      */
80     public String getDeviceModel() {
81         return deviceModel;
82     }
83 }