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.netatmo.internal.api.dto;
15 import java.time.ZonedDateTime;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.netatmo.internal.api.data.ModuleType;
20 import org.openhab.binding.netatmo.internal.api.data.NetatmoConstants.SetpointMode;
21 import org.openhab.core.library.types.OnOffType;
22 import org.openhab.core.library.types.OpenClosedType;
23 import org.openhab.core.types.State;
24 import org.openhab.core.types.UnDefType;
27 * The {@link Room} holds temperature data for a given room.
29 * @author Bernhard Kreuz - Initial contribution
33 public class Room extends NAObject implements NAModule {
34 private @Nullable String type;
35 private @Nullable OnOffType anticipating;
36 private boolean openWindow;
37 private @Nullable ZonedDateTime thermSetpointStartTime;
38 private @Nullable ZonedDateTime thermSetpointEndTime;
39 private SetpointMode thermSetpointMode = SetpointMode.UNKNOWN;
40 private int heatingPowerRequest;
41 private double thermMeasuredTemperature;
42 private double thermSetpointTemperature;
44 public State isAnticipating() {
45 OnOffType status = anticipating;
46 return status != null ? status : UnDefType.NULL;
49 public State hasOpenedWindows() {
50 return openWindow ? OpenClosedType.OPEN : OpenClosedType.CLOSED;
53 public int getHeatingPowerRequest() {
54 return heatingPowerRequest;
57 public double getMeasuredTemp() {
58 return thermMeasuredTemperature;
61 public SetpointMode getSetpointMode() {
62 return thermSetpointMode;
65 public double getSetpointTemp() {
66 return thermSetpointTemperature;
69 public @Nullable ZonedDateTime getSetpointBegin() {
70 return thermSetpointStartTime;
73 public @Nullable ZonedDateTime getSetpointEnd() {
74 return thermSetpointEndTime;
78 public ModuleType getType() {
79 // Note: In json api answer type for NARoom is used with words like kitchen, living...
80 return ModuleType.ROOM;
83 public @Nullable String getLocation() {