2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.mielecloud.internal.webservice.api;
15 import java.util.Optional;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * Provides easy access to temperature values mapped for cooling devices.
22 * @author Björn Lange - Initial contribution
25 public class CoolingDeviceTemperatureState {
26 private final DeviceState deviceState;
28 public CoolingDeviceTemperatureState(DeviceState deviceState) {
29 this.deviceState = deviceState;
33 * Gets the current temperature of the fridge part of the device.
35 * @return The current temperature of the fridge part of the device.
37 public Optional<Integer> getFridgeTemperature() {
38 switch (deviceState.getRawType()) {
40 return deviceState.getTemperature(0);
42 case FRIDGE_FREEZER_COMBINATION:
43 return deviceState.getTemperature(0);
46 return Optional.empty();
51 * Gets the target temperature of the fridge part of the device.
53 * @return The target temperature of the fridge part of the device.
55 public Optional<Integer> getFridgeTargetTemperature() {
56 switch (deviceState.getRawType()) {
58 return deviceState.getTargetTemperature(0);
60 case FRIDGE_FREEZER_COMBINATION:
61 return deviceState.getTargetTemperature(0);
64 return Optional.empty();
69 * Gets the current temperature of the freezer part of the device.
71 * @return The current temperature of the freezer part of the device.
73 public Optional<Integer> getFreezerTemperature() {
74 switch (deviceState.getRawType()) {
76 return deviceState.getTemperature(0);
78 case FRIDGE_FREEZER_COMBINATION:
79 return deviceState.getTemperature(1);
82 return Optional.empty();
87 * Gets the target temperature of the freezer part of the device.
89 * @return The target temperature of the freezer part of the device.
91 public Optional<Integer> getFreezerTargetTemperature() {
92 switch (deviceState.getRawType()) {
94 return deviceState.getTargetTemperature(0);
96 case FRIDGE_FREEZER_COMBINATION:
97 return deviceState.getTargetTemperature(1);
100 return Optional.empty();