mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
[hdpowerview] Restructure DTO classes (#13630)
* Extract nested DTO's to separate classes * Rename api to dto * Move test classes into internal * Finish moving of files and fix namespaces Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
cf2a1afd56
commit
c114714a7b
@ -27,32 +27,32 @@ import org.eclipse.jetty.client.util.StringContentProvider;
|
|||||||
import org.eclipse.jetty.http.HttpHeader;
|
import org.eclipse.jetty.http.HttpHeader;
|
||||||
import org.eclipse.jetty.http.HttpMethod;
|
import org.eclipse.jetty.http.HttpMethod;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Color;
|
import org.openhab.binding.hdpowerview.internal.dto.Color;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.HubFirmware;
|
import org.openhab.binding.hdpowerview.internal.dto.HubFirmware;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.SurveyData;
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.UserData;
|
import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.RepeaterBlinking;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.RepeaterColor;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.ShadeCalibrate;
|
import org.openhab.binding.hdpowerview.internal.dto.SurveyData;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.ShadeJog;
|
import org.openhab.binding.hdpowerview.internal.dto.UserData;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.ShadeMove;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.RepeaterBlinking;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.requests.ShadeStop;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.RepeaterColor;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeCalibrate;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Repeater;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeJog;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeMove;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Repeaters;
|
import org.openhab.binding.hdpowerview.internal.dto.requests.ShadeStop;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.FirmwareVersion;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Repeater;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Repeaters;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shade;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.ScheduledEvents;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shade;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shades;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Survey;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Survey;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.UserDataResponse;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.UserDataResponse;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException;
|
||||||
|
@ -1,84 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State of all Scene Collections in an HD PowerView hub
|
|
||||||
*
|
|
||||||
* @author Jacob Laursen - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class SceneCollections {
|
|
||||||
|
|
||||||
public @Nullable List<SceneCollection> sceneCollectionData;
|
|
||||||
public @Nullable List<Integer> sceneCollectionIds;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the following SuppressWarnings annotation is because the Eclipse compiler
|
|
||||||
* does NOT expect a NonNullByDefault annotation on the inner class, since it is
|
|
||||||
* implicitly inherited from the outer class, whereas the Maven compiler always
|
|
||||||
* requires an explicit NonNullByDefault annotation on all classes
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@NonNullByDefault
|
|
||||||
public static class SceneCollection implements Comparable<SceneCollection> {
|
|
||||||
public int id;
|
|
||||||
public @Nullable String name;
|
|
||||||
public int order;
|
|
||||||
public int colorId;
|
|
||||||
public int iconId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object o) {
|
|
||||||
if (o == this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(o instanceof SceneCollection)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
SceneCollection other = (SceneCollection) o;
|
|
||||||
|
|
||||||
return this.id == other.id && this.name.equals(other.name) && this.order == other.order
|
|
||||||
&& this.colorId == other.colorId && this.iconId == other.iconId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + id;
|
|
||||||
result = prime * result + (name == null ? 0 : name.hashCode());
|
|
||||||
result = prime * result + order;
|
|
||||||
result = prime * result + colorId;
|
|
||||||
result = prime * result + iconId;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(SceneCollection other) {
|
|
||||||
return Integer.compare(order, other.order);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses;
|
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State of all Scenes in an HD PowerView hub
|
|
||||||
*
|
|
||||||
* @author Andy Lintner - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class Scenes {
|
|
||||||
|
|
||||||
public @Nullable List<Scene> sceneData;
|
|
||||||
public @Nullable List<Integer> sceneIds;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the following SuppressWarnings annotation is because the Eclipse compiler
|
|
||||||
* does NOT expect a NonNullByDefault annotation on the inner class, since it is
|
|
||||||
* implicitly inherited from the outer class, whereas the Maven compiler always
|
|
||||||
* requires an explicit NonNullByDefault annotation on all classes
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@NonNullByDefault
|
|
||||||
public static class Scene implements Comparable<Scene> {
|
|
||||||
public int id;
|
|
||||||
public @Nullable String name;
|
|
||||||
public int roomId;
|
|
||||||
public int order;
|
|
||||||
public int colorId;
|
|
||||||
public int iconId;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object o) {
|
|
||||||
if (o == this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(o instanceof Scene)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Scene other = (Scene) o;
|
|
||||||
|
|
||||||
return this.id == other.id && this.name.equals(other.name) && this.roomId == other.roomId
|
|
||||||
&& this.order == other.order && this.colorId == other.colorId && this.iconId == other.iconId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + id;
|
|
||||||
result = prime * result + (name == null ? 0 : name.hashCode());
|
|
||||||
result = prime * result + roomId;
|
|
||||||
result = prime * result + order;
|
|
||||||
result = prime * result + colorId;
|
|
||||||
result = prime * result + iconId;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(Scene other) {
|
|
||||||
return Integer.compare(order, other.order);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses;
|
|
||||||
|
|
||||||
import java.time.DayOfWeek;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State of all Scheduled Events in an HD PowerView hub
|
|
||||||
*
|
|
||||||
* @author Jacob Laursen - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class ScheduledEvents {
|
|
||||||
|
|
||||||
public static final EnumSet<DayOfWeek> WEEKDAYS = EnumSet.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY,
|
|
||||||
DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY);
|
|
||||||
|
|
||||||
public static final EnumSet<DayOfWeek> WEEKENDS = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
|
|
||||||
|
|
||||||
public static final int SCHEDULED_EVENT_TYPE_TIME = 0;
|
|
||||||
public static final int SCHEDULED_EVENT_TYPE_SUNRISE = 1;
|
|
||||||
public static final int SCHEDULED_EVENT_TYPE_SUNSET = 2;
|
|
||||||
|
|
||||||
public @Nullable List<ScheduledEvent> scheduledEventData;
|
|
||||||
public @Nullable List<Integer> scheduledEventIds;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the following SuppressWarnings annotation is because the Eclipse compiler
|
|
||||||
* does NOT expect a NonNullByDefault annotation on the inner class, since it is
|
|
||||||
* implicitly inherited from the outer class, whereas the Maven compiler always
|
|
||||||
* requires an explicit NonNullByDefault annotation on all classes
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@NonNullByDefault
|
|
||||||
public static class ScheduledEvent {
|
|
||||||
public int id;
|
|
||||||
public boolean enabled;
|
|
||||||
public int sceneId;
|
|
||||||
public int sceneCollectionId;
|
|
||||||
public boolean daySunday;
|
|
||||||
public boolean dayMonday;
|
|
||||||
public boolean dayTuesday;
|
|
||||||
public boolean dayWednesday;
|
|
||||||
public boolean dayThursday;
|
|
||||||
public boolean dayFriday;
|
|
||||||
public boolean daySaturday;
|
|
||||||
public int eventType;
|
|
||||||
public int hour;
|
|
||||||
public int minute;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(@Nullable Object o) {
|
|
||||||
if (o == this) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(o instanceof ScheduledEvent)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ScheduledEvent other = (ScheduledEvent) o;
|
|
||||||
|
|
||||||
return this.id == other.id && this.enabled == other.enabled && this.sceneId == other.sceneId
|
|
||||||
&& this.sceneCollectionId == other.sceneCollectionId && this.daySunday == other.daySunday
|
|
||||||
&& this.dayMonday == other.dayMonday && this.dayTuesday == other.dayTuesday
|
|
||||||
&& this.dayWednesday == other.dayWednesday && this.dayThursday == other.dayThursday
|
|
||||||
&& this.dayFriday == other.dayFriday && this.daySaturday == other.daySaturday
|
|
||||||
&& this.eventType == other.eventType && this.hour == other.hour && this.minute == other.minute;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + id;
|
|
||||||
result = prime * result + (enabled ? 1 : 0);
|
|
||||||
result = prime * result + sceneId;
|
|
||||||
result = prime * result + sceneCollectionId;
|
|
||||||
result = prime * result + (daySunday ? 1 : 0);
|
|
||||||
result = prime * result + (dayMonday ? 1 : 0);
|
|
||||||
result = prime * result + (dayTuesday ? 1 : 0);
|
|
||||||
result = prime * result + (dayWednesday ? 1 : 0);
|
|
||||||
result = prime * result + (dayThursday ? 1 : 0);
|
|
||||||
result = prime * result + (dayFriday ? 1 : 0);
|
|
||||||
result = prime * result + (daySaturday ? 1 : 0);
|
|
||||||
result = prime * result + eventType;
|
|
||||||
result = prime * result + hour;
|
|
||||||
result = prime * result + minute;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumSet<DayOfWeek> getDays() {
|
|
||||||
EnumSet<DayOfWeek> days = EnumSet.noneOf(DayOfWeek.class);
|
|
||||||
if (daySunday) {
|
|
||||||
days.add(DayOfWeek.SUNDAY);
|
|
||||||
}
|
|
||||||
if (dayMonday) {
|
|
||||||
days.add(DayOfWeek.MONDAY);
|
|
||||||
}
|
|
||||||
if (dayTuesday) {
|
|
||||||
days.add(DayOfWeek.TUESDAY);
|
|
||||||
}
|
|
||||||
if (dayWednesday) {
|
|
||||||
days.add(DayOfWeek.WEDNESDAY);
|
|
||||||
}
|
|
||||||
if (dayThursday) {
|
|
||||||
days.add(DayOfWeek.THURSDAY);
|
|
||||||
}
|
|
||||||
if (dayFriday) {
|
|
||||||
days.add(DayOfWeek.FRIDAY);
|
|
||||||
}
|
|
||||||
if (daySaturday) {
|
|
||||||
days.add(DayOfWeek.SATURDAY);
|
|
||||||
}
|
|
||||||
return days;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses;
|
|
||||||
|
|
||||||
import java.util.Base64;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.BatteryKind;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Firmware;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State of all Shades, as returned by an HD PowerView hub
|
|
||||||
*
|
|
||||||
* @author Andy Lintner - Initial contribution
|
|
||||||
*/
|
|
||||||
@NonNullByDefault
|
|
||||||
public class Shades {
|
|
||||||
|
|
||||||
public @Nullable List<ShadeData> shadeData;
|
|
||||||
public @Nullable List<Integer> shadeIds;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the following SuppressWarnings annotation is because the Eclipse compiler
|
|
||||||
* does NOT expect a NonNullByDefault annotation on the inner class, since it is
|
|
||||||
* implicitly inherited from the outer class, whereas the Maven compiler always
|
|
||||||
* requires an explicit NonNullByDefault annotation on all classes
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("null")
|
|
||||||
@NonNullByDefault
|
|
||||||
public static class ShadeData {
|
|
||||||
public int id;
|
|
||||||
public @Nullable String name;
|
|
||||||
public int roomId;
|
|
||||||
public int groupId;
|
|
||||||
public int order;
|
|
||||||
public int type;
|
|
||||||
public double batteryStrength;
|
|
||||||
public int batteryStatus;
|
|
||||||
public boolean batteryIsLow;
|
|
||||||
public @Nullable ShadePosition positions;
|
|
||||||
public @Nullable Boolean timedOut;
|
|
||||||
public int signalStrength;
|
|
||||||
public @Nullable Integer capabilities;
|
|
||||||
public @Nullable Firmware firmware;
|
|
||||||
public @Nullable Firmware motor;
|
|
||||||
// note: in old JSON batteryKind was a string but now it's a number; fortunately GSON string accepts either
|
|
||||||
public @Nullable String batteryKind;
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return new String(Base64.getDecoder().decode(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public BatteryKind getBatteryKind() {
|
|
||||||
return BatteryKind.fromString(batteryKind);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,10 +25,9 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents;
|
import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent;
|
|
||||||
import org.openhab.core.library.CoreItemFactory;
|
import org.openhab.core.library.CoreItemFactory;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
@ -193,10 +192,10 @@ public class AutomationChannelBuilder extends BaseChannelBuilder {
|
|||||||
String timeString, daysString;
|
String timeString, daysString;
|
||||||
|
|
||||||
switch (scheduledEvent.eventType) {
|
switch (scheduledEvent.eventType) {
|
||||||
case ScheduledEvents.SCHEDULED_EVENT_TYPE_TIME:
|
case ScheduledEvent.SCHEDULED_EVENT_TYPE_TIME:
|
||||||
timeString = LocalTime.of(scheduledEvent.hour, scheduledEvent.minute).toString();
|
timeString = LocalTime.of(scheduledEvent.hour, scheduledEvent.minute).toString();
|
||||||
break;
|
break;
|
||||||
case ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE:
|
case ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE:
|
||||||
if (scheduledEvent.minute == 0) {
|
if (scheduledEvent.minute == 0) {
|
||||||
timeString = translationProvider.getText("dynamic-channel.automation.at-sunrise");
|
timeString = translationProvider.getText("dynamic-channel.automation.at-sunrise");
|
||||||
} else if (scheduledEvent.minute < 0) {
|
} else if (scheduledEvent.minute < 0) {
|
||||||
@ -207,7 +206,7 @@ public class AutomationChannelBuilder extends BaseChannelBuilder {
|
|||||||
getFormattedTimeOffset(scheduledEvent.minute));
|
getFormattedTimeOffset(scheduledEvent.minute));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET:
|
case ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET:
|
||||||
if (scheduledEvent.minute == 0) {
|
if (scheduledEvent.minute == 0) {
|
||||||
timeString = translationProvider.getText("dynamic-channel.automation.at-sunset");
|
timeString = translationProvider.getText("dynamic-channel.automation.at-sunset");
|
||||||
} else if (scheduledEvent.minute < 0) {
|
} else if (scheduledEvent.minute < 0) {
|
||||||
@ -225,9 +224,9 @@ public class AutomationChannelBuilder extends BaseChannelBuilder {
|
|||||||
EnumSet<DayOfWeek> days = scheduledEvent.getDays();
|
EnumSet<DayOfWeek> days = scheduledEvent.getDays();
|
||||||
if (EnumSet.allOf(DayOfWeek.class).equals(days)) {
|
if (EnumSet.allOf(DayOfWeek.class).equals(days)) {
|
||||||
daysString = translationProvider.getText("dynamic-channel.automation.all-days");
|
daysString = translationProvider.getText("dynamic-channel.automation.all-days");
|
||||||
} else if (ScheduledEvents.WEEKDAYS.equals(days)) {
|
} else if (ScheduledEvent.WEEKDAYS.equals(days)) {
|
||||||
daysString = translationProvider.getText("dynamic-channel.automation.weekdays");
|
daysString = translationProvider.getText("dynamic-channel.automation.weekdays");
|
||||||
} else if (ScheduledEvents.WEEKENDS.equals(days)) {
|
} else if (ScheduledEvent.WEEKENDS.equals(days)) {
|
||||||
daysString = translationProvider.getText("dynamic-channel.automation.weekends");
|
daysString = translationProvider.getText("dynamic-channel.automation.weekends");
|
||||||
} else {
|
} else {
|
||||||
StringJoiner joiner = new StringJoiner(", ");
|
StringJoiner joiner = new StringJoiner(", ");
|
||||||
|
@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
import org.openhab.core.library.CoreItemFactory;
|
import org.openhab.core.library.CoreItemFactory;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
|
@ -18,7 +18,7 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
import org.openhab.core.library.CoreItemFactory;
|
import org.openhab.core.library.CoreItemFactory;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
|
@ -19,8 +19,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.handler.HDPowerViewHubHandler;
|
import org.openhab.binding.hdpowerview.internal.handler.HDPowerViewHubHandler;
|
||||||
import org.openhab.core.io.console.Console;
|
import org.openhab.core.io.console.Console;
|
||||||
|
@ -21,13 +21,13 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration;
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shades;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.core.library.types.HSBType;
|
import org.openhab.core.library.types.HSBType;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -0,0 +1,73 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of a single Scene, as returned by an HD PowerView Hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class Scene implements Comparable<Scene> {
|
||||||
|
public int id;
|
||||||
|
public @Nullable String name;
|
||||||
|
public int roomId;
|
||||||
|
public int order;
|
||||||
|
public int colorId;
|
||||||
|
public int iconId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object o) {
|
||||||
|
if (o == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof Scene)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Scene other = (Scene) o;
|
||||||
|
|
||||||
|
return this.id == other.id && Objects.equals(name, other.name) && this.roomId == other.roomId
|
||||||
|
&& this.order == other.order && this.colorId == other.colorId && this.iconId == other.iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
String name = this.name;
|
||||||
|
result = prime * result + id;
|
||||||
|
result = prime * result + (name == null ? 0 : name.hashCode());
|
||||||
|
result = prime * result + roomId;
|
||||||
|
result = prime * result + order;
|
||||||
|
result = prime * result + colorId;
|
||||||
|
result = prime * result + iconId;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Scene other) {
|
||||||
|
return Integer.compare(order, other.order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of a single Scene Collection, as returned by an HD PowerView Hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class SceneCollection implements Comparable<SceneCollection> {
|
||||||
|
public int id;
|
||||||
|
public @Nullable String name;
|
||||||
|
public int order;
|
||||||
|
public int colorId;
|
||||||
|
public int iconId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object o) {
|
||||||
|
if (o == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof SceneCollection)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SceneCollection other = (SceneCollection) o;
|
||||||
|
|
||||||
|
return this.id == other.id && Objects.equals(name, other.name) && this.order == other.order
|
||||||
|
&& this.colorId == other.colorId && this.iconId == other.iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
String name = this.name;
|
||||||
|
result = prime * result + id;
|
||||||
|
result = prime * result + (name == null ? 0 : name.hashCode());
|
||||||
|
result = prime * result + order;
|
||||||
|
result = prime * result + colorId;
|
||||||
|
result = prime * result + iconId;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(SceneCollection other) {
|
||||||
|
return Integer.compare(order, other.order);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return new String(Base64.getDecoder().decode(name), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto;
|
||||||
|
|
||||||
|
import java.time.DayOfWeek;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of a single Scheduled Event, as returned by an HD PowerView Hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class ScheduledEvent {
|
||||||
|
public static final EnumSet<DayOfWeek> WEEKDAYS = EnumSet.of(DayOfWeek.MONDAY, DayOfWeek.TUESDAY,
|
||||||
|
DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY);
|
||||||
|
|
||||||
|
public static final EnumSet<DayOfWeek> WEEKENDS = EnumSet.of(DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
|
||||||
|
|
||||||
|
public static final int SCHEDULED_EVENT_TYPE_TIME = 0;
|
||||||
|
public static final int SCHEDULED_EVENT_TYPE_SUNRISE = 1;
|
||||||
|
public static final int SCHEDULED_EVENT_TYPE_SUNSET = 2;
|
||||||
|
|
||||||
|
public int id;
|
||||||
|
public boolean enabled;
|
||||||
|
public int sceneId;
|
||||||
|
public int sceneCollectionId;
|
||||||
|
public boolean daySunday;
|
||||||
|
public boolean dayMonday;
|
||||||
|
public boolean dayTuesday;
|
||||||
|
public boolean dayWednesday;
|
||||||
|
public boolean dayThursday;
|
||||||
|
public boolean dayFriday;
|
||||||
|
public boolean daySaturday;
|
||||||
|
public int eventType;
|
||||||
|
public int hour;
|
||||||
|
public int minute;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object o) {
|
||||||
|
if (o == this) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof ScheduledEvent)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ScheduledEvent other = (ScheduledEvent) o;
|
||||||
|
|
||||||
|
return this.id == other.id && this.enabled == other.enabled && this.sceneId == other.sceneId
|
||||||
|
&& this.sceneCollectionId == other.sceneCollectionId && this.daySunday == other.daySunday
|
||||||
|
&& this.dayMonday == other.dayMonday && this.dayTuesday == other.dayTuesday
|
||||||
|
&& this.dayWednesday == other.dayWednesday && this.dayThursday == other.dayThursday
|
||||||
|
&& this.dayFriday == other.dayFriday && this.daySaturday == other.daySaturday
|
||||||
|
&& this.eventType == other.eventType && this.hour == other.hour && this.minute == other.minute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + id;
|
||||||
|
result = prime * result + (enabled ? 1 : 0);
|
||||||
|
result = prime * result + sceneId;
|
||||||
|
result = prime * result + sceneCollectionId;
|
||||||
|
result = prime * result + (daySunday ? 1 : 0);
|
||||||
|
result = prime * result + (dayMonday ? 1 : 0);
|
||||||
|
result = prime * result + (dayTuesday ? 1 : 0);
|
||||||
|
result = prime * result + (dayWednesday ? 1 : 0);
|
||||||
|
result = prime * result + (dayThursday ? 1 : 0);
|
||||||
|
result = prime * result + (dayFriday ? 1 : 0);
|
||||||
|
result = prime * result + (daySaturday ? 1 : 0);
|
||||||
|
result = prime * result + eventType;
|
||||||
|
result = prime * result + hour;
|
||||||
|
result = prime * result + minute;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumSet<DayOfWeek> getDays() {
|
||||||
|
EnumSet<DayOfWeek> days = EnumSet.noneOf(DayOfWeek.class);
|
||||||
|
if (daySunday) {
|
||||||
|
days.add(DayOfWeek.SUNDAY);
|
||||||
|
}
|
||||||
|
if (dayMonday) {
|
||||||
|
days.add(DayOfWeek.MONDAY);
|
||||||
|
}
|
||||||
|
if (dayTuesday) {
|
||||||
|
days.add(DayOfWeek.TUESDAY);
|
||||||
|
}
|
||||||
|
if (dayWednesday) {
|
||||||
|
days.add(DayOfWeek.WEDNESDAY);
|
||||||
|
}
|
||||||
|
if (dayThursday) {
|
||||||
|
days.add(DayOfWeek.THURSDAY);
|
||||||
|
}
|
||||||
|
if (dayFriday) {
|
||||||
|
days.add(DayOfWeek.FRIDAY);
|
||||||
|
}
|
||||||
|
if (daySaturday) {
|
||||||
|
days.add(DayOfWeek.SATURDAY);
|
||||||
|
}
|
||||||
|
return days;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shade data for a single Shade, as returned by an HD PowerView hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class ShadeData {
|
||||||
|
public int id;
|
||||||
|
public @Nullable String name;
|
||||||
|
public int roomId;
|
||||||
|
public int groupId;
|
||||||
|
public int order;
|
||||||
|
public int type;
|
||||||
|
public double batteryStrength;
|
||||||
|
public int batteryStatus;
|
||||||
|
public boolean batteryIsLow;
|
||||||
|
public @Nullable ShadePosition positions;
|
||||||
|
public @Nullable Boolean timedOut;
|
||||||
|
public int signalStrength;
|
||||||
|
public @Nullable Integer capabilities;
|
||||||
|
public @Nullable Firmware firmware;
|
||||||
|
public @Nullable Firmware motor;
|
||||||
|
// note: in old JSON batteryKind was a string but now it's a number; fortunately GSON string accepts either
|
||||||
|
public @Nullable String batteryKind;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return new String(Base64.getDecoder().decode(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
public BatteryKind getBatteryKind() {
|
||||||
|
return BatteryKind.fromString(batteryKind);
|
||||||
|
}
|
||||||
|
}
|
@ -10,9 +10,9 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*;
|
import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api;
|
package org.openhab.binding.hdpowerview.internal.dto;
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,10 +10,10 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Color;
|
import org.openhab.binding.hdpowerview.internal.dto.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color state of a single Repeater for being updated by an HD PowerView Hub
|
* Color state of a single Repeater for being updated by an HD PowerView Hub
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,10 +10,10 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A request to set the position of a shade
|
* A request to set the position of a shade
|
@ -10,10 +10,10 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The position of a shade to set
|
* The position of a shade to set
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.requests;
|
package org.openhab.binding.hdpowerview.internal.dto.requests;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
|
@ -10,11 +10,11 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.HubFirmware;
|
import org.openhab.binding.hdpowerview.internal.dto.HubFirmware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Firmware information for an HD PowerView hub
|
* Firmware information for an HD PowerView hub
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
@ -10,14 +10,14 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Color;
|
import org.openhab.binding.hdpowerview.internal.dto.Color;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Firmware;
|
import org.openhab.binding.hdpowerview.internal.dto.Firmware;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repeater data for a single Repeater, as returned by an HD PowerView Hub
|
* Repeater data for a single Repeater, as returned by an HD PowerView Hub
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of all Scene Collections in an HD PowerView hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class SceneCollections {
|
||||||
|
public @Nullable List<SceneCollection> sceneCollectionData;
|
||||||
|
public @Nullable List<Integer> sceneCollectionIds;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of all Scenes in an HD PowerView hub
|
||||||
|
*
|
||||||
|
* @author Andy Lintner - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class Scenes {
|
||||||
|
public @Nullable List<Scene> sceneData;
|
||||||
|
public @Nullable List<Integer> sceneIds;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of all Scheduled Events in an HD PowerView hub
|
||||||
|
*
|
||||||
|
* @author Jacob Laursen - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class ScheduledEvents {
|
||||||
|
public @Nullable List<ScheduledEvent> scheduledEventData;
|
||||||
|
public @Nullable List<Integer> scheduledEventIds;
|
||||||
|
}
|
@ -10,11 +10,11 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State of a single Shade, as returned by an HD PowerView hub
|
* State of a single Shade, as returned by an HD PowerView hub
|
||||||
@ -23,6 +23,5 @@ import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
public class Shade {
|
public class Shade {
|
||||||
|
|
||||||
public @Nullable ShadeData shade;
|
public @Nullable ShadeData shade;
|
||||||
}
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2022 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.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State of all Shades, as returned by an HD PowerView hub
|
||||||
|
*
|
||||||
|
* @author Andy Lintner - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class Shades {
|
||||||
|
public @Nullable List<ShadeData> shadeData;
|
||||||
|
public @Nullable List<Integer> shadeIds;
|
||||||
|
}
|
@ -10,13 +10,13 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.SurveyData;
|
import org.openhab.binding.hdpowerview.internal.dto.SurveyData;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
@ -10,11 +10,11 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.internal.api.responses;
|
package org.openhab.binding.hdpowerview.internal.dto.responses;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.UserData;
|
import org.openhab.binding.hdpowerview.internal.dto.UserData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Response with {@link UserData} for an HD PowerView hub
|
* Response with {@link UserData} for an HD PowerView hub
|
@ -30,22 +30,22 @@ import org.eclipse.jetty.client.HttpClient;
|
|||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Firmware;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.HubFirmware;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.UserData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewHubConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewHubConfiguration;
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Firmware;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.HubFirmware;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.UserData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.ScheduledEvents;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shades;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
|
@ -20,10 +20,10 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Color;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Firmware;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.RepeaterData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewRepeaterConfiguration;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Color;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Firmware;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.RepeaterData;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
package org.openhab.binding.hdpowerview.internal.handler;
|
package org.openhab.binding.hdpowerview.internal.handler;
|
||||||
|
|
||||||
import static org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants.*;
|
import static org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants.*;
|
||||||
import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*;
|
import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -29,15 +29,15 @@ import org.eclipse.jdt.annotation.NonNullByDefault;
|
|||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.BatteryKind;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.CoordinateSystem;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.Firmware;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.SurveyData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
import org.openhab.binding.hdpowerview.internal.config.HDPowerViewShadeConfiguration;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.BatteryKind;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Firmware;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.SurveyData;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubInvalidResponseException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@ -22,15 +22,12 @@ import java.util.List;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents.ScheduledEvent;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.AutomationChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider;
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ScheduledEvent;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
import org.openhab.core.thing.ThingUID;
|
import org.openhab.core.thing.ThingUID;
|
||||||
@ -78,7 +75,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneSunriseWeekends() {
|
public void sceneSunriseWeekends() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
scheduledEvent.daySaturday = true;
|
scheduledEvent.daySaturday = true;
|
||||||
scheduledEvent.daySunday = true;
|
scheduledEvent.daySunday = true;
|
||||||
|
|
||||||
@ -91,7 +88,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneSunsetWeekdays() {
|
public void sceneSunsetWeekdays() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET);
|
||||||
scheduledEvent.dayMonday = true;
|
scheduledEvent.dayMonday = true;
|
||||||
scheduledEvent.dayTuesday = true;
|
scheduledEvent.dayTuesday = true;
|
||||||
scheduledEvent.dayWednesday = true;
|
scheduledEvent.dayWednesday = true;
|
||||||
@ -107,7 +104,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneTimeAllDays() {
|
public void sceneTimeAllDays() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_TIME);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_TIME);
|
||||||
scheduledEvent.dayMonday = true;
|
scheduledEvent.dayMonday = true;
|
||||||
scheduledEvent.dayTuesday = true;
|
scheduledEvent.dayTuesday = true;
|
||||||
scheduledEvent.dayWednesday = true;
|
scheduledEvent.dayWednesday = true;
|
||||||
@ -127,7 +124,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneMinutesBeforeSunriseMondayTuesday() {
|
public void sceneMinutesBeforeSunriseMondayTuesday() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
scheduledEvent.dayMonday = true;
|
scheduledEvent.dayMonday = true;
|
||||||
scheduledEvent.dayTuesday = true;
|
scheduledEvent.dayTuesday = true;
|
||||||
scheduledEvent.minute = -15;
|
scheduledEvent.minute = -15;
|
||||||
@ -141,7 +138,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneHoursMinutesAfterSunriseMonday() {
|
public void sceneHoursMinutesAfterSunriseMonday() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
scheduledEvent.dayMonday = true;
|
scheduledEvent.dayMonday = true;
|
||||||
scheduledEvent.minute = 61;
|
scheduledEvent.minute = 61;
|
||||||
|
|
||||||
@ -154,7 +151,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneMinutesBeforeSunsetWednesdayThursdayFriday() {
|
public void sceneMinutesBeforeSunsetWednesdayThursdayFriday() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET);
|
||||||
scheduledEvent.dayWednesday = true;
|
scheduledEvent.dayWednesday = true;
|
||||||
scheduledEvent.dayThursday = true;
|
scheduledEvent.dayThursday = true;
|
||||||
scheduledEvent.dayFriday = true;
|
scheduledEvent.dayFriday = true;
|
||||||
@ -169,7 +166,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void sceneHourAfterSunsetFridaySaturdaySunday() {
|
public void sceneHourAfterSunsetFridaySaturdaySunday() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNSET);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNSET);
|
||||||
scheduledEvent.dayFriday = true;
|
scheduledEvent.dayFriday = true;
|
||||||
scheduledEvent.daySaturday = true;
|
scheduledEvent.daySaturday = true;
|
||||||
scheduledEvent.daySunday = true;
|
scheduledEvent.daySunday = true;
|
||||||
@ -185,7 +182,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void sceneCollection() {
|
public void sceneCollection() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection(
|
ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection(
|
||||||
ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
|
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
List<Channel> channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents)
|
List<Channel> channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents)
|
||||||
@ -197,7 +194,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void suppliedListIsUsed() {
|
public void suppliedListIsUsed() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
List<Channel> existingChannels = new ArrayList<>(0);
|
List<Channel> existingChannels = new ArrayList<>(0);
|
||||||
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents)
|
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents)
|
||||||
@ -215,7 +212,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void emptyListWhenNoScenesOrSceneCollections() {
|
public void emptyListWhenNoScenesOrSceneCollections() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
List<Channel> channels = builder.withScheduledEvents(scheduledEvents).build();
|
List<Channel> channels = builder.withScheduledEvents(scheduledEvents).build();
|
||||||
|
|
||||||
@ -225,7 +222,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void emptyListWhenNoSceneForScheduledEvent() {
|
public void emptyListWhenNoSceneForScheduledEvent() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection(
|
ScheduledEvent scheduledEvent = createScheduledEventWithSceneCollection(
|
||||||
ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build();
|
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build();
|
||||||
|
|
||||||
@ -234,7 +231,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void emptyListWhenNoSceneCollectionForScheduledEvent() {
|
public void emptyListWhenNoSceneCollectionForScheduledEvent() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
|
|
||||||
List<Channel> channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents)
|
List<Channel> channels = builder.withSceneCollections(sceneCollections).withScheduledEvents(scheduledEvents)
|
||||||
@ -245,7 +242,7 @@ public class AutomationChannelBuilderTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void groupAndIdAreCorrect() {
|
public void groupAndIdAreCorrect() {
|
||||||
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvents.SCHEDULED_EVENT_TYPE_SUNRISE);
|
ScheduledEvent scheduledEvent = createScheduledEventWithScene(ScheduledEvent.SCHEDULED_EVENT_TYPE_SUNRISE);
|
||||||
scheduledEvent.id = 42;
|
scheduledEvent.id = 42;
|
||||||
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
List<ScheduledEvent> scheduledEvents = new ArrayList<>(List.of(scheduledEvent));
|
||||||
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build();
|
List<Channel> channels = builder.withScenes(scenes).withScheduledEvents(scheduledEvents).build();
|
@ -10,10 +10,10 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*;
|
import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@ -23,16 +23,16 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.BatteryKind;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.BatteryKind;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.SceneCollections;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shades;
|
||||||
import org.openhab.core.library.types.PercentType;
|
import org.openhab.core.library.types.PercentType;
|
||||||
import org.openhab.core.types.State;
|
import org.openhab.core.types.State;
|
||||||
import org.openhab.core.types.UnDefType;
|
import org.openhab.core.types.UnDefType;
|
@ -10,10 +10,10 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*;
|
import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -21,14 +21,13 @@ import java.util.regex.Pattern;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jetty.client.HttpClient;
|
import org.eclipse.jetty.client.HttpClient;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Shades.ShadeData;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadeData;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Scenes;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.responses.Shades;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubMaintenanceException;
|
||||||
import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException;
|
import org.openhab.binding.hdpowerview.internal.exceptions.HubProcessingException;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@ -22,12 +22,10 @@ import java.util.List;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.Scenes.Scene;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.SceneChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider;
|
import org.openhab.binding.hdpowerview.internal.dto.Scene;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
import org.openhab.core.thing.ThingUID;
|
import org.openhab.core.thing.ThingUID;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
@ -22,12 +22,10 @@ import java.util.List;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewBindingConstants;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.HDPowerViewTranslationProvider;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder;
|
import org.openhab.binding.hdpowerview.internal.builders.SceneGroupChannelBuilder;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedLocaleProvider;
|
import org.openhab.binding.hdpowerview.internal.dto.SceneCollection;
|
||||||
import org.openhab.binding.hdpowerview.providers.MockedTranslationProvider;
|
import org.openhab.binding.hdpowerview.internal.providers.MockedLocaleProvider;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.providers.MockedTranslationProvider;
|
||||||
import org.openhab.core.thing.Channel;
|
import org.openhab.core.thing.Channel;
|
||||||
import org.openhab.core.thing.ChannelGroupUID;
|
import org.openhab.core.thing.ChannelGroupUID;
|
||||||
import org.openhab.core.thing.ThingUID;
|
import org.openhab.core.thing.ThingUID;
|
@ -10,16 +10,16 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview;
|
package org.openhab.binding.hdpowerview.internal;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
import static org.openhab.binding.hdpowerview.internal.api.CoordinateSystem.*;
|
import static org.openhab.binding.hdpowerview.internal.dto.CoordinateSystem.*;
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
|
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase;
|
||||||
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
import org.openhab.binding.hdpowerview.internal.database.ShadeCapabilitiesDatabase.Capabilities;
|
||||||
|
import org.openhab.binding.hdpowerview.internal.dto.ShadePosition;
|
||||||
import org.openhab.core.library.types.PercentType;
|
import org.openhab.core.library.types.PercentType;
|
||||||
import org.openhab.core.types.State;
|
import org.openhab.core.types.State;
|
||||||
import org.openhab.core.types.UnDefType;
|
import org.openhab.core.types.UnDefType;
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.providers;
|
package org.openhab.binding.hdpowerview.internal.providers;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* SPDX-License-Identifier: EPL-2.0
|
* SPDX-License-Identifier: EPL-2.0
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.hdpowerview.providers;
|
package org.openhab.binding.hdpowerview.internal.providers;
|
||||||
|
|
||||||
import static java.util.Map.entry;
|
import static java.util.Map.entry;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user