]> git.basschouten.com Git - openhab-addons.git/blob
f4b5344931cf6a79a1b86cfc63f9ec341eddf0c7
[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.boschshc.internal.services.roomclimatecontrol.dto;
14
15 import javax.measure.quantity.Temperature;
16
17 import org.eclipse.jdt.annotation.NonNull;
18 import org.openhab.binding.boschshc.internal.services.dto.BoschSHCServiceState;
19 import org.openhab.binding.boschshc.internal.services.roomclimatecontrol.RoomClimateControlService;
20 import org.openhab.core.library.types.QuantityType;
21 import org.openhab.core.library.unit.SIUnits;
22 import org.openhab.core.types.State;
23
24 /**
25  * State for {@link RoomClimateControlService} to get and set the desired temperature of a room.
26  *
27  * @author Christian Oeing - Initial contribution
28  */
29 public class RoomClimateControlServiceState extends BoschSHCServiceState {
30
31     private static final String CLIMATE_CONTROL_STATE_TYPE = "climateControlState";
32
33     public RoomClimateControlServiceState() {
34         super(CLIMATE_CONTROL_STATE_TYPE);
35     }
36
37     /**
38      * Constructor.
39      *
40      * @param setpointTemperature Desired temperature (in degree celsius).
41      */
42     public RoomClimateControlServiceState(double setpointTemperature) {
43         super(CLIMATE_CONTROL_STATE_TYPE);
44         this.setpointTemperature = setpointTemperature;
45     }
46
47     /**
48      * Desired temperature (in degree celsius).
49      *
50      * @apiNote Min: 5.0, Max: 30.0.
51      * @apiNote Can be set in 0.5 steps.
52      */
53     private double setpointTemperature;
54
55     /**
56      * Desired temperature state to set for a thing.
57      *
58      * @return Desired temperature state to set for a thing.
59      */
60     public State getSetpointTemperatureState() {
61         return new QuantityType<@NonNull Temperature>(this.setpointTemperature, SIUnits.CELSIUS);
62     }
63 }