import org.openhab.binding.ojelectronics.internal.models.Thermostat;
import org.openhab.binding.ojelectronics.internal.models.groups.GroupContent;
import org.openhab.core.thing.Thing;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Refreshes values of {@link ThermostatHandler}
public class RefreshGroupContentService {
private final List<GroupContent> groupContentList;
+ private final Logger logger = LoggerFactory.getLogger(RefreshGroupContentService.class);
private List<Thing> things;
/**
public RefreshGroupContentService(List<GroupContent> groupContents, List<Thing> things) {
this.groupContentList = groupContents;
this.things = things;
+ if (this.things.isEmpty()) {
+ logger.warn("Bridge contains no thermostats.");
+ }
}
/**
if (!destroyed) {
if (result == null || result.isFailed()) {
handleConnectionLost();
- } else if (result.getResponse().getStatus() == HttpStatus.FORBIDDEN_403) {
- if (unauthorized != null) {
- unauthorized.run();
- }
- } else if (result.getResponse().getStatus() == HttpStatus.FORBIDDEN_403) {
- handleConnectionLost();
} else {
- handleRefreshDone(getContentAsString());
+ int status = result.getResponse().getStatus();
+ logger.trace("HTTP-Status {}", status);
+ if (status == HttpStatus.FORBIDDEN_403) {
+ if (unauthorized != null) {
+ unauthorized.run();
+ } else {
+ handleConnectionLost();
+ }
+ } else if (status == HttpStatus.OK_200) {
+ handleRefreshDone(getContentAsString());
+ } else {
+ logger.warn("unsupported HTTP-Status {}", status);
+ handleConnectionLost();
+ }
}
}
}