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.ecobee.internal.dto.thermostat.summary;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * The {@link RevisionDTO} contains information indicating what data
20 * has changed on the thermostat(s).
22 * @author Mark Hilbush - Initial contribution
25 public class RevisionDTO {
28 * The thermostat identifier.
30 public String identifier;
33 * The thermostat name, otherwise an empty field if one is not set.
35 public @Nullable String name;
38 * Whether the thermostat is currently connected to the ecobee servers.
40 public @Nullable Boolean connected;
43 * Current thermostat revision. This revision is incremented whenever
44 * the thermostat program, hvac mode, settings or configuration change.
45 * Changes to the following objects will update the thermostat revision:
46 * Settings, Program, Event, Device.
48 public String thermostatRevision;
51 * Current revision of the thermostat alerts. This revision is incremented
52 * whenever a new Alert is issued or an Alert is modified (acknowledged or deferred).
54 public String alertsRevision;
57 * The current revision of the thermostat runtime settings. This revision is
58 * incremented whenever the thermostat transmits a new status message, or
59 * updates the equipment state or Remote Sensor readings. The shortest interval
60 * this revision may change is 3 minutes.
62 public String runtimeRevision;
65 * The current revision of the thermostat interval runtime settings. This
66 * revision is incremented whenever the thermostat transmits a new status message
67 * in the form of a Runtime object. The thermostat updates this on a 15 minute interval.
69 public String intervalRevision;
71 public RevisionDTO() {
73 thermostatRevision = "";
76 intervalRevision = "";
79 public String getId() {
83 public RevisionDTO getThis() {
87 public boolean hasChanged(@Nullable RevisionDTO previous) {
88 if (previous == null) {
91 return !(thermostatRevision.equals(previous.thermostatRevision)
92 && alertsRevision.equals(previous.alertsRevision) && runtimeRevision.equals(previous.runtimeRevision)
93 && intervalRevision.equals(previous.intervalRevision));
97 public String toString() {
98 StringBuilder sb = new StringBuilder();
99 sb.append("id:").append(identifier);
100 sb.append(" tstat:").append(thermostatRevision);
101 sb.append(" alert:").append(alertsRevision);
102 sb.append(" rntim:").append(runtimeRevision);
103 sb.append(" intrv:").append(intervalRevision);
104 return sb.toString();