### Zone
-| Channel Type ID | Item Type | Description |
-|-------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Temperature | Number | Allows for viewing the current actual temperature of the zone. |
-| SetPointStatus | String | Allows for viewing the current set point mode of the zone. |
-| SetPoint | Number | Allows for viewing and permanently overriding the temperature set point of the zone. Sending 0 cancels any active set point overrides. |
+| Channel Type ID | Item Type | Description |
+|-----------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------|
+| Temperature | Number:Temperature | Allows for viewing the current actual temperature of the zone. |
+| SetPointStatus | String | Allows for viewing the current set point mode of the zone. |
+| SetPoint | Number:Temperature | Allows for viewing and permanently overriding the temperature set point of the zone. Sending 0 cancels any active set point overrides. |
+ |
## Full Example
String DemoMode { channel="evohome:display:your_account_alias:your_display_alias:SystemMode" }
// evohome Heatingzone
-Number DemoZoneTemperature { channel="evohome:heatingzone:your_account_alias:your_zone_alias:Temperature" }
-String DemoZoneSetPointStatus { channel="evohome:heatingzone:your_account_alias:your_zone_alias:SetPointStatus" }
-Number DemoZoneSetPoint { channel="evohome:heatingzone:your_account_alias:your_zone_alias:SetPoint" }
+Number:Temperature DemoZoneTemperature { channel="evohome:heatingzone:your_account_alias:your_zone_alias:Temperature" }
+String DemoZoneSetPointStatus { channel="evohome:heatingzone:your_account_alias:your_zone_alias:SetPointStatus" }
+Number:Temperature DemoZoneSetPoint { channel="evohome:heatingzone:your_account_alias:your_zone_alias:SetPoint" }
```
### demo.sitemap
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;
/**
* @author Jasper van Zuijlen - Initial contribution
* @author Neil Renaud - Heating Zones
*/
+@NonNullByDefault
public class EvohomeBindingConstants {
private static final String BINDING_ID = "evohome";
import java.util.concurrent.TimeoutException;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Provides an interface for a delegate that can throw a timeout
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public interface RunnableWithTimeout {
public abstract void run() throws TimeoutException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.StringContentProvider;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Authentication;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Authentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class ApiAccess {
private static final int REQUEST_TIMEOUT_SECONDS = 5;
private final Logger logger = LoggerFactory.getLogger(ApiAccess.class);
private final HttpClient httpClient;
- private final Gson gson;
+ private final Gson gson = new GsonBuilder().create();
- private Authentication authenticationData;
- private String applicationId;
+ private @Nullable Authentication authenticationData;
+ private @Nullable String applicationId;
public ApiAccess(HttpClient httpClient) {
- this.gson = new GsonBuilder().create();
this.httpClient = httpClient;
}
*
* @param authentication The authentication details to apply
*/
- public void setAuthentication(Authentication authentication) {
+ public void setAuthentication(@Nullable Authentication authentication) {
authenticationData = authentication;
}
*
* @return The current authentication details
*/
- public Authentication getAuthentication() {
+ public @Nullable Authentication getAuthentication() {
return authenticationData;
}
*
* @param applicationId The application id to apply
*/
- public void setApplicationId(String applicationId) {
+ public void setApplicationId(@Nullable String applicationId) {
this.applicationId = applicationId;
}
* @return The result of the request or null
* @throws TimeoutException Thrown when a request times out
*/
- public <TOut> TOut doRequest(HttpMethod method, String url, Map<String, String> headers, String requestData,
- String contentType, Class<TOut> outClass) throws TimeoutException {
- TOut retVal = null;
+ public @Nullable <TOut> TOut doRequest(HttpMethod method, String url, Map<String, String> headers,
+ @Nullable String requestData, String contentType, @Nullable Class<TOut> outClass) throws TimeoutException {
logger.debug("Requesting: [{}]", url);
-
+ @Nullable
+ TOut retVal = null;
try {
Request request = httpClient.newRequest(url).method(method);
- if (headers != null) {
- for (Map.Entry<String, String> header : headers.entrySet()) {
- request.header(header.getKey(), header.getValue());
- }
+ for (Map.Entry<String, String> header : headers.entrySet()) {
+ request.header(header.getKey(), header.getValue());
}
if (requestData != null) {
ContentResponse response = request.timeout(REQUEST_TIMEOUT_SECONDS, TimeUnit.SECONDS).send();
- logger.debug("Response: {}", response);
- logger.debug("\n{}\n{}", response.getHeaders(), response.getContentAsString());
+ logger.trace("Response: {}", response);
+ logger.trace("\n{}\n{}", response.getHeaders(), response.getContentAsString());
if ((response.getStatus() == HttpStatus.OK_200) || (response.getStatus() == HttpStatus.ACCEPTED_202)) {
String reply = response.getContentAsString();
if (outClass != null) {
retVal = new Gson().fromJson(reply, outClass);
}
+ } else if ((response.getStatus() == HttpStatus.CREATED_201)) {
+ // success nothing to return ignore
+ } else {
+ logger.debug("Request failed with unexpected response code {}", response.getStatus());
}
} catch (ExecutionException e) {
logger.debug("Error in handling request: ", e);
logger.debug("Handling request interrupted: ", e);
Thread.currentThread().interrupt();
}
-
return retVal;
}
* @return The result of the request or null
* @throws TimeoutException Thrown when a request times out
*/
- public <TOut> TOut doAuthenticatedGet(String url, Class<TOut> outClass) throws TimeoutException {
+ public @Nullable <TOut> TOut doAuthenticatedGet(String url, Class<TOut> outClass) throws TimeoutException {
return doAuthenticatedRequest(HttpMethod.GET, url, null, outClass);
}
* @param method The HTTP method to use (POST, GET, ...)
* @param url The URL to query
* @param headers The optional additional headers to apply, can be null
- * @param requestContainer The object to use as JSON data for the request
- * @param outClass The type of the requested result
+ * @param requestContainer The object to use as JSON data for the request, can be null
+ * @param outClass The type of the requested result, can be null
* @return The result of the request or null
* @throws TimeoutException Thrown when a request times out
*/
- private <TOut> TOut doRequest(HttpMethod method, String url, Map<String, String> headers, Object requestContainer,
- Class<TOut> outClass) throws TimeoutException {
+ private @Nullable <TOut> TOut doRequest(HttpMethod method, String url, Map<String, String> headers,
+ @Nullable Object requestContainer, @Nullable Class<TOut> outClass) throws TimeoutException {
String json = null;
if (requestContainer != null) {
- json = this.gson.toJson(requestContainer);
+ json = gson.toJson(requestContainer);
}
return doRequest(method, url, headers, json, "application/json", outClass);
* @return The result of the request or null
* @throws TimeoutException Thrown when a request times out
*/
- private <TOut> TOut doAuthenticatedRequest(HttpMethod method, String url, Object requestContainer,
- Class<TOut> outClass) throws TimeoutException {
- Map<String, String> headers = null;
- if (authenticationData != null) {
- headers = new HashMap<>();
-
- headers.put("Authorization", "Bearer " + authenticationData.getAccessToken());
- headers.put("applicationId", applicationId);
- headers.put("Accept",
- "application/json, application/xml, text/json, text/x-json, text/javascript, text/xml");
+ private @Nullable <TOut> TOut doAuthenticatedRequest(HttpMethod method, String url,
+ @Nullable Object requestContainer, @Nullable Class<TOut> outClass) throws TimeoutException {
+ Map<String, String> headers = new HashMap<>();
+ Authentication localAuthenticationData = authenticationData;
+ String localApplicationId = applicationId;
+
+ if (localAuthenticationData != null) {
+ headers.put("Authorization", "Bearer " + localAuthenticationData.getAccessToken());
+ }
+ if (localApplicationId != null) {
+ headers.put("applicationId", localApplicationId);
}
+ headers.put("Accept", "application/json, application/xml, text/json, text/x-json, text/javascript, text/xml");
return doRequest(method, url, headers, requestContainer, outClass);
}
import java.util.Map;
import java.util.concurrent.TimeoutException;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.http.HttpMethod;
-import org.openhab.binding.evohome.internal.api.models.v2.request.HeatSetPoint;
-import org.openhab.binding.evohome.internal.api.models.v2.request.HeatSetPointBuilder;
-import org.openhab.binding.evohome.internal.api.models.v2.request.Mode;
-import org.openhab.binding.evohome.internal.api.models.v2.request.ModeBuilder;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Authentication;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Location;
-import org.openhab.binding.evohome.internal.api.models.v2.response.LocationStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Locations;
-import org.openhab.binding.evohome.internal.api.models.v2.response.LocationsStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.UserAccount;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.request.HeatSetPoint;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.request.HeatSetPointBuilder;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.request.Mode;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.request.ModeBuilder;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Authentication;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Location;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.LocationStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Locations;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.LocationsStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.UserAccount;
import org.openhab.binding.evohome.internal.configuration.EvohomeAccountConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeApiClient {
private static final String APPLICATION_ID = "b013aa26-9724-4dbd-8897-048b9aada249";
private final ApiAccess apiAccess;
private Locations locations = new Locations();
- private UserAccount useraccount;
- private LocationsStatus locationsStatus;
+ private @Nullable UserAccount useraccount;
+ private @Nullable LocationsStatus locationsStatus;
/**
* Creates a new API client based on the V2 API interface
public void close() {
apiAccess.setAuthentication(null);
useraccount = null;
- locations = null;
+ locations = new Locations();
locationsStatus = null;
}
return locations;
}
- public LocationsStatus getInstallationStatus() {
+ public @Nullable LocationsStatus getInstallationStatus() {
return locationsStatus;
}
apiAccess.doAuthenticatedPut(url, heatSetPoint);
}
- private UserAccount requestUserAccount() throws TimeoutException {
+ private @Nullable UserAccount requestUserAccount() throws TimeoutException {
String url = EvohomeApiConstants.URL_V2_BASE + EvohomeApiConstants.URL_V2_ACCOUNT;
return apiAccess.doAuthenticatedGet(url, UserAccount.class);
}
private Locations requestLocations() throws TimeoutException {
- Locations locations = new Locations();
- if (useraccount != null) {
+ Locations locations = null;
+ UserAccount localAccount = useraccount;
+ if (localAccount != null) {
String url = EvohomeApiConstants.URL_V2_BASE + EvohomeApiConstants.URL_V2_INSTALLATION_INFO;
- url = String.format(url, useraccount.getUserId());
+ url = String.format(url, localAccount.getUserId());
locations = apiAccess.doAuthenticatedGet(url, Locations.class);
}
- return locations;
+ return locations != null ? locations : new Locations();
}
private LocationsStatus requestLocationsStatus() throws TimeoutException {
LocationsStatus locationsStatus = new LocationsStatus();
- if (locations != null) {
- for (Location location : locations) {
- String url = EvohomeApiConstants.URL_V2_BASE + EvohomeApiConstants.URL_V2_LOCATION_STATUS;
- url = String.format(url, location.getLocationInfo().getLocationId());
- LocationStatus status = apiAccess.doAuthenticatedGet(url, LocationStatus.class);
- locationsStatus.add(status);
- }
+ for (Location location : locations) {
+ String url = EvohomeApiConstants.URL_V2_BASE + EvohomeApiConstants.URL_V2_LOCATION_STATUS;
+ url = String.format(url, location.getLocationInfo().getLocationId());
+ LocationStatus status = apiAccess.doAuthenticatedGet(url, LocationStatus.class);
+ locationsStatus.add(status);
}
+
return locationsStatus;
}
*/
package org.openhab.binding.evohome.internal.api;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Exception for errors from the API Client.
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeApiClientException extends Exception {
+ private static final long serialVersionUID = 1L;
public EvohomeApiClientException() {
}
*/
package org.openhab.binding.evohome.internal.api;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* List of evohome API constants
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeApiConstants {
public static final String URL_V2_AUTH = "https://tccna.honeywell.com/Auth/OAuth/Token";
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Request model for the mode
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class HeatSetPoint {
+
+ /**
+ * Constructs an override reset
+ */
+ HeatSetPoint() {
+ heatSetpointValue = 0.0;
+ setpointMode = "FollowSchedule";
+ timeUntil = null;
+ }
+
+ /**
+ * Constructs a permanent override with the given temperature
+ *
+ * @param setPoint The target temperature to set the set point to
+ */
+ HeatSetPoint(double setPoint) {
+ // Make sure that the value is rounded toward the nearest 0.5
+ heatSetpointValue = Math.round(setPoint * 2) / 2.0;
+ setpointMode = "PermanentOverride";
+ timeUntil = null;
+ }
+
+ @SuppressWarnings("unused")
+ @SerializedName("heatSetpointValue")
+ private double heatSetpointValue;
+
+ @SuppressWarnings("unused")
+ @SerializedName("setpointMode")
+ private String setpointMode;
+
+ @SuppressWarnings("unused")
+ @SerializedName("timeUntil")
+ private String timeUntil;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+/**
+ * Builder for heat set point API requests
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class HeatSetPointBuilder implements RequestBuilder<HeatSetPoint> {
+
+ private double setPoint;
+ private boolean hasSetPoint;
+ private boolean cancelSetPoint;
+
+ /**
+ * Creates a new heat set point command
+ *
+ * @return A heat set point command or null when the configuration is invalid
+ *
+ */
+ @Override
+ public HeatSetPoint build() {
+ if (cancelSetPoint) {
+ return new HeatSetPoint();
+ }
+ if (hasSetPoint) {
+ return new HeatSetPoint(setPoint);
+ }
+ return null;
+ }
+
+ public HeatSetPointBuilder setSetPoint(double setPoint) {
+ this.hasSetPoint = true;
+ this.setPoint = setPoint;
+ return this;
+ }
+
+ public HeatSetPointBuilder setCancelSetPoint() {
+ cancelSetPoint = true;
+ return this;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Request model for the mode
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Mode {
+
+ Mode(String mode) {
+ systemMode = mode;
+ timeUntil = null;
+ permanent = true;
+ }
+
+ Mode(String mode, int day, int month, int year) {
+ systemMode = mode;
+ timeUntil = String.format("%s-%s-%sT00:00:00Z", year, month, day);
+ permanent = false;
+ }
+
+ @SuppressWarnings("unused")
+ @SerializedName("systemMode")
+ private String systemMode;
+
+ @SuppressWarnings("unused")
+ @SerializedName("timeUntil")
+ private String timeUntil;
+
+ @SuppressWarnings("unused")
+ @SerializedName("permanent")
+ private boolean permanent;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+/**
+ * Builder for mode API requests
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class ModeBuilder extends TimedRequestBuilder<Mode> {
+
+ private String mode;
+ private boolean hasSetMode;
+
+ /**
+ * Creates a new mode command
+ *
+ * @return A mode command or null when the configuration is invalid
+ *
+ */
+ @Override
+ public Mode build() {
+ if (hasSetMode) {
+ if (useEndTime()) {
+ return new Mode(mode, getYear(), getMonth(), getDay());
+ } else {
+ return new Mode(mode);
+ }
+ }
+ return null;
+ }
+
+ public ModeBuilder setMode(String mode) {
+ this.hasSetMode = true;
+ this.mode = mode;
+ return this;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+/**
+ * Builder for API requests
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public interface RequestBuilder<T> {
+
+ public T build();
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.request;
+
+/**
+ * Builder for timed API requests
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public abstract class TimedRequestBuilder<T> implements RequestBuilder<T> {
+ private boolean useEndTime;
+ private int year;
+ private int month;
+ private int day;
+
+ public RequestBuilder<T> withEndTime(int year, int month, int day) {
+ this.useEndTime = true;
+ this.year = year;
+ this.month = month;
+ this.day = day;
+ return this;
+ }
+
+ protected boolean useEndTime() {
+ return useEndTime;
+ }
+
+ protected int getYear() {
+ return year;
+ }
+
+ protected int getMonth() {
+ return month;
+ }
+
+ protected int getDay() {
+ return day;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the active fault
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class ActiveFault {
+
+ @SerializedName("faultType")
+ private String faultType;
+
+ @SerializedName("since")
+ private String since;
+
+ public String getFaultType() {
+ return faultType;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the authentication
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Authentication {
+
+ @SerializedName("access_token")
+ private String accessToken;
+
+ @SerializedName("token_type")
+ private String tokenType;
+
+ @SerializedName("expires_in")
+ private int expiresIn;
+
+ @SerializedName("refresh_token")
+ private String refreshToken;
+
+ @SerializedName("scope")
+ private String scope;
+
+ /** Convenience variable for current system time in seconds */
+ private long systemTime;
+
+ public String getAccessToken() {
+ return accessToken;
+ }
+
+ public int getExpiresIn() {
+ return expiresIn;
+ }
+
+ public String getRefreshToken() {
+ return refreshToken;
+ }
+
+ public void setSystemTime(long systemTime) {
+ this.systemTime = systemTime;
+ }
+
+ public long getSystemTime() {
+ return systemTime;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the gateway
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Gateway {
+
+ @SerializedName("gatewayInfo")
+ private GatewayInfo gatewayInfo;
+
+ @SerializedName("temperatureControlSystems")
+ private List<TemperatureControlSystem> temperatureControlSystems;
+
+ public GatewayInfo getGatewayInfo() {
+ return gatewayInfo;
+ }
+
+ public List<TemperatureControlSystem> getTemperatureControlSystems() {
+ return temperatureControlSystems;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the gateway info
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class GatewayInfo {
+
+ @SerializedName("gatewayId")
+ private String gatewayId;
+
+ @SerializedName("mac")
+ private String macAddress;
+
+ @SerializedName("crc")
+ private String crc;
+
+ @SerializedName("isWiFi")
+ private boolean isWifi;
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the gateway status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class GatewayStatus {
+
+ @SerializedName("gatewayId")
+ private String gatewayId;
+
+ @SerializedName("temperatureControlSystems")
+ private List<TemperatureControlSystemStatus> temperatureControlSystems;
+
+ @SerializedName("activeFaults")
+ private List<ActiveFault> activeFaults;
+
+ public List<TemperatureControlSystemStatus> getTemperatureControlSystems() {
+ return temperatureControlSystems;
+ }
+
+ public boolean hasActiveFaults() {
+ return !activeFaults.isEmpty();
+ }
+
+ public ActiveFault getActiveFault(int index) {
+ return activeFaults.get(index);
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the heat set point capabilities
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class HeatSetpointCapabilities {
+
+ @SerializedName("maxHeatSetpoint")
+ private double maxHeatSetpoint;
+
+ @SerializedName("minHeatSetpoint")
+ private double minHeatSetpoint;
+
+ @SerializedName("valueResolution")
+ private double valueResolution;
+
+ @SerializedName("allowedSetpointModes")
+ private List<String> allowedSetpointModes;
+
+ @SerializedName("maxDuration")
+ private String maxDuration;
+
+ @SerializedName("timingResolution")
+ private String timingResolution;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the heat setpoint status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class HeatSetpointStatus {
+
+ @SerializedName("targetHeatTemperature")
+ private double targetTemperature;
+
+ @SerializedName("setpointMode")
+ private String setpointMode;
+
+ public double getTargetTemperature() {
+ return targetTemperature;
+ }
+
+ public String getSetpointMode() {
+ return setpointMode;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the location
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Location {
+
+ @SerializedName("locationInfo")
+ private LocationInfo locationInfo;
+
+ @SerializedName("gateways")
+ private List<Gateway> gateways;
+
+ public LocationInfo getLocationInfo() {
+ return locationInfo;
+ }
+
+ public List<Gateway> getGateways() {
+ return gateways;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the location info
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class LocationInfo {
+
+ @SerializedName("locationId")
+ private String locationId;
+
+ @SerializedName("name")
+ private String name;
+
+ @SerializedName("streetAddress")
+ private String streetAddress;
+
+ @SerializedName("city")
+ private String city;
+
+ @SerializedName("country")
+ private String country;
+
+ @SerializedName("postcode")
+ private String postcode;
+
+ @SerializedName("locationType")
+ private String locationType;
+
+ @SerializedName("useDaylightSaveSwitching")
+ private boolean useDaylightSaveSwitching;
+
+ @SerializedName("timeZone")
+ private TimeZone timeZone;
+
+ @SerializedName("locationOwner")
+ private LocationOwner locationOwner;
+
+ public String getLocationId() {
+ return locationId;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the location owner
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class LocationOwner {
+
+ @SerializedName("userId")
+ private int userId;
+
+ @SerializedName("username")
+ private String username;
+
+ @SerializedName("firstname")
+ private String firstName;
+
+ @SerializedName("lastname")
+ private String lastName;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the location status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class LocationStatus {
+
+ @SerializedName("locationId")
+ private String locationId;
+
+ @SerializedName("gateways")
+ private List<GatewayStatus> gateways;
+
+ public LocationStatus() {
+ locationId = "";
+ gateways = new ArrayList<>();
+ }
+
+ public List<GatewayStatus> getGateways() {
+ return gateways;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.ArrayList;
+
+/**
+ * Alias for a list of locations
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Locations extends ArrayList<Location> {
+ private static final long serialVersionUID = 1L;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.ArrayList;
+
+/**
+ * Alias for a list of location statuses
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class LocationsStatus extends ArrayList<LocationStatus> {
+ private static final long serialVersionUID = 1L;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the mode
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Mode {
+
+ @SerializedName("systemMode")
+ private String systemMode;
+
+ @SerializedName("canBePermanent")
+ private boolean canBePermanent;
+
+ @SerializedName("canBeTemporary")
+ private boolean canBeTemporary;
+
+ @SerializedName("timingMode")
+ private String timingMode;
+
+ @SerializedName("maxDuration")
+ private String maxDuration;
+
+ @SerializedName("timingResolution")
+ private String timingResolution;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the schedule capabilities
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class ScheduleCapabilities {
+
+ @SerializedName("maxSwitchpointsPerDay")
+ private int maxSwitchpointsPerDay;
+
+ @SerializedName("minSwitchpointsPerDay")
+ private int minSwitchpointsPerDay;
+
+ @SerializedName("setpointValueResolution")
+ private double setpointValueResolution;
+
+ @SerializedName("timingResolution")
+ private String timingResolution;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the system mode status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class SystemModeStatus {
+
+ @SerializedName("mode")
+ private String mode;
+
+ @SerializedName("isPermanent")
+ private boolean isPermanent;
+
+ public String getMode() {
+ return mode;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the temperature control system
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class TemperatureControlSystem {
+
+ @SerializedName("systemId")
+ private String systemId;
+
+ @SerializedName("modelType")
+ private String modelType;
+
+ @SerializedName("zones")
+ private List<Zone> zones;
+
+ @SerializedName("allowedSystemModes")
+ private List<Mode> allowedSystemModes;
+
+ public String getSystemId() {
+ return systemId;
+ }
+
+ public List<Zone> getZones() {
+ return zones;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the temperature control system status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class TemperatureControlSystemStatus {
+
+ @SerializedName("systemId")
+ private String systemId;
+
+ @SerializedName("systemModeStatus")
+ private SystemModeStatus mode;
+
+ @SerializedName("zones")
+ private List<ZoneStatus> zones;
+
+ @SerializedName("activeFaults")
+ private List<ActiveFault> activeFaults;
+
+ public String getSystemId() {
+ return systemId;
+ }
+
+ public SystemModeStatus getMode() {
+ return mode;
+ }
+
+ public List<ZoneStatus> getZones() {
+ return zones;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the temperature status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class TemperatureStatus {
+
+ @SerializedName("temperature")
+ private double temperature;
+
+ @SerializedName("isAvailable")
+ private boolean isAvailable;
+
+ public double getTemperature() {
+ return temperature;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the time zone
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class TimeZone {
+
+ @SerializedName("timeZoneId")
+ private String timeZoneId;
+
+ @SerializedName("displayName")
+ private String displayName;
+
+ @SerializedName("offsetMinutes")
+ private int offsetMinutes;
+
+ @SerializedName("currentOffsetMinutes")
+ private int currentOffsetMinutes;
+
+ @SerializedName("supportsDaylightSaving")
+ private boolean supportsDaylightSaving;
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the user account
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class UserAccount {
+
+ @SerializedName("userId")
+ private String userId;
+
+ @SerializedName("username")
+ private String userName;
+
+ @SerializedName("firstname")
+ private String firstName;
+
+ @SerializedName("lastname")
+ private String lastName;
+
+ @SerializedName("streetAddress")
+ private String streetAddress;
+
+ @SerializedName("city")
+ private String city;
+
+ @SerializedName("postcode")
+ private String postCode;
+
+ @SerializedName("country")
+ private String country;
+
+ @SerializedName("language")
+ private String language;
+
+ public String getUserId() {
+ return userId;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for the zone
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class Zone {
+
+ @SerializedName("zoneId")
+ private String zoneId;
+
+ @SerializedName("modelType")
+ private String modelType;
+
+ @SerializedName("name")
+ private String name;
+
+ @SerializedName("zoneType")
+ private String zoneType;
+
+ @SerializedName("heatSetpointCapabilities")
+ private HeatSetpointCapabilities heatSetpointCapabilities;
+
+ @SerializedName("scheduleCapabilities")
+ private ScheduleCapabilities scheduleCapabilities;
+
+ public String getZoneId() {
+ return zoneId;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
--- /dev/null
+/**
+ * Copyright (c) 2010-2023 Contributors to the openHAB project
+ *
+ * See the NOTICE file(s) distributed with this work for additional
+ * information.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ */
+package org.openhab.binding.evohome.internal.api.models.v2.dto.response;
+
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+/**
+ * Response model for zone status
+ *
+ * @author Jasper van Zuijlen - Initial contribution
+ *
+ */
+public class ZoneStatus {
+
+ @SerializedName("zoneId")
+ private String zoneId;
+
+ @SerializedName("name")
+ private String name;
+
+ @SerializedName("temperatureStatus")
+ private TemperatureStatus temperature;
+
+ @SerializedName("setpointStatus")
+ private HeatSetpointStatus heatSetpoint;
+
+ @SerializedName("activeFaults")
+ private List<ActiveFault> activeFaults;
+
+ public String getZoneId() {
+ return zoneId;
+ }
+
+ public TemperatureStatus getTemperature() {
+ return temperature;
+ }
+
+ public HeatSetpointStatus getHeatSetpoint() {
+ return heatSetpoint;
+ }
+
+ public boolean hasActiveFaults() {
+ return !activeFaults.isEmpty();
+ }
+
+ public ActiveFault getActiveFault(int index) {
+ return activeFaults.get(index);
+ }
+}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Request model for the mode
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class HeatSetPoint {
-
- /**
- * Constructs an override reset
- */
- HeatSetPoint() {
- heatSetpointValue = 0.0;
- setpointMode = "FollowSchedule";
- timeUntil = null;
- }
-
- /**
- * Constructs a permanent override with the given temperature
- *
- * @param setPoint The target temperature to set the set point to
- */
- HeatSetPoint(double setPoint) {
- // Make sure that the value is rounded toward the nearest 0.5
- heatSetpointValue = Math.round(setPoint * 2) / 2.0;
- setpointMode = "PermanentOverride";
- timeUntil = null;
- }
-
- @SerializedName("heatSetpointValue")
- private double heatSetpointValue;
-
- @SerializedName("setpointMode")
- private String setpointMode;
-
- @SerializedName("timeUntil")
- private String timeUntil;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-/**
- * Builder for heat set point API requests
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class HeatSetPointBuilder implements RequestBuilder<HeatSetPoint> {
-
- private double setPoint;
- private boolean hasSetPoint;
- private boolean cancelSetPoint;
-
- /**
- * Creates a new heat set point command
- *
- * @return A heat set point command or null when the configuration is invalid
- *
- */
- @Override
- public HeatSetPoint build() {
- if (cancelSetPoint) {
- return new HeatSetPoint();
- }
- if (hasSetPoint) {
- return new HeatSetPoint(setPoint);
- }
- return null;
- }
-
- public HeatSetPointBuilder setSetPoint(double setPoint) {
- this.hasSetPoint = true;
- this.setPoint = setPoint;
- return this;
- }
-
- public HeatSetPointBuilder setCancelSetPoint() {
- cancelSetPoint = true;
- return this;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Request model for the mode
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Mode {
-
- Mode(String mode) {
- systemMode = mode;
- timeUntil = null;
- permanent = true;
- }
-
- Mode(String mode, int day, int month, int year) {
- systemMode = mode;
- timeUntil = String.format("%s-%s-%sT00:00:00Z", year, month, day);
- permanent = false;
- }
-
- @SerializedName("systemMode")
- private String systemMode;
-
- @SerializedName("timeUntil")
- private String timeUntil;
-
- @SerializedName("permanent")
- private boolean permanent;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-/**
- * Builder for mode API requests
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class ModeBuilder extends TimedRequestBuilder<Mode> {
-
- private String mode;
- private boolean hasSetMode;
-
- /**
- * Creates a new mode command
- *
- * @return A mode command or null when the configuration is invalid
- *
- */
- @Override
- public Mode build() {
- if (hasSetMode) {
- if (useEndTime()) {
- return new Mode(mode, getYear(), getMonth(), getDay());
- } else {
- return new Mode(mode);
- }
- }
- return null;
- }
-
- public ModeBuilder setMode(String mode) {
- this.hasSetMode = true;
- this.mode = mode;
- return this;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-/**
- * Builder for API requests
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public interface RequestBuilder<T> {
-
- public T build();
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.request;
-
-/**
- * Builder for timed API requests
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public abstract class TimedRequestBuilder<T> implements RequestBuilder<T> {
- private boolean useEndTime;
- private int year;
- private int month;
- private int day;
-
- public RequestBuilder<T> withEndTime(int year, int month, int day) {
- this.useEndTime = true;
- this.year = year;
- this.month = month;
- this.day = day;
- return this;
- }
-
- protected boolean useEndTime() {
- return useEndTime;
- }
-
- protected int getYear() {
- return year;
- }
-
- protected int getMonth() {
- return month;
- }
-
- protected int getDay() {
- return day;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the active fault
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class ActiveFault {
-
- @SerializedName("faultType")
- private String faultType;
-
- @SerializedName("since")
- private String since;
-
- public String getFaultType() {
- return faultType;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the authentication
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Authentication {
-
- @SerializedName("access_token")
- private String accessToken;
-
- @SerializedName("token_type")
- private String tokenType;
-
- @SerializedName("expires_in")
- private int expiresIn;
-
- @SerializedName("refresh_token")
- private String refreshToken;
-
- @SerializedName("scope")
- private String scope;
-
- /** Convenience variable for current system time in seconds */
- private long systemTime;
-
- public String getAccessToken() {
- return accessToken;
- }
-
- public int getExpiresIn() {
- return expiresIn;
- }
-
- public String getRefreshToken() {
- return refreshToken;
- }
-
- public void setSystemTime(long systemTime) {
- this.systemTime = systemTime;
- }
-
- public long getSystemTime() {
- return systemTime;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the gateway
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Gateway {
-
- @SerializedName("gatewayInfo")
- private GatewayInfo gatewayInfo;
-
- @SerializedName("temperatureControlSystems")
- private List<TemperatureControlSystem> temperatureControlSystems;
-
- public GatewayInfo getGatewayInfo() {
- return gatewayInfo;
- }
-
- public List<TemperatureControlSystem> getTemperatureControlSystems() {
- return temperatureControlSystems;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the gateway info
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class GatewayInfo {
-
- @SerializedName("gatewayId")
- private String gatewayId;
-
- @SerializedName("mac")
- private String macAddress;
-
- @SerializedName("crc")
- private String crc;
-
- @SerializedName("isWiFi")
- private boolean isWifi;
-
- public String getGatewayId() {
- return gatewayId;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the gateway status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class GatewayStatus {
-
- @SerializedName("gatewayId")
- private String gatewayId;
-
- @SerializedName("temperatureControlSystems")
- private List<TemperatureControlSystemStatus> temperatureControlSystems;
-
- @SerializedName("activeFaults")
- private List<ActiveFault> activeFaults;
-
- public List<TemperatureControlSystemStatus> getTemperatureControlSystems() {
- return temperatureControlSystems;
- }
-
- public boolean hasActiveFaults() {
- return !activeFaults.isEmpty();
- }
-
- public ActiveFault getActiveFault(int index) {
- return activeFaults.get(index);
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the heat set point capabilities
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class HeatSetpointCapabilities {
-
- @SerializedName("maxHeatSetpoint")
- private double maxHeatSetpoint;
-
- @SerializedName("minHeatSetpoint")
- private double minHeatSetpoint;
-
- @SerializedName("valueResolution")
- private double valueResolution;
-
- @SerializedName("allowedSetpointModes")
- private List<String> allowedSetpointModes;
-
- @SerializedName("maxDuration")
- private String maxDuration;
-
- @SerializedName("timingResolution")
- private String timingResolution;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the heat setpoint status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class HeatSetpointStatus {
-
- @SerializedName("targetHeatTemperature")
- private double targetTemperature;
-
- @SerializedName("setpointMode")
- private String setpointMode;
-
- public double getTargetTemperature() {
- return targetTemperature;
- }
-
- public String getSetpointMode() {
- return setpointMode;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the location
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Location {
-
- @SerializedName("locationInfo")
- private LocationInfo locationInfo;
-
- @SerializedName("gateways")
- private List<Gateway> gateways;
-
- public LocationInfo getLocationInfo() {
- return locationInfo;
- }
-
- public List<Gateway> getGateways() {
- return gateways;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the location info
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class LocationInfo {
-
- @SerializedName("locationId")
- private String locationId;
-
- @SerializedName("name")
- private String name;
-
- @SerializedName("streetAddress")
- private String streetAddress;
-
- @SerializedName("city")
- private String city;
-
- @SerializedName("country")
- private String country;
-
- @SerializedName("postcode")
- private String postcode;
-
- @SerializedName("locationType")
- private String locationType;
-
- @SerializedName("useDaylightSaveSwitching")
- private boolean useDaylightSaveSwitching;
-
- @SerializedName("timeZone")
- private TimeZone timeZone;
-
- @SerializedName("locationOwner")
- private LocationOwner locationOwner;
-
- public String getLocationId() {
- return locationId;
- }
-
- public String getName() {
- return name;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the location owner
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class LocationOwner {
-
- @SerializedName("userId")
- private int userId;
-
- @SerializedName("username")
- private String username;
-
- @SerializedName("firstname")
- private String firstName;
-
- @SerializedName("lastname")
- private String lastName;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the location status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class LocationStatus {
-
- @SerializedName("locationId")
- private String locationId;
-
- @SerializedName("gateways")
- private List<GatewayStatus> gateways;
-
- public LocationStatus() {
- locationId = "";
- gateways = new ArrayList<>();
- }
-
- public List<GatewayStatus> getGateways() {
- return gateways;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.ArrayList;
-
-/**
- * Alias for a list of locations
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Locations extends ArrayList<Location> {
-
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.ArrayList;
-
-/**
- * Alias for a list of location statuses
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class LocationsStatus extends ArrayList<LocationStatus> {
-
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the mode
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Mode {
-
- @SerializedName("systemMode")
- private String systemMode;
-
- @SerializedName("canBePermanent")
- private boolean canBePermanent;
-
- @SerializedName("canBeTemporary")
- private boolean canBeTemporary;
-
- @SerializedName("timingMode")
- private String timingMode;
-
- @SerializedName("maxDuration")
- private String maxDuration;
-
- @SerializedName("timingResolution")
- private String timingResolution;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the schedule capabilities
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class ScheduleCapabilities {
-
- @SerializedName("maxSwitchpointsPerDay")
- private int maxSwitchpointsPerDay;
-
- @SerializedName("minSwitchpointsPerDay")
- private int minSwitchpointsPerDay;
-
- @SerializedName("setpointValueResolution")
- private double setpointValueResolution;
-
- @SerializedName("timingResolution")
- private String timingResolution;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the system mode status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class SystemModeStatus {
-
- @SerializedName("mode")
- private String mode;
-
- @SerializedName("isPermanent")
- private boolean isPermanent;
-
- public String getMode() {
- return mode;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the temperature control system
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class TemperatureControlSystem {
-
- @SerializedName("systemId")
- private String systemId;
-
- @SerializedName("modelType")
- private String modelType;
-
- @SerializedName("zones")
- private List<Zone> zones;
-
- @SerializedName("allowedSystemModes")
- private List<Mode> allowedSystemModes;
-
- public String getSystemId() {
- return systemId;
- }
-
- public List<Zone> getZones() {
- return zones;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the temperature control system status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class TemperatureControlSystemStatus {
-
- @SerializedName("systemId")
- private String systemId;
-
- @SerializedName("systemModeStatus")
- private SystemModeStatus mode;
-
- @SerializedName("zones")
- private List<ZoneStatus> zones;
-
- @SerializedName("activeFaults")
- private List<ActiveFault> activeFaults;
-
- public String getSystemId() {
- return systemId;
- }
-
- public SystemModeStatus getMode() {
- return mode;
- }
-
- public List<ZoneStatus> getZones() {
- return zones;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the temperature status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class TemperatureStatus {
-
- @SerializedName("temperature")
- private double temperature;
-
- @SerializedName("isAvailable")
- private boolean isAvailable;
-
- public double getTemperature() {
- return temperature;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the time zone
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class TimeZone {
-
- @SerializedName("timeZoneId")
- private String timeZoneId;
-
- @SerializedName("displayName")
- private String displayName;
-
- @SerializedName("offsetMinutes")
- private int offsetMinutes;
-
- @SerializedName("currentOffsetMinutes")
- private int currentOffsetMinutes;
-
- @SerializedName("supportsDaylightSaving")
- private boolean supportsDaylightSaving;
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the user account
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class UserAccount {
-
- @SerializedName("userId")
- private String userId;
-
- @SerializedName("username")
- private String userName;
-
- @SerializedName("firstname")
- private String firstName;
-
- @SerializedName("lastname")
- private String lastName;
-
- @SerializedName("streetAddress")
- private String streetAddress;
-
- @SerializedName("city")
- private String city;
-
- @SerializedName("postcode")
- private String postCode;
-
- @SerializedName("country")
- private String country;
-
- @SerializedName("language")
- private String language;
-
- public String getUserId() {
- return userId;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for the zone
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class Zone {
-
- @SerializedName("zoneId")
- private String zoneId;
-
- @SerializedName("modelType")
- private String modelType;
-
- @SerializedName("name")
- private String name;
-
- @SerializedName("zoneType")
- private String zoneType;
-
- @SerializedName("heatSetpointCapabilities")
- private HeatSetpointCapabilities heatSetpointCapabilities;
-
- @SerializedName("scheduleCapabilities")
- private ScheduleCapabilities scheduleCapabilities;
-
- public String getZoneId() {
- return zoneId;
- }
-
- public String getName() {
- return name;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2010-2023 Contributors to the openHAB project
- *
- * See the NOTICE file(s) distributed with this work for additional
- * information.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- */
-package org.openhab.binding.evohome.internal.api.models.v2.response;
-
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-/**
- * Response model for zone status
- *
- * @author Jasper van Zuijlen - Initial contribution
- *
- */
-public class ZoneStatus {
-
- @SerializedName("zoneId")
- private String zoneId;
-
- @SerializedName("name")
- private String name;
-
- @SerializedName("temperatureStatus")
- private TemperatureStatus temperature;
-
- @SerializedName("setpointStatus")
- private HeatSetpointStatus heatSetpoint;
-
- @SerializedName("activeFaults")
- private List<ActiveFault> activeFaults;
-
- public String getZoneId() {
- return zoneId;
- }
-
- public TemperatureStatus getTemperature() {
- return temperature;
- }
-
- public HeatSetpointStatus getHeatSetpoint() {
- return heatSetpoint;
- }
-
- public boolean hasActiveFaults() {
- return !activeFaults.isEmpty();
- }
-
- public ActiveFault getActiveFault(int index) {
- return activeFaults.get(index);
- }
-}
*/
package org.openhab.binding.evohome.internal.configuration;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Contains the configuration of the binding.
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeAccountConfiguration {
- public String username;
- public String password;
- public String applicationId;
+ public String username = "";
+ public String password = "";
+ public String applicationId = "";
public int refreshInterval;
}
*/
package org.openhab.binding.evohome.internal.configuration;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Contains the configuration of the binding.
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeTemperatureControlSystemConfiguration {
- public String id;
- public String name;
+ public String id = "";
+ public String name = "";
}
*/
package org.openhab.binding.evohome.internal.configuration;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+
/**
* Contains the common configuration definition of an evohome Thing
*
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeThingConfiguration {
- public String id;
- public String name;
+ public String id = "";
+ public String name = "";
}
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.evohome.internal.EvohomeBindingConstants;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Gateway;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Location;
-import org.openhab.binding.evohome.internal.api.models.v2.response.TemperatureControlSystem;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Zone;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Gateway;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Location;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Locations;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.TemperatureControlSystem;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Zone;
import org.openhab.binding.evohome.internal.handler.AccountStatusListener;
import org.openhab.binding.evohome.internal.handler.EvohomeAccountBridgeHandler;
import org.openhab.core.config.discovery.AbstractDiscoveryService;
* @author Jasper van Zuijlen - Background discovery
*
*/
+@NonNullByDefault
public class EvohomeDiscoveryService extends AbstractDiscoveryService implements AccountStatusListener {
private final Logger logger = LoggerFactory.getLogger(EvohomeDiscoveryService.class);
private static final int TIMEOUT = 5;
logger.debug("Evohome Gateway not online, scanning postponed");
return;
}
+ Locations localEvohomeConfig = bridge.getEvohomeConfig();
- for (Location location : bridge.getEvohomeConfig()) {
+ if (localEvohomeConfig == null) {
+ return;
+ }
+ for (Location location : localEvohomeConfig) {
+ if (location == null) {
+ continue;
+ }
for (Gateway gateway : location.getGateways()) {
for (TemperatureControlSystem tcs : gateway.getTemperatureControlSystems()) {
+ if (tcs == null) {
+ continue;
+ }
addDisplayDiscoveryResult(location, tcs);
for (Zone zone : tcs.getZones()) {
- addZoneDiscoveryResult(location, zone);
+ if (zone != null) {
+ addZoneDiscoveryResult(location, zone);
+ }
}
}
}
}
-
stopScan();
}
*/
package org.openhab.binding.evohome.internal.handler;
+import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingStatus;
/**
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public interface AccountStatusListener {
/**
*/
package org.openhab.binding.evohome.internal.handler;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Locations;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Locations;
import org.openhab.binding.evohome.internal.configuration.EvohomeThingConfiguration;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.Thing;
*
* @author Jasper van Zuijlen - Initial contribution
*/
+@NonNullByDefault
public abstract class BaseEvohomeHandler extends BaseThingHandler {
- private EvohomeThingConfiguration configuration;
+ private EvohomeThingConfiguration configuration = new EvohomeThingConfiguration();
public BaseEvohomeHandler(Thing thing) {
super(thing);
@Override
public void dispose() {
- configuration = null;
}
public String getId() {
- if (configuration != null) {
- return configuration.id;
- }
- return null;
+ return configuration.id;
}
/**
*
* @return The evohome brdige
*/
- protected EvohomeAccountBridgeHandler getEvohomeBridge() {
+ protected @Nullable EvohomeAccountBridgeHandler getEvohomeBridge() {
Bridge bridge = getBridge();
if (bridge != null) {
return (EvohomeAccountBridgeHandler) bridge.getHandler();
*
* @return The current evohome configuration
*/
- protected Locations getEvohomeConfig() {
- EvohomeAccountBridgeHandler bridge = getEvohomeBridge();
- if (bridge != null) {
- return bridge.getEvohomeConfig();
+ protected @Nullable Locations getEvohomeConfig() {
+ EvohomeAccountBridgeHandler bridgeAccountHandler = getEvohomeBridge();
+ if (bridgeAccountHandler != null) {
+ return bridgeAccountHandler.getEvohomeConfig();
}
return null;
* @param detail The status detail value
* @param message The message to show with the status
*/
- protected void updateEvohomeThingStatus(ThingStatus newStatus, ThingStatusDetail detail, String message) {
+ protected void updateEvohomeThingStatus(ThingStatus newStatus, ThingStatusDetail detail, @Nullable String message) {
// Prevent spamming the log file
if (!newStatus.equals(getThing().getStatus())) {
updateStatus(newStatus, detail, message);
* @param configuration The configuration to check
*/
private void checkConfig() {
- if (configuration == null) {
- updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
- "Configuration is missing or corrupted");
- } else if (configuration.id == null || configuration.id.isEmpty()) {
+ if (configuration.id.isEmpty()) {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Id not configured");
}
}
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jetty.client.HttpClient;
import org.openhab.binding.evohome.internal.RunnableWithTimeout;
import org.openhab.binding.evohome.internal.api.EvohomeApiClient;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Gateway;
-import org.openhab.binding.evohome.internal.api.models.v2.response.GatewayStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Location;
-import org.openhab.binding.evohome.internal.api.models.v2.response.LocationStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Locations;
-import org.openhab.binding.evohome.internal.api.models.v2.response.LocationsStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.TemperatureControlSystem;
-import org.openhab.binding.evohome.internal.api.models.v2.response.TemperatureControlSystemStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.Zone;
-import org.openhab.binding.evohome.internal.api.models.v2.response.ZoneStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Gateway;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.GatewayStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Location;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.LocationStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Locations;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.LocationsStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.TemperatureControlSystem;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.TemperatureControlSystemStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.Zone;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.ZoneStatus;
import org.openhab.binding.evohome.internal.configuration.EvohomeAccountConfiguration;
import org.openhab.core.thing.Bridge;
import org.openhab.core.thing.ChannelUID;
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeAccountBridgeHandler extends BaseBridgeHandler {
private final Logger logger = LoggerFactory.getLogger(EvohomeAccountBridgeHandler.class);
private final HttpClient httpClient;
- private EvohomeAccountConfiguration configuration;
- private EvohomeApiClient apiClient;
+ private EvohomeAccountConfiguration configuration = new EvohomeAccountConfiguration();
+ private @Nullable EvohomeApiClient apiClient;
private List<AccountStatusListener> listeners = new CopyOnWriteArrayList<>();
- protected ScheduledFuture<?> refreshTask;
+ protected @Nullable ScheduledFuture<?> refreshTask;
public EvohomeAccountBridgeHandler(Bridge thing, HttpClient httpClient) {
super(thing);
public void initialize() {
configuration = getConfigAs(EvohomeAccountConfiguration.class);
- if (checkConfig()) {
+ if (checkConfig(configuration)) {
apiClient = new EvohomeApiClient(configuration, this.httpClient);
// Initialization can take a while, so kick it off on a separate thread
scheduler.schedule(() -> {
- if (apiClient.login()) {
- if (checkInstallationInfoHasDuplicateIds(apiClient.getInstallationInfo())) {
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null && localApiCLient.login()) {
+ if (checkInstallationInfoHasDuplicateIds(localApiCLient.getInstallationInfo())) {
startRefreshTask();
} else {
updateAccountStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
public void handleCommand(ChannelUID channelUID, Command command) {
}
- public Locations getEvohomeConfig() {
- return apiClient.getInstallationInfo();
+ public @Nullable Locations getEvohomeConfig() {
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ return localApiCLient.getInstallationInfo();
+ }
+ return null;
}
- public LocationsStatus getEvohomeStatus() {
- return apiClient.getInstallationStatus();
+ public @Nullable LocationsStatus getEvohomeStatus() {
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ return localApiCLient.getInstallationStatus();
+ }
+ return null;
}
public void setTcsMode(String tcsId, String mode) {
- tryToCall(() -> apiClient.setTcsMode(tcsId, mode));
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ tryToCall(() -> localApiCLient.setTcsMode(tcsId, mode));
+ }
}
public void setPermanentSetPoint(String zoneId, double doubleValue) {
- tryToCall(() -> apiClient.setHeatingZoneOverride(zoneId, doubleValue));
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ tryToCall(() -> localApiCLient.setHeatingZoneOverride(zoneId, doubleValue));
+ }
}
public void cancelSetPointOverride(String zoneId) {
- tryToCall(() -> apiClient.cancelHeatingZoneOverride(zoneId));
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ tryToCall(() -> localApiCLient.cancelHeatingZoneOverride(zoneId));
+ }
}
public void addAccountStatusListener(AccountStatusListener listener) {
}
private void disposeApiClient() {
- if (apiClient != null) {
- apiClient.logout();
+ EvohomeApiClient localApiClient = apiClient;
+ if (localApiClient != null) {
+ localApiClient.logout();
+ this.apiClient = null;
}
- apiClient = null;
}
private void disposeRefreshTask() {
- if (refreshTask != null) {
- refreshTask.cancel(true);
+ ScheduledFuture<?> localRefreshTask = refreshTask;
+ if (localRefreshTask != null) {
+ localRefreshTask.cancel(true);
+ this.refreshTask = null;
}
}
- private boolean checkConfig() {
+ private boolean checkConfig(EvohomeAccountConfiguration configuration) {
String errorMessage = "";
- if (configuration == null) {
- errorMessage = "Configuration is missing or corrupted";
- } else if (configuration.username == null || configuration.username.isEmpty()) {
+ if (configuration.username.isBlank()) {
errorMessage = "Username not configured";
- } else if (configuration.password == null || configuration.password.isEmpty()) {
+ } else if (configuration.password.isBlank()) {
errorMessage = "Password not configured";
} else {
return true;
private void update() {
try {
- apiClient.update();
+ EvohomeApiClient localApiCLient = apiClient;
+ if (localApiCLient != null) {
+ localApiCLient.update();
+ }
updateAccountStatus(ThingStatus.ONLINE);
updateThings();
} catch (Exception e) {
updateAccountStatus(newStatus, ThingStatusDetail.NONE, null);
}
- private void updateAccountStatus(ThingStatus newStatus, ThingStatusDetail detail, String message) {
+ private void updateAccountStatus(ThingStatus newStatus, ThingStatusDetail detail, @Nullable String message) {
// Prevent spamming the log file
if (!newStatus.equals(getThing().getStatus())) {
updateStatus(newStatus, detail, message);
Map<String, String> zoneIdToTcsIdMap = new HashMap<>();
Map<String, ThingStatus> idToTcsThingsStatusMap = new HashMap<>();
- // First, create a lookup table
- for (LocationStatus location : apiClient.getInstallationStatus()) {
- for (GatewayStatus gateway : location.getGateways()) {
- for (TemperatureControlSystemStatus tcs : gateway.getTemperatureControlSystems()) {
- idToTcsMap.put(tcs.getSystemId(), tcs);
- tcsIdToGatewayMap.put(tcs.getSystemId(), gateway);
- for (ZoneStatus zone : tcs.getZones()) {
- idToZoneMap.put(zone.getZoneId(), zone);
- zoneIdToTcsIdMap.put(zone.getZoneId(), tcs.getSystemId());
+ EvohomeApiClient localApiClient = apiClient;
+ if (localApiClient != null) {
+ // First, create a lookup table
+ LocationsStatus localLocationsStatus = localApiClient.getInstallationStatus();
+ if (localLocationsStatus != null) {
+ for (LocationStatus location : localLocationsStatus) {
+ for (GatewayStatus gateway : location.getGateways()) {
+ if (gateway == null) {
+ continue;
+ }
+ for (TemperatureControlSystemStatus tcs : gateway.getTemperatureControlSystems()) {
+ String systemId = tcs.getSystemId();
+ if (systemId != null) {
+ idToTcsMap.put(systemId, tcs);
+ tcsIdToGatewayMap.put(systemId, gateway);
+ }
+ for (ZoneStatus zone : tcs.getZones()) {
+ String zoneId = zone.getZoneId();
+ if (zoneId != null) {
+ idToZoneMap.put(zoneId, zone);
+ if (systemId != null) {
+ zoneIdToTcsIdMap.put(zoneId, systemId);
+ }
+ }
+ }
+ }
}
}
}
*/
package org.openhab.binding.evohome.internal.handler;
+import javax.measure.quantity.Temperature;
+
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.evohome.internal.EvohomeBindingConstants;
-import org.openhab.binding.evohome.internal.api.models.v2.response.ZoneStatus;
-import org.openhab.core.library.types.DecimalType;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.ZoneStatus;
+import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.types.StringType;
+import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
* @author Jasper van Zuijlen - Initial contribution
* @author Neil Renaud - Working implementation
* @author Jasper van Zuijlen - Refactor + Permanent Zone temperature setting
+ * @author Leo Siepel - Add UoM
*/
+@NonNullByDefault
public class EvohomeHeatingZoneHandler extends BaseEvohomeHandler {
private static final int CANCEL_SET_POINT_OVERRIDE = 0;
- private ThingStatus tcsStatus;
- private ZoneStatus zoneStatus;
+ private @Nullable ThingStatus tcsStatus;
+ private @Nullable ZoneStatus zoneStatus;
public EvohomeHeatingZoneHandler(Thing thing) {
super(thing);
super.initialize();
}
- public void update(ThingStatus tcsStatus, ZoneStatus zoneStatus) {
+ public void update(@Nullable ThingStatus tcsStatus, @Nullable ZoneStatus zoneStatus) {
this.tcsStatus = tcsStatus;
this.zoneStatus = zoneStatus;
updateEvohomeThingStatus(ThingStatus.ONLINE);
updateState(EvohomeBindingConstants.ZONE_TEMPERATURE_CHANNEL,
- new DecimalType(zoneStatus.getTemperature().getTemperature()));
+ new QuantityType<Temperature>(zoneStatus.getTemperature().getTemperature(), SIUnits.CELSIUS));
updateState(EvohomeBindingConstants.ZONE_SET_POINT_STATUS_CHANNEL,
new StringType(zoneStatus.getHeatSetpoint().getSetpointMode()));
- updateState(EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL,
- new DecimalType(zoneStatus.getHeatSetpoint().getTargetTemperature()));
+ updateState(EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL, new QuantityType<Temperature>(
+ zoneStatus.getHeatSetpoint().getTargetTemperature(), SIUnits.CELSIUS));
}
}
EvohomeAccountBridgeHandler bridge = getEvohomeBridge();
if (bridge != null) {
String channelId = channelUID.getId();
- if (EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL.equals(channelId)
- && command instanceof DecimalType) {
- double newTemp = ((DecimalType) command).doubleValue();
- if (newTemp == CANCEL_SET_POINT_OVERRIDE) {
- bridge.cancelSetPointOverride(getEvohomeThingConfig().id);
- } else if (newTemp < 5) {
- newTemp = 5;
- }
- if (newTemp >= 5 && newTemp <= 35) {
- bridge.setPermanentSetPoint(getEvohomeThingConfig().id, newTemp);
+ if (EvohomeBindingConstants.ZONE_SET_POINT_CHANNEL.equals(channelId)) {
+ if (command instanceof QuantityType) {
+ QuantityType<?> state = ((QuantityType<?>) command).toUnit(SIUnits.CELSIUS);
+ double newTempInCelsius = state.doubleValue();
+
+ if (newTempInCelsius == CANCEL_SET_POINT_OVERRIDE) {
+ bridge.cancelSetPointOverride(getEvohomeThingConfig().id);
+ } else if (newTempInCelsius < 5) {
+ newTempInCelsius = 5;
+ }
+ if (newTempInCelsius >= 5 && newTempInCelsius <= 35) {
+ bridge.setPermanentSetPoint(getEvohomeThingConfig().id, newTempInCelsius);
+ }
}
}
}
*/
package org.openhab.binding.evohome.internal.handler;
+import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.evohome.internal.EvohomeBindingConstants;
-import org.openhab.binding.evohome.internal.api.models.v2.response.GatewayStatus;
-import org.openhab.binding.evohome.internal.api.models.v2.response.TemperatureControlSystemStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.GatewayStatus;
+import org.openhab.binding.evohome.internal.api.models.v2.dto.response.TemperatureControlSystemStatus;
import org.openhab.core.library.types.StringType;
import org.openhab.core.thing.ChannelUID;
import org.openhab.core.thing.Thing;
* @author Jasper van Zuijlen - Initial contribution
*
*/
+@NonNullByDefault
public class EvohomeTemperatureControlSystemHandler extends BaseEvohomeHandler {
- private GatewayStatus gatewayStatus;
- private TemperatureControlSystemStatus tcsStatus;
+ private @Nullable GatewayStatus gatewayStatus;
+ private @Nullable TemperatureControlSystemStatus tcsStatus;
public EvohomeTemperatureControlSystemHandler(Thing thing) {
super(thing);
super.initialize();
}
- public void update(GatewayStatus gatewayStatus, TemperatureControlSystemStatus tcsStatus) {
+ public void update(@Nullable GatewayStatus gatewayStatus, @Nullable TemperatureControlSystemStatus tcsStatus) {
this.gatewayStatus = gatewayStatus;
this.tcsStatus = tcsStatus;
</state>
</channel-type>
<channel-type id="temperature">
- <item-type>Number</item-type>
+ <item-type>Number:Temperature</item-type>
<label>Temperature</label>
<description>Current zone temperature</description>
<category>temperature</category>
- <state readOnly="true" pattern="%.1f °C">
+ <tags>
+ <tag>Measurement</tag>
+ <tag>Temperature</tag>
+ </tags>
+ <state readOnly="true" pattern="%.1f %unit%">
</state>
</channel-type>
<channel-type id="setpoint">
- <item-type>Number</item-type>
+ <item-type>Number:Temperature</item-type>
<label>Set Point</label>
<description>Gets or sets the set point of this zone (0 cancels the override).</description>
<category>heating</category>
- <state min="0.0" max="35.0" step="0.5" pattern="%.1f °C"/>
+ <tags>
+ <tag>Setpoint</tag>
+ <tag>Temperature</tag>
+ </tags>
+ <state min="0.0" max="35.0" step="0.5" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="setpointstatus">
<item-type>String</item-type>