diff --git a/CODEOWNERS b/CODEOWNERS index 58bf402a9a6c0..1235d7f6a04d6 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,7 +2,7 @@ # It should always list the active maintainers of certain add-ons. # As a fallback, if no specific maintainer is listed below, assign the PR to the repo maintainers team: -* @openhab/2-x-add-ons-maintainers +* @openhab/add-ons-maintainers # Add-on maintainers: /bundles/org.openhab.binding.adorne/ @theiding @@ -41,10 +41,12 @@ /bundles/org.openhab.binding.doorbird/ @mhilbush /bundles/org.openhab.binding.dscalarm/ @RSStephens /bundles/org.openhab.binding.dsmr/ @Hilbrand +/bundles/org.openhab.binding.dwdpollenflug/ @DerOetzi /bundles/org.openhab.binding.dwdunwetter/ @limdul79 /bundles/org.openhab.binding.elerotransmitterstick/ @vbier /bundles/org.openhab.binding.enocean/ @fruggy83 /bundles/org.openhab.binding.enturno/ @klocsson +/bundles/org.openhab.binding.etherrain/ @dfad1469 /bundles/org.openhab.binding.evohome/ @Nebula83 /bundles/org.openhab.binding.exec/ @kgoderis /bundles/org.openhab.binding.feed/ @svilenvul @@ -154,6 +156,7 @@ /bundles/org.openhab.binding.rotel/ @lolodomo /bundles/org.openhab.binding.rotelra1x/ @fa2k /bundles/org.openhab.binding.russound/ @tmrobert8 +/bundles/org.openhab.binding.sagercaster/ @clinique /bundles/org.openhab.binding.samsungtv/ @paulianttila /bundles/org.openhab.binding.satel/ @druciak /bundles/org.openhab.binding.seneye/ @nikotanghe @@ -216,15 +219,15 @@ /bundles/org.openhab.io.transport.modbus/ @ssalonen /bundles/org.openhab.io.webaudio/ @kaikreuzer /bundles/org.openhab.persistence.mapdb/ @mkhl -/bundles/org.openhab.transform.exec/ @openhab/2-x-add-ons-maintainers -/bundles/org.openhab.transform.javascript/ @openhab/2-x-add-ons-maintainers +/bundles/org.openhab.transform.exec/ @openhab/add-ons-maintainers +/bundles/org.openhab.transform.javascript/ @openhab/add-ons-maintainers /bundles/org.openhab.transform.jinja/ @jochen314 /bundles/org.openhab.transform.jsonpath/ @clinique -/bundles/org.openhab.transform.map/ @openhab/2-x-add-ons-maintainers -/bundles/org.openhab.transform.regex/ @openhab/2-x-add-ons-maintainers +/bundles/org.openhab.transform.map/ @openhab/add-ons-maintainers +/bundles/org.openhab.transform.regex/ @openhab/add-ons-maintainers /bundles/org.openhab.transform.scale/ @clinique -/bundles/org.openhab.transform.xpath/ @openhab/2-x-add-ons-maintainers -/bundles/org.openhab.transform.xslt/ @openhab/2-x-add-ons-maintainers +/bundles/org.openhab.transform.xpath/ @openhab/add-ons-maintainers +/bundles/org.openhab.transform.xslt/ @openhab/add-ons-maintainers /bundles/org.openhab.voice.googletts/ @gbicskei /bundles/org.openhab.voice.mactts/ @kaikreuzer /bundles/org.openhab.voice.marytts/ @kaikreuzer diff --git a/bom/openhab-addons/pom.xml b/bom/openhab-addons/pom.xml index 00421d5781da4..c45ec6f489247 100644 --- a/bom/openhab-addons/pom.xml +++ b/bom/openhab-addons/pom.xml @@ -194,6 +194,11 @@ org.openhab.binding.dsmr ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.dwdpollenflug + ${project.version} + org.openhab.addons.bundles org.openhab.binding.dwdunwetter @@ -214,6 +219,11 @@ org.openhab.binding.enturno ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.etherrain + ${project.version} + org.openhab.addons.bundles org.openhab.binding.evohome @@ -764,6 +774,11 @@ org.openhab.binding.russound ${project.version} + + org.openhab.addons.bundles + org.openhab.binding.sagercaster + ${project.version} + org.openhab.addons.bundles org.openhab.binding.samsungtv diff --git a/bundles/org.openhab.binding.adorne/.classpath b/bundles/org.openhab.binding.adorne/.classpath index a5d95095ccaaf..1a0c5608f3440 100644 --- a/bundles/org.openhab.binding.adorne/.classpath +++ b/bundles/org.openhab.binding.adorne/.classpath @@ -28,5 +28,11 @@ + + + + + + diff --git a/bundles/org.openhab.binding.adorne/README.md b/bundles/org.openhab.binding.adorne/README.md index 73ea0990675d7..89c98c94d3313 100644 --- a/bundles/org.openhab.binding.adorne/README.md +++ b/bundles/org.openhab.binding.adorne/README.md @@ -110,4 +110,4 @@ sitemap demo label="Adorne Binding Demo" Setpoint item=LightBedroomDimmer2 label="Bedroom 2" icon="light-on" minValue=1 maxValue=100 step=5 } } -``` \ No newline at end of file +``` diff --git a/bundles/org.openhab.binding.adorne/src/main/java/org/openhab/binding/adorne/internal/hub/AdorneHubController.java b/bundles/org.openhab.binding.adorne/src/main/java/org/openhab/binding/adorne/internal/hub/AdorneHubController.java index 3be3616284c80..e211425872188 100644 --- a/bundles/org.openhab.binding.adorne/src/main/java/org/openhab/binding/adorne/internal/hub/AdorneHubController.java +++ b/bundles/org.openhab.binding.adorne/src/main/java/org/openhab/binding/adorne/internal/hub/AdorneHubController.java @@ -333,7 +333,6 @@ private void msgLoop() { cancelCommands(); hubControllerConnected.cancel(false); logger.info("Exiting hub controller"); - } private boolean shouldStop() { diff --git a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java index 472d4dbfa72db..10af8f9eabd97 100644 --- a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java +++ b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/handler/AirQualityHandler.java @@ -23,9 +23,6 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import javax.measure.quantity.Pressure; -import javax.measure.quantity.Temperature; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.eclipse.smarthome.core.library.types.DateTimeType; @@ -265,7 +262,6 @@ private AirQualityJsonResponse getAirQualityData() { errorMsg = "missing data sub-object"; logger.warn("Error in aqicn.org (Air Quality) response: {}", errorMsg); } - } catch (MalformedURLException e) { errorMsg = e.getMessage(); logger.warn("Constructed url is not valid: {}", errorMsg); @@ -300,7 +296,7 @@ public static Object getValue(String channelId, AirQualityJsonResponse data) thr case CO: return data.getData().getIaqi().getCo(); case SO2: - return data.getData().getIaqi().getSo2(); + return data.getData().getIaqi().getSo2(); case LOCATIONNAME: return data.getData().getCity().getName(); case STATIONID: @@ -310,9 +306,9 @@ public static Object getValue(String channelId, AirQualityJsonResponse data) thr case OBSERVATIONTIME: return data.getData().getTime().getObservationTime(); case TEMPERATURE: - return new QuantityType(data.getData().getIaqi().getT(), API_TEMPERATURE_UNIT); + return new QuantityType<>(data.getData().getIaqi().getT(), API_TEMPERATURE_UNIT); case PRESSURE: - return new QuantityType(data.getData().getIaqi().getP(), API_PRESSURE_UNIT); + return new QuantityType<>(data.getData().getIaqi().getP(), API_PRESSURE_UNIT); case HUMIDITY: return new QuantityType<>(data.getData().getIaqi().getH(), API_HUMIDITY_UNIT); case DOMINENTPOL: diff --git a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonCity.java b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonCity.java index 99506931fb57e..ec595de9212f8 100644 --- a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonCity.java +++ b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonCity.java @@ -39,7 +39,7 @@ public String getUrl() { } public String getGeo() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < geo.size(); i++) { list.add(geo.get(i).toString()); } diff --git a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonData.java b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonData.java index f5274840bb47e..ef4ff8e22fd90 100644 --- a/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonData.java +++ b/bundles/org.openhab.binding.airquality/src/main/java/org/openhab/binding/airquality/internal/json/AirQualityJsonData.java @@ -87,7 +87,7 @@ public AirQualityJsonCity getCity() { * @return {String} */ public String getAttributions() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < attributions.size(); i++) { list.add(attributions.get(i).getName()); } diff --git a/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayBindingProperties.java b/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayBindingProperties.java index b825c80f59d2f..4d20375dae0a6 100644 --- a/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayBindingProperties.java +++ b/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayBindingProperties.java @@ -40,7 +40,6 @@ public class AllPlayBindingProperties { private static final String ZONE_MEMBER_SEPARATOR_DEFAULT_VALUE = ","; public AllPlayBindingProperties(Dictionary properties) { - rewindSkipTimeInSec = getIntegerProperty(properties, REWIND_SKIP_TIME_PROPERTY, REWIND_SKIP_TIME_DEFAULT_VALUE); fastForwardSkipTimeInSec = getIntegerProperty(properties, FAST_FORWARD_SKIP_TIME_PROPERTY, FAST_FORWARD_SKIP_TIME_DEFAULT_VALUE); diff --git a/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayHandlerFactory.java b/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayHandlerFactory.java index 1d533b842bfe3..62938017785e1 100644 --- a/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayHandlerFactory.java +++ b/bundles/org.openhab.binding.allplay/src/main/java/org/openhab/binding/allplay/internal/AllPlayHandlerFactory.java @@ -99,7 +99,7 @@ private void registerAudioSink(Thing thing, AllPlayHandler handler) { AllPlayAudioSink audioSink = new AllPlayAudioSink(handler, audioHTTPServer, callbackUrl); @SuppressWarnings("unchecked") ServiceRegistration reg = (ServiceRegistration) bundleContext - .registerService(AudioSink.class.getName(), audioSink, new Hashtable()); + .registerService(AudioSink.class.getName(), audioSink, new Hashtable<>()); audioSinkRegistrations.put(thing.getUID().toString(), reg); } diff --git a/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.core.resources.prefs b/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index abdea9ac032d4..0000000000000 --- a/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding/=UTF-8 diff --git a/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.m2e.core.prefs b/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb238..0000000000000 --- a/bundles/org.openhab.binding.amazondashbutton/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java index c9cbec6a130ab..41d4bceae4255 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/AccountServlet.java @@ -247,7 +247,6 @@ protected void doGet(@Nullable HttpServletRequest req, @Nullable HttpServletResp try { Connection connection = this.connectionToInitialize; if (uri.startsWith(FORWARD_URI_PART) && connection != null) { - String getUrl = "https://www." + connection.getAmazonSite() + "/" + uri.substring(FORWARD_URI_PART.length()); @@ -271,7 +270,6 @@ protected void doGet(@Nullable HttpServletRequest req, @Nullable HttpServletResp } if (connection != null && connection.verifyLogin()) { - // handle commands if (baseUrl.equals("/logout") || baseUrl.equals("/logout/")) { this.connectionToInitialize = reCreateConnection(); @@ -633,7 +631,6 @@ void handleProxyRequest(Connection connection, HttpServletResponse resp, String { String location = urlConnection.getHeaderField("location"); if (location.contains("/ap/maplanding")) { - try { connection.registerConnectionAsApp(location); account.setConnection(connection); @@ -646,7 +643,6 @@ void handleProxyRequest(Connection connection, HttpServletResponse resp, String this.connectionToInitialize = null; return; } - } String startString = "https://www." + connection.getAmazonSite() + "/"; diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/Connection.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/Connection.java index 7f8ed58eabb9c..51c1ebfed0371 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/Connection.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/Connection.java @@ -336,7 +336,6 @@ public boolean tryRestoreLogin(@Nullable String data, @Nullable String overloade } catch (IOException e) { return false; } catch (URISyntaxException e) { - } } return false; @@ -539,7 +538,6 @@ public HttpsURLConnection makeRequest(String verb, String url, @Nullable String URI uri = connection.getURL().toURI(); if (customHeaders == null || !customHeaders.containsKey("Cookie")) { - StringBuilder cookieHeaderBuilder = new StringBuilder(); for (HttpCookie cookie : cookieManager.getCookieStore().get(uri)) { if (cookieHeaderBuilder.length() > 0) { @@ -559,7 +557,6 @@ public HttpsURLConnection makeRequest(String verb, String url, @Nullable String } } if (postData != null) { - logger.debug("{}: {}", verb, postData); // post data byte[] postDataBytes = postData.getBytes(StandardCharsets.UTF_8); @@ -595,7 +592,6 @@ public HttpsURLConnection makeRequest(String verb, String url, @Nullable String // store cookie for (String cookieHeader : header.getValue()) { if (StringUtils.isNotEmpty(cookieHeader)) { - List cookies = HttpCookie.parse(cookieHeader); for (HttpCookie cookie : cookies) { cookieManager.getCookieStore().add(uri, cookie); @@ -646,9 +642,7 @@ public HttpsURLConnection makeRequest(String verb, String url, @Nullable String return connection; } throw new HttpException(code, verb + " url '" + url + "' failed: " + connection.getResponseMessage()); - } catch (IOException e) { - if (connection != null) { connection.disconnect(); } @@ -753,7 +747,6 @@ public String registerConnectionAsApp(String oAutRedirectUrl) } private void exchangeToken() throws IOException, URISyntaxException { - this.renewTime = 0; String cookiesJson = "{\"cookies\":{\"." + getAmazonSite() + "\":[]}}"; String cookiesBase64 = Base64.getEncoder().encodeToString(cookiesJson.getBytes()); diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/WebSocketConnection.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/WebSocketConnection.java index 2ebcc2e842629..ec996bfde5a43 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/WebSocketConnection.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/WebSocketConnection.java @@ -382,7 +382,6 @@ public void onWebSocketBinary(byte @Nullable [] data, int offset, int len) { sendMessage( "0xa6f6a951 0x0000009c {\"protocolName\":\"A:H\",\"parameters\":{\"AlphaProtocolHandler.receiveWindowSize\":\"16\",\"AlphaProtocolHandler.maxFragmentSize\":\"16000\"}}TUNE"); sendMessage(encodeGWHandshake()); - } else if (this.msgCounter == 1) { sendMessage(encodeGWRegister()); sendPing(); @@ -395,7 +394,6 @@ public void onWebSocketBinary(byte @Nullable [] data, int offset, int len) { Message message = parseIncomingMessage(buffer); if (message.service.equals("FABE") && message.content.messageType.equals("PON") && message.content.payloadData.length > 0) { - logger.debug("Pong received"); WebSocketConnection.this.clearPongTimeoutTimer(); return; @@ -416,7 +414,6 @@ public void onWebSocketBinary(byte @Nullable [] data, int offset, int len) { @Override public void onWebSocketText(@Nullable String message) { - } @Override @@ -464,7 +461,6 @@ long computeBits(long input, long len) { } long toUnsignedInt(long value) { - long result = value; if (0 > value) { result = 4294967295L + value + 1; @@ -559,7 +555,6 @@ void encode(byte[] data, long b, int offset, int len) { } byte[] encodePing() { - // MSG 0x00000065 0x0e414e47 f 0x00000001 0xbc2fbb5f 0x00000062 PIN� ��� ��RegularFABE this.messageId++; String msg = "MSG 0x00000065 "; // Message-type and Channel = CHANNEL_FOR_HEARTBEAT; diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/channelhandler/ChannelHandlerAnnouncement.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/channelhandler/ChannelHandlerAnnouncement.java index 2464c2e3cb068..89af22d404a7f 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/channelhandler/ChannelHandlerAnnouncement.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/channelhandler/ChannelHandlerAnnouncement.java @@ -66,10 +66,10 @@ public boolean tryHandleCommand(Device device, Connection connection, String cha } Boolean sound = request.sound; if (sound != null) { - if (sound == false && !speak.startsWith("")) { + if (!sound && !speak.startsWith("")) { speak = "" + StringEscapeUtils.escapeXml(speak) + ""; } - if (sound == true && speak.startsWith("")) { + if (sound && speak.startsWith("")) { body = "Error: The combination of sound and speak in SSML syntax is not allowed"; title = "Error"; speak = "Error: The combination of sound and speak in SSML syntax is not allowed"; diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/discovery/AmazonEchoDiscovery.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/discovery/AmazonEchoDiscovery.java index 0cb44a44a5588..6b8a34a24344e 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/discovery/AmazonEchoDiscovery.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/discovery/AmazonEchoDiscovery.java @@ -194,7 +194,6 @@ public synchronized void discoverFlashBriefingProfiles(String currentFlashBriefi } if (!discoverdFlashBriefings.contains(currentFlashBriefingJson)) { - ThingUID freeThingUID = null; int freeIndex = 0; for (int i = 1; i < 1000; i++) { diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/AccountHandler.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/AccountHandler.java index b4482c4024ed3..5f70a4216f7e1 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/AccountHandler.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/AccountHandler.java @@ -315,7 +315,6 @@ private void checkLogin() { setConnection(currentConnection); } } else { - // read session data from property String sessionStore = this.stateStorage.get("sessionStorage"); @@ -582,7 +581,6 @@ private void refreshData() { } public List updateDeviceList() { - Connection currentConnection = connection; if (currentConnection == null) { return new ArrayList<>(); diff --git a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/EchoHandler.java b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/EchoHandler.java index 5867ec69de201..eabce0939a58a 100644 --- a/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/EchoHandler.java +++ b/bundles/org.openhab.binding.amazonechocontrol/src/main/java/org/openhab/binding/amazonechocontrol/internal/handler/EchoHandler.java @@ -12,46 +12,7 @@ */ package org.openhab.binding.amazonechocontrol.internal.handler; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_AMAZON_MUSIC; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_AMAZON_MUSIC_PLAY_LIST_ID; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_AMAZON_MUSIC_TRACK_ID; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_ASCENDING_ALARM; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_BLUETOOTH; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_BLUETOOTH_DEVICE_NAME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_BLUETOOTH_MAC; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_EQUALIZER_BASS; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_EQUALIZER_MIDRANGE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_EQUALIZER_TREBLE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_IMAGE_URL; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_LAST_VOICE_COMMAND; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_MEDIA_LENGTH; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_MEDIA_PROGRESS; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_MEDIA_PROGRESS_TIME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_MUSIC_PROVIDER_ID; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_NEXT_ALARM; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_NEXT_MUSIC_ALARM; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_NEXT_REMINDER; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_NEXT_TIMER; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_NOTIFICATION_VOLUME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_PLAYER; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_PLAY_ALARM_SOUND; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_PLAY_MUSIC_VOICE_COMMAND; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_PLAY_ON_DEVICE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_PROVIDER_DISPLAY_NAME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_RADIO; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_RADIO_STATION_ID; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_REMIND; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_SHUFFLE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_START_COMMAND; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_START_ROUTINE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_SUBTITLE1; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_SUBTITLE2; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TEXT_TO_SPEECH; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TEXT_TO_SPEECH_VOLUME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_TITLE; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.CHANNEL_VOLUME; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.DEVICE_PROPERTY_SERIAL_NUMBER; -import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.FLASH_BRIEFING_COMMAND_PREFIX; +import static org.openhab.binding.amazonechocontrol.internal.AmazonEchoControlBindingConstants.*; import java.io.IOException; import java.net.URISyntaxException; @@ -71,8 +32,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.measure.quantity.Time; - import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; @@ -365,7 +324,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { // Media progress commands Long mediaPosition = null; if (channelId.equals(CHANNEL_MEDIA_PROGRESS)) { - if (command instanceof PercentType) { PercentType value = (PercentType) command; int percent = value.intValue(); @@ -397,7 +355,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { mediaStartMs = System.currentTimeMillis() - this.mediaProgressMs; updateMediaProgress(false); } - } // Volume commands if (channelId.equals(CHANNEL_VOLUME)) { @@ -405,10 +362,8 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof PercentType) { PercentType value = (PercentType) command; volume = value.intValue(); - } else if (command == OnOffType.OFF) { volume = 0; - } else if (command == OnOffType.ON) { volume = lastKnownVolume; } else if (command == IncreaseDecreaseType.INCREASE) { @@ -426,7 +381,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (StringUtils.equals(device.deviceFamily, "WHA")) { connection.command(device, "{\"type\":\"VolumeLevelCommand\",\"volumeLevel\":" + volume + ",\"contentFocusClientId\":\"Default\"}"); - } else { Map parameters = new HashMap<>(); parameters.put("value", volume); @@ -436,7 +390,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { updateState(CHANNEL_VOLUME, new PercentType(lastKnownVolume)); waitForUpdate = -1; } - } // equalizer commands if (channelId.equals(CHANNEL_EQUALIZER_BASS) || channelId.equals(CHANNEL_EQUALIZER_MIDRANGE) @@ -468,7 +421,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { waitForUpdate = 3000; } } - } } if (channelId.equals(CHANNEL_PLAY_MUSIC_VOICE_COMMAND)) { @@ -526,28 +478,23 @@ public void handleCommand(ChannelUID channelUID, Command command) { // amazon music commands if (channelId.equals(CHANNEL_AMAZON_MUSIC_TRACK_ID)) { if (command instanceof StringType) { - String trackId = ((StringType) command).toFullString(); if (StringUtils.isNotEmpty(trackId)) { waitForUpdate = 3000; } connection.playAmazonMusicTrack(device, trackId); - } } if (channelId.equals(CHANNEL_AMAZON_MUSIC_PLAY_LIST_ID)) { if (command instanceof StringType) { - String playListId = ((StringType) command).toFullString(); if (StringUtils.isNotEmpty(playListId)) { waitForUpdate = 3000; } connection.playAmazonMusicPlayList(device, playListId); - } } if (channelId.equals(CHANNEL_AMAZON_MUSIC)) { - if (command == OnOffType.ON) { String lastKnownAmazonMusicId = this.lastKnownAmazonMusicId; if (StringUtils.isNotEmpty(lastKnownAmazonMusicId)) { @@ -616,7 +563,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { currentNotifcationUpdateTimer = scheduler.scheduleWithFixedDelay(() -> { updateNotificationTimerState(); }, 1, 1, TimeUnit.SECONDS); - } } } @@ -759,7 +705,6 @@ private boolean handleEqualizerCommands(String channelId, Command command, Conne logger.debug("Update equalizer failed", e); this.lastKnownEqualizer = null; } - } } return false; @@ -976,7 +921,6 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, } else { stopProgressTimer(); } - } else { stopProgressTimer(); mediaProgressMs = 0; @@ -988,17 +932,13 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, JsonMediaState mediaState = null; try { - if (StringUtils.equalsIgnoreCase(musicProviderId, "AMAZON_MUSIC") || StringUtils.equalsIgnoreCase(musicProviderId, "TUNEIN")) { mediaState = connection.getMediaState(device); } - } catch (HttpException e) { if (e.getCode() == 400) { - updateState(CHANNEL_RADIO_STATION_ID, new StringType("")); - } else { logger.info("getMediaState fails", e); } @@ -1094,7 +1034,6 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, if (queueEntries != null && queueEntries.length > 0) { QueueEntry entry = queueEntries[0]; if (entry != null) { - if (isRadio) { if (StringUtils.isEmpty(imageUrl) && entry.imageURL != null) { imageUrl = entry.imageURL; @@ -1128,7 +1067,6 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, volume = mediaState.volume; } if (playerInfo != null && volume == null) { - Volume volumnInfo = playerInfo.volume; if (volumnInfo != null) { volume = volumnInfo.volume; @@ -1196,7 +1134,6 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, } else { updateState(CHANNEL_NOTIFICATION_VOLUME, UnDefType.UNDEF); } - } catch (Exception e) { this.logger.debug("Handle updateState {} failed: {}", this.getThing().getUID(), e.getMessage(), e); @@ -1240,7 +1177,6 @@ private void updateEqualizerState() { if (treble != null) { updateState(CHANNEL_EQUALIZER_TREBLE, new DecimalType(treble)); } - } private void updateMediaProgress() { @@ -1259,10 +1195,9 @@ private void updateMediaProgress(boolean updateMediaLength) { updateState(CHANNEL_MEDIA_PROGRESS, UnDefType.UNDEF); } updateState(CHANNEL_MEDIA_PROGRESS_TIME, - new QuantityType diff --git a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/BoseSoundTouchBindingConstants.java b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/BoseSoundTouchBindingConstants.java index 6118940695601..0bd8c8bec0123 100644 --- a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/BoseSoundTouchBindingConstants.java +++ b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/BoseSoundTouchBindingConstants.java @@ -14,6 +14,7 @@ import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -32,16 +33,16 @@ public class BoseSoundTouchBindingConstants { public static final String BINDING_ID = "bosesoundtouch"; // List of all Thing Type UIDs - public final static ThingTypeUID BST_UNKNOWN_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "device"); + public static final ThingTypeUID BST_UNKNOWN_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "device"); - public final static ThingTypeUID BST_10_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "10"); - public final static ThingTypeUID BST_20_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "20"); - public final static ThingTypeUID BST_30_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "30"); - public final static ThingTypeUID BST_300_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "300"); - public final static ThingTypeUID BST_WLA_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "wirelessLinkAdapter"); - public final static ThingTypeUID BST_WSMS_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, + public static final ThingTypeUID BST_10_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "10"); + public static final ThingTypeUID BST_20_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "20"); + public static final ThingTypeUID BST_30_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "30"); + public static final ThingTypeUID BST_300_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "300"); + public static final ThingTypeUID BST_WLA_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "wirelessLinkAdapter"); + public static final ThingTypeUID BST_WSMS_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "waveSoundTouchMusicSystemIV"); - public final static ThingTypeUID BST_SA5A_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "sa5Amplifier"); + public static final ThingTypeUID BST_SA5A_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "sa5Amplifier"); public static final Set SUPPORTED_KNOWN_THING_TYPES_UIDS = Collections.unmodifiableSet(Stream .of(BST_UNKNOWN_THING_TYPE_UID, BST_10_THING_TYPE_UID, BST_20_THING_TYPE_UID, BST_30_THING_TYPE_UID, @@ -50,6 +51,13 @@ public class BoseSoundTouchBindingConstants { public static final Set SUPPORTED_THING_TYPES_UIDS = new HashSet<>(SUPPORTED_KNOWN_THING_TYPES_UIDS); + // Partial list of Channel Type IDs + public static final String CHANNEL_TYPE_OPERATION_MODE_DEFAULT = "operationMode_default"; + public static final String CHANNEL_TYPE_OPERATION_MODE_BST_10_20_30 = "operationMode_BST_10_20_30"; + public static final String CHANNEL_TYPE_OPERATION_MODE_BST_300 = "operationMode_BST_300"; + public static final String CHANNEL_TYPE_OPERATION_MODE_BST_SA5A = "operationMode_BST_SA5_Amplifier"; + public static final String CHANNEL_TYPE_OPERATION_MODE_BST_WLA = "operationMode_BST_WLA"; + // List of all Channel IDs public static final String CHANNEL_POWER = "power"; public static final String CHANNEL_VOLUME = "volume"; @@ -74,7 +82,16 @@ public class BoseSoundTouchBindingConstants { public static final String CHANNEL_NOWPLAYING_TRACK = "nowPlayingTrack"; public static final String CHANNEL_NOTIFICATION_SOUND = "notificationsound"; + public static final List CHANNEL_IDS = Collections.unmodifiableList( + Stream.of(CHANNEL_POWER, CHANNEL_VOLUME, CHANNEL_MUTE, CHANNEL_OPERATIONMODE, CHANNEL_PLAYER_CONTROL, + CHANNEL_PRESET, CHANNEL_BASS, CHANNEL_RATEENABLED, CHANNEL_SKIPENABLED, CHANNEL_SKIPPREVIOUSENABLED, + CHANNEL_SAVE_AS_PRESET, CHANNEL_KEY_CODE, CHANNEL_NOWPLAYING_ALBUM, CHANNEL_NOWPLAYING_ARTWORK, + CHANNEL_NOWPLAYING_ARTIST, CHANNEL_NOWPLAYING_DESCRIPTION, CHANNEL_NOWPLAYING_GENRE, + CHANNEL_NOWPLAYING_ITEMNAME, CHANNEL_NOWPLAYING_STATIONLOCATION, CHANNEL_NOWPLAYING_STATIONNAME, + CHANNEL_NOWPLAYING_TRACK, CHANNEL_NOTIFICATION_SOUND).collect(Collectors.toList())); + // Device information parameters; public static final String DEVICE_INFO_NAME = "INFO_NAME"; public static final String DEVICE_INFO_TYPE = "INFO_TYPE"; + } diff --git a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/PresetContainer.java b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/PresetContainer.java index 30e75ec41575b..476e6ef36040e 100644 --- a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/PresetContainer.java +++ b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/PresetContainer.java @@ -77,9 +77,10 @@ public void put(int presetID, ContentItem preset) throws ContentItemNotPresetabl throw new ContentItemNotPresetableException(); } } - + /** * Remove the Preset stored under the specified Id + * * @param presetID */ public void remove(int presetID) { @@ -126,7 +127,7 @@ private void writeToStorage() { } } - if (listOfPresets.size() > 0) { + if (!listOfPresets.isEmpty()) { listOfPresets.forEach(item -> storage.put(String.valueOf(item.getPresetID()), item)); } } diff --git a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/discovery/SoundTouchDiscoveryParticipant.java b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/discovery/SoundTouchDiscoveryParticipant.java index a01d3e2815212..4a80fb3e60953 100644 --- a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/discovery/SoundTouchDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/discovery/SoundTouchDiscoveryParticipant.java @@ -60,17 +60,15 @@ public DiscoveryResult createResult(ServiceInfo info) { DiscoveryResult result = null; ThingUID uid = getThingUID(info); if (uid != null) { - // remove the domain from the name InetAddress[] addrs = info.getInetAddresses(); Map properties = new HashMap<>(2); - + String label = null; if (BST_10_THING_TYPE_UID.equals(uid.getThingTypeUID())) { try { - String group = DiscoveryUtil - .executeUrl("http://" + addrs[0].getHostAddress() + ":8090/getGroup"); + String group = DiscoveryUtil.executeUrl("http://" + addrs[0].getHostAddress() + ":8090/getGroup"); label = DiscoveryUtil.getContentOfFirstElement(group, "name"); } catch (IOException e) { logger.debug("Can't obtain label for group. Will use the default one"); @@ -80,7 +78,7 @@ public DiscoveryResult createResult(ServiceInfo info) { if (label == null || label.isEmpty()) { label = info.getName(); } - + if (label == null || label.isEmpty()) { label = "Bose SoundTouch"; } @@ -93,9 +91,10 @@ public DiscoveryResult createResult(ServiceInfo info) { properties.put(BoseSoundTouchConfiguration.HOST, addrs[0].getHostAddress()); if (getMacAddress(info) != null) { - properties.put(BoseSoundTouchConfiguration.MAC_ADDRESS, new String(getMacAddress(info), StandardCharsets.UTF_8)); + properties.put(BoseSoundTouchConfiguration.MAC_ADDRESS, + new String(getMacAddress(info), StandardCharsets.UTF_8)); } - + // Set manufacturer as thing property (if available) byte[] manufacturer = info.getPropertyBytes("MANUFACTURER"); if (manufacturer != null) { diff --git a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/handler/BoseSoundTouchHandler.java b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/handler/BoseSoundTouchHandler.java index ae9eb40a7edd7..819dc224198ba 100644 --- a/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/handler/BoseSoundTouchHandler.java +++ b/bundles/org.openhab.binding.bosesoundtouch/src/main/java/org/openhab/binding/bosesoundtouch/internal/handler/BoseSoundTouchHandler.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.net.URI; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; @@ -46,7 +45,9 @@ import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; import org.eclipse.smarthome.core.thing.ThingStatusDetail; +import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; +import org.eclipse.smarthome.core.thing.binding.ThingHandlerCallback; import org.eclipse.smarthome.core.thing.type.ChannelTypeUID; import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.RefreshType; @@ -143,7 +144,8 @@ public void updateState(String channelID, State state) { @Override public void handleCommand(ChannelUID channelUID, Command command) { if (commandExecutor == null) { - logger.debug("{}: Can't handle command '{}' for channel '{}' because of not initialized connection.", getDeviceName(), command, channelUID); + logger.debug("{}: Can't handle command '{}' for channel '{}' because of not initialized connection.", + getDeviceName(), command, channelUID); return; } else { logger.debug("{}: handleCommand({}, {});", getDeviceName(), channelUID, command); @@ -259,14 +261,17 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (chTypeUid != null) { switch (channel.getChannelTypeUID().getId()) { case CHANNEL_NOTIFICATION_SOUND: - String appKey = Objects.toString(getConfig().get(BoseSoundTouchConfiguration.APP_KEY), null); + String appKey = Objects.toString(getConfig().get(BoseSoundTouchConfiguration.APP_KEY), + null); if (appKey != null && !appKey.isEmpty()) { if (command instanceof StringType) { String url = command.toString(); BoseSoundTouchNotificationChannelConfiguration notificationConfiguration = channel - .getConfiguration().as(BoseSoundTouchNotificationChannelConfiguration.class); + .getConfiguration() + .as(BoseSoundTouchNotificationChannelConfiguration.class); if (!url.isEmpty()) { - commandExecutor.playNotificationSound(appKey, notificationConfiguration, url); + commandExecutor.playNotificationSound(appKey, notificationConfiguration, + url); } } } else { @@ -280,7 +285,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { channelUID.getId()); break; } - } /** @@ -325,7 +329,8 @@ public String getDeviceType() { * @return the MAC Address of this device (in format "123456789ABC") */ public String getMacAddress() { - return ((String) getThing().getConfiguration().get(BoseSoundTouchConfiguration.MAC_ADDRESS)).replaceAll(":", ""); + return ((String) getThing().getConfiguration().get(BoseSoundTouchConfiguration.MAC_ADDRESS)).replaceAll(":", + ""); } /** @@ -475,15 +480,14 @@ private void checkConnection() { } public void refreshPresetChannel() { - List stateOptions = presetContainer.getAllPresets().stream() - .map(e -> e.toStateOption()) + List stateOptions = presetContainer.getAllPresets().stream().map(e -> e.toStateOption()) .sorted(Comparator.comparing(StateOption::getValue)).collect(Collectors.toList()); stateOptionProvider.setStateOptions(new ChannelUID(getThing().getUID(), CHANNEL_PRESET), stateOptions); } public void handleGroupUpdated(BoseSoundTouchConfiguration masterPlayerConfiguration) { String deviceId = getMacAddress(); - + if (masterPlayerConfiguration != null && masterPlayerConfiguration.macAddress != null) { // Stereo pair if (Objects.equals(masterPlayerConfiguration.macAddress, deviceId)) { @@ -507,7 +511,7 @@ public void handleGroupUpdated(BoseSoundTouchConfiguration masterPlayerConfigura if (getThing().getThingTypeUID().equals(BST_10_THING_TYPE_UID)) { if (getThing().getChannels().isEmpty()) { logger.debug("{}: Stereo Pair was disbounded. Restoring channels", getDeviceName()); - updateThing(editThing().withChannels(getAllChannels()).build()); + updateThing(editThing().withChannels(getAllChannels(BST_10_THING_TYPE_UID)).build()); } else { logger.debug("{}: Stereo Pair was disbounded.", getDeviceName()); } @@ -517,32 +521,44 @@ public void handleGroupUpdated(BoseSoundTouchConfiguration masterPlayerConfigura } } } - - private List getAllChannels() { - List allChannels = new ArrayList<>(); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_POWER), new ChannelTypeUID(BINDING_ID, CHANNEL_POWER)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_VOLUME), new ChannelTypeUID(BINDING_ID, CHANNEL_VOLUME)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_MUTE), new ChannelTypeUID(BINDING_ID, CHANNEL_MUTE)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_OPERATIONMODE), new ChannelTypeUID(BINDING_ID, "operationMode_BST_10_20_30")).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_PLAYER_CONTROL), new ChannelTypeUID(BINDING_ID, CHANNEL_PLAYER_CONTROL)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_PRESET), new ChannelTypeUID(BINDING_ID, CHANNEL_PRESET)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_BASS), new ChannelTypeUID(BINDING_ID, CHANNEL_BASS)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_RATEENABLED), new ChannelTypeUID(BINDING_ID, CHANNEL_RATEENABLED)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_SKIPENABLED), new ChannelTypeUID(BINDING_ID, CHANNEL_SKIPENABLED)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_SKIPPREVIOUSENABLED), new ChannelTypeUID(BINDING_ID, CHANNEL_SKIPPREVIOUSENABLED)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_SAVE_AS_PRESET), new ChannelTypeUID(BINDING_ID, CHANNEL_SAVE_AS_PRESET)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_KEY_CODE), new ChannelTypeUID(BINDING_ID, CHANNEL_KEY_CODE)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ALBUM), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ALBUM)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ARTWORK), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ARTWORK)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ARTIST), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ARTIST)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_DESCRIPTION), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_DESCRIPTION)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_GENRE), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_GENRE)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_ITEMNAME), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_ITEMNAME)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_STATIONLOCATION), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_STATIONLOCATION)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_STATIONNAME), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_STATIONNAME)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOWPLAYING_TRACK), new ChannelTypeUID(BINDING_ID, CHANNEL_NOWPLAYING_TRACK)).build()); - allChannels.add(getCallback().createChannelBuilder(new ChannelUID(getThing().getUID(), CHANNEL_NOTIFICATION_SOUND), new ChannelTypeUID(BINDING_ID, CHANNEL_NOTIFICATION_SOUND)).build()); - - return allChannels; + + private List getAllChannels(ThingTypeUID thingTypeUID) { + ThingHandlerCallback callback = getCallback(); + if (callback == null) { + return Collections.emptyList(); + } + + return CHANNEL_IDS.stream() + .map(channelId -> callback.createChannelBuilder(new ChannelUID(getThing().getUID(), channelId), + createChannelTypeUID(thingTypeUID, channelId)).build()) + .collect(Collectors.toList()); + } + + private ChannelTypeUID createChannelTypeUID(ThingTypeUID thingTypeUID, String channelId) { + if (CHANNEL_OPERATIONMODE.equals(channelId)) { + return createOperationModeChannelTypeUID(thingTypeUID); + } + + return new ChannelTypeUID(BINDING_ID, channelId); + } + + private ChannelTypeUID createOperationModeChannelTypeUID(ThingTypeUID thingTypeUID) { + String channelTypeId = CHANNEL_TYPE_OPERATION_MODE_DEFAULT; + + if (BST_10_THING_TYPE_UID.equals(thingTypeUID) || BST_20_THING_TYPE_UID.equals(thingTypeUID) + || BST_30_THING_TYPE_UID.equals(thingTypeUID)) { + channelTypeId = CHANNEL_TYPE_OPERATION_MODE_BST_10_20_30; + } else if (BST_300_THING_TYPE_UID.equals(thingTypeUID)) { + channelTypeId = CHANNEL_TYPE_OPERATION_MODE_BST_300; + } else if (BST_SA5A_THING_TYPE_UID.equals(thingTypeUID)) { + channelTypeId = CHANNEL_TYPE_OPERATION_MODE_BST_SA5A; + } else if (BST_WLA_THING_TYPE_UID.equals(thingTypeUID)) { + channelTypeId = CHANNEL_TYPE_OPERATION_MODE_BST_WLA; + } else if (BST_WSMS_THING_TYPE_UID.equals(thingTypeUID)) { + channelTypeId = CHANNEL_TYPE_OPERATION_MODE_DEFAULT; + } + + return new ChannelTypeUID(BINDING_ID, channelTypeId); } + } diff --git a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java index 4d03395bc39c3..0d9a7965cddac 100644 --- a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java +++ b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/BuienradarHandler.java @@ -26,8 +26,6 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; -import javax.measure.quantity.Speed; - import org.apache.commons.lang.StringUtils; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.smarthome.core.library.types.DateTimeType; @@ -76,7 +74,6 @@ public BuienradarHandler(Thing thing) { @Override public void handleCommand(ChannelUID channelUID, Command command) { - } @SuppressWarnings("null") @@ -155,7 +152,7 @@ private void refresh(int tries, ZonedDateTime nextRefresh, int retryInSeconds) { if (minutesFromNow >= 0 && minutesFromNow <= 115) { final String label = String.format(Locale.ENGLISH, "forecast_%d", minutesFromNow); - updateState(label, new QuantityType(intensity, SmartHomeUnits.MILLIMETRE_PER_HOUR)); + updateState(label, new QuantityType<>(intensity, SmartHomeUnits.MILLIMETRE_PER_HOUR)); } } diff --git a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java index 67e007da3cf0d..d7be1ae52a2bd 100644 --- a/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java +++ b/bundles/org.openhab.binding.buienradar/src/main/java/org/openhab/binding/buienradar/internal/buienradarapi/BuienradarPredictionAPI.java @@ -151,8 +151,8 @@ public Optional> getPredictions(PointType location) throws IOEx logger.warn("Buienradar API at URI {} return empty result", address); return Optional.empty(); } - final List predictions = new ArrayList(24); - final List errors = new LinkedList(); + final List predictions = new ArrayList<>(24); + final List errors = new LinkedList<>(); logger.debug("Returned result from buienradar: {}", result); final String[] lines = result.split("\n"); Optional actual = Optional.empty(); diff --git a/bundles/org.openhab.binding.chromecast/pom.xml b/bundles/org.openhab.binding.chromecast/pom.xml index 87e3ded78c5ba..9e0cd5fbf0b2f 100644 --- a/bundles/org.openhab.binding.chromecast/pom.xml +++ b/bundles/org.openhab.binding.chromecast/pom.xml @@ -21,27 +21,8 @@ su.litvak.chromecast api-v2 - 0.11.2 + 0.11.3 compile - - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-annotations - - com.google.protobuf diff --git a/bundles/org.openhab.binding.daikin/README.md b/bundles/org.openhab.binding.daikin/README.md index 63bcf267fb654..6631527058765 100644 --- a/bundles/org.openhab.binding.daikin/README.md +++ b/bundles/org.openhab.binding.daikin/README.md @@ -31,8 +31,9 @@ For the BRP072A42: | outdoortemp | The outdoor temperature as measured by the external part of the air conditioning system. May not be available when unit is off. | | humidity | The indoor humidity as measured by the unit. This is not available on all units. | | mode | The mode set for the unit (AUTO, DEHUMIDIFIER, COLD, HEAT, FAN) | -| homekit mode | A mode that is compatible with homekit/alexa/google home (off, auto, heat, cool) | +| homekit mode | A mode that is compatible with homekit/alexa/google home (off, auto, heat, cool) | | fanspeed | The fan speed set for the unit (AUTO, SILENCE, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5) | +| fandir | The fan blade direction (STOPPED, VERTICAL, HORIZONTAL, VERTICAL_AND_HORIZONTAL) | For the BRP15B61: @@ -43,8 +44,8 @@ For the BRP15B61: | indoortemp | The indoor temperature as measured by the unit. | | outdoortemp | The outdoor temperature as measured by the external part of the air conditioning system. May not be available when unit is off. | | mode | The mode set for the unit (AUTO, DEHUMIDIFIER, COLD, HEAT, FAN) | -| homekit mode | A mode that is compatible with homekit/alexa/google home (off, auto, heat, cool) | -| airbasefanspeed | The fan speed set for the unit (AIRSIDE, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, AUTO_LEVEL_1, AUTO_LEVEL_2, AUTO_LEVEL_3, AUTO_LEVEL_4, AUTO_LEVEL_5) | +| homekit mode | A mode that is compatible with homekit/alexa/google home (off, auto, heat, cool) | +| airbasefanspeed | The fan speed set for the unit (AUTO, AIRSIDE, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5, AUTO_LEVEL_1, AUTO_LEVEL_2, AUTO_LEVEL_3, AUTO_LEVEL_4, AUTO_LEVEL_5) | | zone1 | Turns zone 1 on/off for the air conditioning unit (if a zone controller is installed.) | | zone2 | Turns zone 2 on/off for the air conditioning unit. | | zone3 | Turns zone 3 on/off for the air conditioning unit. | @@ -71,6 +72,7 @@ Number:Temperature DaikinACUnit_SetPoint { channel="daikin:ac_unit:living_room_a String DaikinACUnit_Mode { channel="daikin:ac_unit:living_room_ac:mode" } String DaikinACUnit_HomekitMode { channel="daikin:ac_unit:living_room_ac:homekitmode" } String DaikinACUnit_Fan { channel="daikin:ac_unit:living_room_ac:fanspeed" } +String DaikinACUnit_Fan_Movement { channel="daikin:ac_unit:living_room_ac:fandir" } Number:Temperature DaikinACUnit_IndoorTemperature { channel="daikin:ac_unit:living_room_ac:indoortemp" } Number:Temperature DaikinACUnit_OutdoorTemperature { channel="daikin:ac_unit:living_room_ac:outdoortemp" } # Additional items for BRP1B61 diff --git a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/api/airbase/AirbaseEnums.java b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/api/airbase/AirbaseEnums.java index 5edd6aa60d547..e6ab004b296f5 100644 --- a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/api/airbase/AirbaseEnums.java +++ b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/api/airbase/AirbaseEnums.java @@ -60,6 +60,7 @@ public static AirbaseMode fromValue(int value) { public enum AirbaseFanSpeed { // level,f_auto,f_airside + AUTO (0, false, false), LEVEL_1 (1, false, false), LEVEL_2 (2, false, false), LEVEL_3 (3, false, false), @@ -99,6 +100,9 @@ public String getLabel() { if (airside) { return "Airside"; } + if (level == 0) { + return "Auto"; + } String label = ""; if (auto) { label = "Auto "; @@ -110,6 +114,9 @@ public static AirbaseFanSpeed fromValue(int rate, boolean auto, boolean airside) if (airside) { return AIRSIDE; } + if (rate == 0) { + return AirbaseFanSpeed.AUTO; + } for (AirbaseFanSpeed m : AirbaseFanSpeed.values()) { if (m.getLevel() == rate && m.getAuto() == auto && m.getAirside() == airside) { return m; diff --git a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAcUnitHandler.java b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAcUnitHandler.java index 120e51af880cf..f6b7885106594 100755 --- a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAcUnitHandler.java +++ b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAcUnitHandler.java @@ -14,47 +14,25 @@ import java.io.IOException; import java.util.Optional; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; -import java.util.EnumSet; -import java.util.List; -import java.util.ArrayList; - -import javax.measure.quantity.Temperature; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.OnOffType; -import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; -import org.eclipse.smarthome.core.library.unit.SIUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; -import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.ThingStatus; -import org.eclipse.smarthome.core.thing.ThingStatusDetail; -import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; import org.eclipse.smarthome.core.types.Command; -import org.eclipse.smarthome.core.types.RefreshType; -import org.eclipse.smarthome.core.types.State; -import org.eclipse.smarthome.core.types.StateOption; import org.eclipse.smarthome.core.types.UnDefType; import org.openhab.binding.daikin.internal.DaikinBindingConstants; import org.openhab.binding.daikin.internal.DaikinCommunicationException; -import org.openhab.binding.daikin.internal.DaikinWebTargets; import org.openhab.binding.daikin.internal.DaikinDynamicStateDescriptionProvider; import org.openhab.binding.daikin.internal.api.ControlInfo; -import org.openhab.binding.daikin.internal.api.SensorInfo; import org.openhab.binding.daikin.internal.api.Enums.FanMovement; import org.openhab.binding.daikin.internal.api.Enums.FanSpeed; -import org.openhab.binding.daikin.internal.api.Enums.Mode; import org.openhab.binding.daikin.internal.api.Enums.HomekitMode; - - -import org.openhab.binding.daikin.internal.config.DaikinConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.openhab.binding.daikin.internal.api.Enums.Mode; +import org.openhab.binding.daikin.internal.api.SensorInfo; /** * Handles communicating with a Daikin air conditioning unit. @@ -107,9 +85,10 @@ protected void pollStatus() throws IOException { } @Override - protected boolean handleCommandInternal(ChannelUID channelUID, Command command) throws DaikinCommunicationException { + protected boolean handleCommandInternal(ChannelUID channelUID, Command command) + throws DaikinCommunicationException { switch (channelUID.getId()) { - case DaikinBindingConstants.CHANNEL_AC_FAN_DIR: + case DaikinBindingConstants.CHANNEL_AC_FAN_DIR: if (command instanceof StringType) { changeFanDir(((StringType) command).toString()); return true; diff --git a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAirbaseUnitHandler.java b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAirbaseUnitHandler.java index 38dd4be4005f8..b92927eaf168e 100755 --- a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAirbaseUnitHandler.java +++ b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinAirbaseUnitHandler.java @@ -13,45 +13,30 @@ package org.openhab.binding.daikin.internal.handler; import java.io.IOException; -import java.util.Optional; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; +import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import java.util.ArrayList; - -import javax.measure.quantity.Temperature; +import java.util.Optional; +import java.util.stream.IntStream; -import org.eclipse.smarthome.core.library.types.DecimalType; import org.eclipse.smarthome.core.library.types.OnOffType; -import org.eclipse.smarthome.core.library.types.QuantityType; import org.eclipse.smarthome.core.library.types.StringType; -import org.eclipse.smarthome.core.library.unit.SIUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; -import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.ThingStatus; -import org.eclipse.smarthome.core.thing.ThingStatusDetail; -import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; import org.eclipse.smarthome.core.types.Command; -import org.eclipse.smarthome.core.types.State; import org.eclipse.smarthome.core.types.StateOption; -import org.eclipse.smarthome.core.types.UnDefType; import org.openhab.binding.daikin.internal.DaikinBindingConstants; import org.openhab.binding.daikin.internal.DaikinCommunicationException; -import org.openhab.binding.daikin.internal.DaikinWebTargets; import org.openhab.binding.daikin.internal.DaikinDynamicStateDescriptionProvider; +import org.openhab.binding.daikin.internal.api.Enums.HomekitMode; import org.openhab.binding.daikin.internal.api.SensorInfo; +import org.openhab.binding.daikin.internal.api.airbase.AirbaseControlInfo; import org.openhab.binding.daikin.internal.api.airbase.AirbaseEnums.AirbaseFanSpeed; -import org.openhab.binding.daikin.internal.api.airbase.AirbaseEnums.AirbaseMode; import org.openhab.binding.daikin.internal.api.airbase.AirbaseEnums.AirbaseFeature; -import org.openhab.binding.daikin.internal.api.airbase.AirbaseControlInfo; +import org.openhab.binding.daikin.internal.api.airbase.AirbaseEnums.AirbaseMode; import org.openhab.binding.daikin.internal.api.airbase.AirbaseModelInfo; import org.openhab.binding.daikin.internal.api.airbase.AirbaseZoneInfo; -import org.openhab.binding.daikin.internal.api.Enums.HomekitMode; - -import org.openhab.binding.daikin.internal.config.DaikinConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,12 +57,13 @@ public DaikinAirbaseUnitHandler(Thing thing, DaikinDynamicStateDescriptionProvid } @Override - protected boolean handleCommandInternal(ChannelUID channelUID, Command command) throws DaikinCommunicationException { + protected boolean handleCommandInternal(ChannelUID channelUID, Command command) + throws DaikinCommunicationException { if (channelUID.getId().startsWith(DaikinBindingConstants.CHANNEL_AIRBASE_AC_ZONE)) { int zoneNumber = Integer.parseInt(channelUID.getId().substring(4)); if (command instanceof OnOffType) { - changeZone(zoneNumber, command == OnOffType.ON); - return true; + changeZone(zoneNumber, command == OnOffType.ON); + return true; } } return false; @@ -97,7 +83,8 @@ protected void pollStatus() throws IOException { updateState(DaikinBindingConstants.CHANNEL_AC_POWER, controlInfo.power ? OnOffType.ON : OnOffType.OFF); updateTemperatureChannel(DaikinBindingConstants.CHANNEL_AC_TEMP, controlInfo.temp); updateState(DaikinBindingConstants.CHANNEL_AC_MODE, new StringType(controlInfo.mode.name())); - updateState(DaikinBindingConstants.CHANNEL_AIRBASE_AC_FAN_SPEED, new StringType(controlInfo.fanSpeed.name())); + updateState(DaikinBindingConstants.CHANNEL_AIRBASE_AC_FAN_SPEED, + new StringType(controlInfo.fanSpeed.name())); if (!controlInfo.power) { updateState(DaikinBindingConstants.CHANNEL_AC_HOMEKITMODE, new StringType(HomekitMode.OFF.getValue())); @@ -119,8 +106,9 @@ protected void pollStatus() throws IOException { AirbaseZoneInfo zoneInfo = webTargets.getAirbaseZoneInfo(); if (zoneInfo != null) { - IntStream.range(0, zoneInfo.zone.length).forEach( - idx -> updateState(DaikinBindingConstants.CHANNEL_AIRBASE_AC_ZONE + idx, OnOffType.from(zoneInfo.zone[idx]))); + IntStream.range(0, zoneInfo.zone.length) + .forEach(idx -> updateState(DaikinBindingConstants.CHANNEL_AIRBASE_AC_ZONE + idx, + OnOffType.from(zoneInfo.zone[idx]))); } } @@ -141,8 +129,8 @@ protected void changeSetPoint(double newTemperature) throws DaikinCommunicationE @Override protected void changeMode(String mode) throws DaikinCommunicationException { AirbaseMode newMode = AirbaseMode.valueOf(mode); - if ((newMode == AirbaseMode.AUTO && !airbaseModelInfo.features.contains(AirbaseFeature.AUTO)) || - (newMode == AirbaseMode.DRY && !airbaseModelInfo.features.contains(AirbaseFeature.DRY))) { + if ((newMode == AirbaseMode.AUTO && !airbaseModelInfo.features.contains(AirbaseFeature.AUTO)) + || (newMode == AirbaseMode.DRY && !airbaseModelInfo.features.contains(AirbaseFeature.DRY))) { logger.warn("{} mode is not supported by your controller", mode); return; } @@ -154,8 +142,9 @@ protected void changeMode(String mode) throws DaikinCommunicationException { @Override protected void changeFanSpeed(String speed) throws DaikinCommunicationException { AirbaseFanSpeed newFanSpeed = AirbaseFanSpeed.valueOf(speed); - if (EnumSet.range(AirbaseFanSpeed.AUTO_LEVEL_1, AirbaseFanSpeed.AUTO_LEVEL_5).contains(newFanSpeed) && !airbaseModelInfo.features.contains(AirbaseFeature.FRATE_AUTO)) { - logger.warn("Auto fan levels are not supported by your controller"); + if (EnumSet.range(AirbaseFanSpeed.AUTO_LEVEL_1, AirbaseFanSpeed.AUTO_LEVEL_5).contains(newFanSpeed) + && !airbaseModelInfo.features.contains(AirbaseFeature.FRATE_AUTO)) { + logger.warn("Fan AUTO_LEVEL_X is not supported by your controller"); return; } if (newFanSpeed == AirbaseFanSpeed.AIRSIDE && !airbaseModelInfo.features.contains(AirbaseFeature.AIRSIDE)) { @@ -169,7 +158,8 @@ protected void changeFanSpeed(String speed) throws DaikinCommunicationException protected void changeZone(int zone, boolean command) throws DaikinCommunicationException { if (zone <= 0 || zone > airbaseModelInfo.zonespresent) { - logger.warn("The given zone number ({}) is outside the number of zones supported by the controller ({})", zone, airbaseModelInfo.zonespresent); + logger.warn("The given zone number ({}) is outside the number of zones supported by the controller ({})", + zone, airbaseModelInfo.zonespresent); return; } AirbaseZoneInfo info = webTargets.getAirbaseZoneInfo(); @@ -184,6 +174,7 @@ protected void updateChannelStateDescriptions() { protected void updateAirbaseFanSpeedChannelStateDescription() { List options = new ArrayList<>(); + options.add(new StateOption(AirbaseFanSpeed.AUTO.name(), AirbaseFanSpeed.AUTO.getLabel())); if (airbaseModelInfo.features.contains(AirbaseFeature.AIRSIDE)) { options.add(new StateOption(AirbaseFanSpeed.AIRSIDE.name(), AirbaseFanSpeed.AIRSIDE.getLabel())); } @@ -195,8 +186,8 @@ protected void updateAirbaseFanSpeedChannelStateDescription() { options.add(new StateOption(f.name(), f.getLabel())); } } - stateDescriptionProvider.setStateOptions(new ChannelUID(thing.getUID(), DaikinBindingConstants.CHANNEL_AIRBASE_AC_FAN_SPEED), - options); + stateDescriptionProvider.setStateOptions( + new ChannelUID(thing.getUID(), DaikinBindingConstants.CHANNEL_AIRBASE_AC_FAN_SPEED), options); } protected void updateAirbaseModeChannelStateDescription() { diff --git a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java index 729b5260644aa..2139b0b307a75 100755 --- a/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java +++ b/bundles/org.openhab.binding.daikin/src/main/java/org/openhab/binding/daikin/internal/handler/DaikinBaseHandler.java @@ -16,10 +16,6 @@ import java.util.Optional; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; -import java.util.EnumSet; -import java.util.List; -import java.util.ArrayList; import javax.measure.quantity.Temperature; @@ -32,20 +28,18 @@ import org.eclipse.smarthome.core.library.unit.SIUnits; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; -import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.ThingStatus; import org.eclipse.smarthome.core.thing.ThingStatusDetail; +import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.State; -import org.eclipse.smarthome.core.types.StateOption; import org.eclipse.smarthome.core.types.UnDefType; import org.openhab.binding.daikin.internal.DaikinBindingConstants; import org.openhab.binding.daikin.internal.DaikinCommunicationException; -import org.openhab.binding.daikin.internal.DaikinWebTargets; import org.openhab.binding.daikin.internal.DaikinDynamicStateDescriptionProvider; +import org.openhab.binding.daikin.internal.DaikinWebTargets; import org.openhab.binding.daikin.internal.api.Enums.HomekitMode; - import org.openhab.binding.daikin.internal.config.DaikinConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -72,13 +66,16 @@ public abstract class DaikinBaseHandler extends BaseThingHandler { protected abstract void pollStatus() throws IOException; protected abstract void changePower(boolean power) throws DaikinCommunicationException; + protected abstract void changeSetPoint(double newTemperature) throws DaikinCommunicationException; + protected abstract void changeMode(String mode) throws DaikinCommunicationException; - protected abstract void changeFanSpeed(String fanSpeed) throws DaikinCommunicationException; - // Power, Temp, Fan and Mode are handled in this base class. Override this to handle additional channels. - protected abstract boolean handleCommandInternal(ChannelUID channelUID, Command command) throws DaikinCommunicationException; + protected abstract void changeFanSpeed(String fanSpeed) throws DaikinCommunicationException; + // Power, Temp, Fan and Mode are handled in this base class. Override this to handle additional channels. + protected abstract boolean handleCommandInternal(ChannelUID channelUID, Command command) + throws DaikinCommunicationException; public DaikinBaseHandler(Thing thing, DaikinDynamicStateDescriptionProvider stateDescriptionProvider) { super(thing); @@ -123,7 +120,8 @@ public void handleCommand(ChannelUID channelUID, Command command) { } break; } - logger.debug("Received command ({}) of wrong type for thing '{}' on channel {}", command, thing.getUID().getAsString(), channelUID.getId()); + logger.debug("Received command ({}) of wrong type for thing '{}' on channel {}", command, + thing.getUID().getAsString(), channelUID.getId()); } catch (DaikinCommunicationException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); } @@ -182,9 +180,8 @@ private synchronized void poll() { } protected void updateTemperatureChannel(String channel, Optional maybeTemperature) { - updateState(channel, - maybeTemperature. map(t -> new QuantityType(new DecimalType(t), SIUnits.CELSIUS)) - .orElse(UnDefType.UNDEF)); + updateState(channel, maybeTemperature. map(t -> new QuantityType<>(new DecimalType(t), SIUnits.CELSIUS)) + .orElse(UnDefType.UNDEF)); } /** @@ -209,16 +206,16 @@ private boolean changeSetPoint(Command command) throws DaikinCommunicationExcept private void changeHomekitMode(String homekitmode) throws DaikinCommunicationException { ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (HomekitMode.OFF.getValue().equals(homekitmode)) { - changePower(false); + changePower(false); } else { - changePower(true); - if (HomekitMode.AUTO.getValue().equals(homekitmode)) { + changePower(true); + if (HomekitMode.AUTO.getValue().equals(homekitmode)) { changeMode("AUTO"); - } else if (HomekitMode.HEAT.getValue().equals(homekitmode)) { + } else if (HomekitMode.HEAT.getValue().equals(homekitmode)) { changeMode("HEAT"); - } else if (HomekitMode.COOL.getValue().equals(homekitmode)) { + } else if (HomekitMode.COOL.getValue().equals(homekitmode)) { changeMode("COLD"); - } + } } } diff --git a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/SensorThingHandler.java b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/SensorThingHandler.java index afa468e54245a..d0fec3e8cd27b 100644 --- a/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/SensorThingHandler.java +++ b/bundles/org.openhab.binding.deconz/src/main/java/org/openhab/binding/deconz/internal/handler/SensorThingHandler.java @@ -31,15 +31,6 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import javax.measure.quantity.Dimensionless; -import javax.measure.quantity.ElectricCurrent; -import javax.measure.quantity.ElectricPotential; -import javax.measure.quantity.Energy; -import javax.measure.quantity.Illuminance; -import javax.measure.quantity.Power; -import javax.measure.quantity.Pressure; -import javax.measure.quantity.Temperature; - import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.smarthome.core.library.types.DateTimeType; @@ -357,7 +348,7 @@ public void valueUpdated(ChannelUID channelUID, SensorConfig newConfig) { break; case CHANNEL_TEMPERATURE: if (temperature != null) { - updateState(channelUID, new QuantityType(temperature / 100, CELSIUS)); + updateState(channelUID, new QuantityType<>(temperature / 100, CELSIUS)); } break; } @@ -400,27 +391,27 @@ public void valueUpdated(ChannelUID channelUID, SensorState newState, boolean in break; case CHANNEL_POWER: if (power != null) { - updateState(channelUID, new QuantityType(power, WATT)); + updateState(channelUID, new QuantityType<>(power, WATT)); } break; case CHANNEL_CONSUMPTION: if (consumption != null) { - updateState(channelUID, new QuantityType(consumption, WATT_HOUR)); + updateState(channelUID, new QuantityType<>(consumption, WATT_HOUR)); } break; case CHANNEL_VOLTAGE: if (voltage != null) { - updateState(channelUID, new QuantityType(voltage, VOLT)); + updateState(channelUID, new QuantityType<>(voltage, VOLT)); } break; case CHANNEL_CURRENT: if (current != null) { - updateState(channelUID, new QuantityType(current, MILLI(AMPERE))); + updateState(channelUID, new QuantityType<>(current, MILLI(AMPERE))); } break; case CHANNEL_LIGHT_LUX: if (lux != null) { - updateState(channelUID, new QuantityType(lux, LUX)); + updateState(channelUID, new QuantityType<>(lux, LUX)); } break; case CHANNEL_LIGHT_LEVEL: @@ -436,17 +427,17 @@ public void valueUpdated(ChannelUID channelUID, SensorState newState, boolean in break; case CHANNEL_TEMPERATURE: if (temperature != null) { - updateState(channelUID, new QuantityType(temperature / 100, CELSIUS)); + updateState(channelUID, new QuantityType<>(temperature / 100, CELSIUS)); } break; case CHANNEL_HUMIDITY: if (humidity != null) { - updateState(channelUID, new QuantityType(humidity / 100, PERCENT)); + updateState(channelUID, new QuantityType<>(humidity / 100, PERCENT)); } break; case CHANNEL_PRESSURE: if (pressure != null) { - updateState(channelUID, new QuantityType(pressure, HECTO(PASCAL))); + updateState(channelUID, new QuantityType<>(pressure, HECTO(PASCAL))); } break; case CHANNEL_PRESENCE: diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/DenonMarantzBindingConstants.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/DenonMarantzBindingConstants.java index 99f42e01d666a..7660d20df8e29 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/DenonMarantzBindingConstants.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/DenonMarantzBindingConstants.java @@ -15,6 +15,7 @@ import java.math.BigDecimal; import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.Map; import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.thing.type.ChannelTypeUID; @@ -72,8 +73,8 @@ public class DenonMarantzBindingConstants { public static final String CHANNEL_ZONE4_MUTE = "zone4#mute"; public static final String CHANNEL_ZONE4_INPUT = "zone4#input"; - // HashMap of Zone2 Channel Type UIDs (to be added to Thing later when needed) - public static final LinkedHashMap ZONE2_CHANNEL_TYPES = new LinkedHashMap(); + // Map of Zone2 Channel Type UIDs (to be added to Thing later when needed) + public static final Map ZONE2_CHANNEL_TYPES = new LinkedHashMap<>(); static { ZONE2_CHANNEL_TYPES.put(CHANNEL_ZONE2_POWER, new ChannelTypeUID(BINDING_ID, "zonePower")); ZONE2_CHANNEL_TYPES.put(CHANNEL_ZONE2_VOLUME, new ChannelTypeUID(BINDING_ID, "volume")); @@ -82,8 +83,8 @@ public class DenonMarantzBindingConstants { ZONE2_CHANNEL_TYPES.put(CHANNEL_ZONE2_INPUT, new ChannelTypeUID(BINDING_ID, "input")); } - // HashMap of Zone3 Channel Type UIDs (to be added to Thing later when needed) - public static final LinkedHashMap ZONE3_CHANNEL_TYPES = new LinkedHashMap(); + // Map of Zone3 Channel Type UIDs (to be added to Thing later when needed) + public static final Map ZONE3_CHANNEL_TYPES = new LinkedHashMap<>(); static { ZONE3_CHANNEL_TYPES.put(CHANNEL_ZONE3_POWER, new ChannelTypeUID(BINDING_ID, "zonePower")); ZONE3_CHANNEL_TYPES.put(CHANNEL_ZONE3_VOLUME, new ChannelTypeUID(BINDING_ID, "volume")); @@ -92,8 +93,8 @@ public class DenonMarantzBindingConstants { ZONE3_CHANNEL_TYPES.put(CHANNEL_ZONE3_INPUT, new ChannelTypeUID(BINDING_ID, "input")); } - // HashMap of Zone4 Channel Type UIDs (to be added to Thing later when needed) - public static final LinkedHashMap ZONE4_CHANNEL_TYPES = new LinkedHashMap(); + // Map of Zone4 Channel Type UIDs (to be added to Thing later when needed) + public static final Map ZONE4_CHANNEL_TYPES = new LinkedHashMap<>(); static { ZONE4_CHANNEL_TYPES.put(CHANNEL_ZONE4_POWER, new ChannelTypeUID(BINDING_ID, "zonePower")); ZONE4_CHANNEL_TYPES.put(CHANNEL_ZONE4_VOLUME, new ChannelTypeUID(BINDING_ID, "volume")); @@ -108,7 +109,7 @@ public class DenonMarantzBindingConstants { * thing-types.xml) * See https://github.com/eclipse/smarthome/pull/4787#issuecomment-362287430 */ - public static final HashMap CHANNEL_ITEM_TYPES = new HashMap(); + public static final Map CHANNEL_ITEM_TYPES = new HashMap<>(); static { CHANNEL_ITEM_TYPES.put(CHANNEL_ZONE2_POWER, "Switch"); CHANNEL_ITEM_TYPES.put(CHANNEL_ZONE2_VOLUME, "Dimmer"); diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java index c4a534de656f7..b5ae903f13639 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java @@ -15,6 +15,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; +import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Pattern; @@ -106,7 +107,7 @@ public void dispose() { private void refreshState() { // Sends a series of state query commands over the telnet connection telnetStateRequest = scheduler.submit(() -> { - ArrayList cmds = new ArrayList(Arrays.asList("PW?", "MS?", "MV?", "ZM?", "MU?", "SI?")); + List cmds = new ArrayList<>(Arrays.asList("PW?", "MS?", "MV?", "ZM?", "MU?", "SI?")); if (config.getZoneCount() > 1) { cmds.add("Z2?"); cmds.add("Z2MU?"); diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandRequest.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandRequest.java index 40a6d42f37f37..51754b86d047f 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandRequest.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandRequest.java @@ -30,7 +30,7 @@ public class AppCommandRequest { @XmlElement(name = "cmd") - private List commands = new ArrayList(); + private List commands = new ArrayList<>(); public AppCommandRequest() { } diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandResponse.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandResponse.java index 34127e6d6a8e8..a3c6bee81837d 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandResponse.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/AppCommandResponse.java @@ -30,7 +30,7 @@ public class AppCommandResponse { @XmlElement(name = "cmd") - private List commands = new ArrayList(); + private List commands = new ArrayList<>(); public AppCommandResponse() { } diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/CommandRx.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/CommandRx.java index 9280e57e1fd67..dc3af4312c3a5 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/CommandRx.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/entities/commands/CommandRx.java @@ -49,7 +49,7 @@ public class CommandRx { private String type; @XmlElement(name = "text") - private List texts = new ArrayList(); + private List texts = new ArrayList<>(); @XmlElementWrapper(name = "functionrename") @XmlElement(name = "list") diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/DigitalSTROMHandlerFactory.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/DigitalSTROMHandlerFactory.java index c1f3e2cdda757..f7df4a7029760 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/DigitalSTROMHandlerFactory.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/DigitalSTROMHandlerFactory.java @@ -50,9 +50,9 @@ public class DigitalSTROMHandlerFactory extends BaseThingHandlerFactory { private final Logger logger = LoggerFactory.getLogger(DigitalSTROMHandlerFactory.class); - private final HashMap discoveryServiceManagers = new HashMap(); + private final Map discoveryServiceManagers = new HashMap<>(); - private HashMap bridgeHandlers; + private Map bridgeHandlers; @Override public boolean supportsThingType(ThingTypeUID thingTypeUID) { @@ -109,7 +109,7 @@ protected ThingHandler createHandler(Thing thing) { if (BridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { BridgeHandler handler = new BridgeHandler((Bridge) thing); if (bridgeHandlers == null) { - bridgeHandlers = new HashMap(); + bridgeHandlers = new HashMap<>(); } bridgeHandlers.put(thing.getUID(), handler); DiscoveryServiceManager discoveryServiceManager = new DiscoveryServiceManager(handler); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/discovery/DiscoveryServiceManager.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/discovery/DiscoveryServiceManager.java index e721edfc1fd7d..6ab6142bd2ef3 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/discovery/DiscoveryServiceManager.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/discovery/DiscoveryServiceManager.java @@ -19,6 +19,7 @@ import org.eclipse.smarthome.config.discovery.AbstractDiscoveryService; import org.eclipse.smarthome.config.discovery.DiscoveryService; import org.eclipse.smarthome.core.thing.ThingTypeUID; +import org.eclipse.smarthome.core.thing.type.ThingType; import org.openhab.binding.digitalstrom.internal.DigitalSTROMBindingConstants; import org.openhab.binding.digitalstrom.internal.handler.BridgeHandler; import org.openhab.binding.digitalstrom.internal.handler.CircuitHandler; @@ -50,7 +51,7 @@ public class DiscoveryServiceManager implements SceneStatusListener, DeviceStatusListener, TemperatureControlStatusListener { - private final HashMap discoveryServices; + private final Map discoveryServices; private final Map> discoveryServiceRegs = new HashMap<>(); private final String bridgeUID; @@ -63,7 +64,7 @@ public class DiscoveryServiceManager */ public DiscoveryServiceManager(BridgeHandler bridgeHandler) { bridgeUID = bridgeHandler.getThing().getUID().getAsString(); - discoveryServices = new HashMap(SceneHandler.SUPPORTED_THING_TYPES.size() + discoveryServices = new HashMap<>(SceneHandler.SUPPORTED_THING_TYPES.size() + DeviceHandler.SUPPORTED_THING_TYPES.size() + CircuitHandler.SUPPORTED_THING_TYPES.size() + ZoneTemperatureControlHandler.SUPPORTED_THING_TYPES.size()); for (ThingTypeUID type : SceneHandler.SUPPORTED_THING_TYPES) { @@ -127,20 +128,17 @@ public void registerDiscoveryServices(BundleContext bundleContext) { if (discoveryServices != null) { for (AbstractDiscoveryService service : discoveryServices.values()) { if (service instanceof SceneDiscoveryService) { - this.discoveryServiceRegs.put(bridgeUID + ((SceneDiscoveryService) service).getID(), - bundleContext.registerService(DiscoveryService.class.getName(), service, - new Hashtable())); + this.discoveryServiceRegs.put(bridgeUID + ((SceneDiscoveryService) service).getID(), bundleContext + .registerService(DiscoveryService.class.getName(), service, new Hashtable<>())); } if (service instanceof DeviceDiscoveryService) { - this.discoveryServiceRegs.put(bridgeUID + ((DeviceDiscoveryService) service).getID(), - bundleContext.registerService(DiscoveryService.class.getName(), service, - new Hashtable())); + this.discoveryServiceRegs.put(bridgeUID + ((DeviceDiscoveryService) service).getID(), bundleContext + .registerService(DiscoveryService.class.getName(), service, new Hashtable<>())); } if (service instanceof ZoneTemperatureControlDiscoveryService) { - this.discoveryServiceRegs.put( - bridgeUID + ((ZoneTemperatureControlDiscoveryService) service).getID(), - bundleContext.registerService(DiscoveryService.class.getName(), service, - new Hashtable())); + this.discoveryServiceRegs + .put(bridgeUID + ((ZoneTemperatureControlDiscoveryService) service).getID(), bundleContext + .registerService(DiscoveryService.class.getName(), service, new Hashtable<>())); } } } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/BridgeHandler.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/BridgeHandler.java index c51c2539001d6..40e308dc3d1b1 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/BridgeHandler.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/BridgeHandler.java @@ -251,7 +251,7 @@ private Config loadAndCheckConfig() { return null; } logger.debug("Loading configuration"); - ArrayList numberExc = new ArrayList(); + List numberExc = new ArrayList<>(); // Parameters can't be null, because of an existing default value. if (thingConfig.get(DigitalSTROMBindingConstants.SENSOR_DATA_UPDATE_INTERVAL) instanceof BigDecimal) { config.setSensordataRefreshInterval( @@ -683,7 +683,7 @@ public void onConnectionStateChange(String newConnectionState, String reason) { */ public List getDevices() { return this.structMan != null && this.structMan.getDeviceMap() != null - ? new LinkedList(this.structMan.getDeviceMap().values()) + ? new LinkedList<>(this.structMan.getDeviceMap().values()) : null; } @@ -728,7 +728,7 @@ public void sendComandsToDSS(Device device, DeviceStateUpdate deviceStateUpdate) * @return Scene list (cannot be null) */ public List getScenes() { - return sceneMan != null ? sceneMan.getScenes() : new LinkedList(); + return sceneMan != null ? sceneMan.getScenes() : new LinkedList<>(); } /** @@ -792,7 +792,7 @@ public void onStatusChanged(ManagerTypes managerType, ManagerStates state) { public List getCircuits() { logger.debug("circuits: {}", structMan.getCircuitMap().values().toString()); return structMan != null && structMan.getCircuitMap() != null - ? new LinkedList(structMan.getCircuitMap().values()) + ? new LinkedList<>(structMan.getCircuitMap().values()) : null; } @@ -838,7 +838,6 @@ public void unregisterTemperatureControlStatusListener( * @return all temperature control status objects */ public Collection getTemperatureControlStatusFromAllZones() { - return tempContMan != null ? tempContMan.getTemperatureControlStatusFromAllZones() - : new LinkedList(); + return tempContMan != null ? tempContMan.getTemperatureControlStatusFromAllZones() : new LinkedList<>(); } } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java index e82a5a82f12e1..aa546efe28354 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/CircuitHandler.java @@ -59,7 +59,7 @@ public class CircuitHandler extends BaseThingHandler implements DeviceStatusList /** * Contains all supported thing types of this handler, will be filled by DsDeviceThingTypeProvider. */ - public static final Set SUPPORTED_THING_TYPES = new HashSet(); + public static final Set SUPPORTED_THING_TYPES = new HashSet<>(); private String dSID; private Circuit circuit; diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/DeviceHandler.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/DeviceHandler.java index f6aca36cc2233..26acb664207db 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/DeviceHandler.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/DeviceHandler.java @@ -83,7 +83,7 @@ public class DeviceHandler extends BaseThingHandler implements DeviceStatusListe /** * Contains all supported thing types of this handler, will be filled by DsDeviceThingTypeProvider. */ - public static final Set SUPPORTED_THING_TYPES = new HashSet(); + public static final Set SUPPORTED_THING_TYPES = new HashSet<>(); public static final String TWO_STAGE_SWITCH_IDENTICATOR = "2"; public static final String THREE_STAGE_SWITCH_IDENTICATOR = "3"; @@ -527,7 +527,7 @@ private void checkDeviceInfoProperties(Device device) { } private String getBinarayInputList() { - List binarayInputs = new ArrayList(device.getBinaryInputs().size()); + List binarayInputs = new ArrayList<>(device.getBinaryInputs().size()); for (DeviceBinaryInput binInput : device.getBinaryInputs()) { DeviceBinarayInputEnum devBinInp = DeviceBinarayInputEnum.getdeviceBinarayInput(binInput.getInputType()); if (devBinInp != null) { @@ -592,7 +592,7 @@ private void loadSensorChannels() { private boolean addLoadedSensorChannel(String sensorChannelType) { if (loadedSensorChannels == null) { - loadedSensorChannels = new LinkedList(); + loadedSensorChannels = new LinkedList<>(); } if (!loadedSensorChannels.contains(sensorChannelType.toString())) { return loadedSensorChannels.add(sensorChannelType.toString()); @@ -615,7 +615,7 @@ private boolean isSensorChannelLoaded(String sensorChannelType) { } private void checkSensorChannel() { - List channelList = new LinkedList(this.getThing().getChannels()); + List channelList = new LinkedList<>(this.getThing().getChannels()); boolean channelListChanged = false; @@ -732,7 +732,7 @@ private void loadOutputChannel(ChannelTypeUID channelTypeUID, String acceptedIte } currentChannel = channelTypeUID.getId(); - List channelList = new LinkedList(this.getThing().getChannels()); + List channelList = new LinkedList<>(this.getThing().getChannels()); boolean channelIsAlreadyLoaded = false; boolean channelListChanged = false; diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/ZoneTemperatureControlHandler.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/ZoneTemperatureControlHandler.java index 36f03b09da645..bc52eaa28a895 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/ZoneTemperatureControlHandler.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/handler/ZoneTemperatureControlHandler.java @@ -47,6 +47,7 @@ import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlStatus; import org.openhab.binding.digitalstrom.internal.lib.listener.TemperatureControlStatusListener; import org.openhab.binding.digitalstrom.internal.lib.manager.StructureManager; +import org.openhab.binding.digitalstrom.internal.lib.manager.impl.TemperatureControlManager; import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.FunctionalColorGroupEnum; import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputModeEnum; import org.openhab.binding.digitalstrom.internal.providers.DsChannelTypeProvider; @@ -312,7 +313,7 @@ public synchronized void configChanged(TemperatureControlStatus tempControlStatu } private synchronized void loadChannel() { - List newChannelList = new ArrayList(1); + List newChannelList = new ArrayList<>(1); if (currentChannelID != null) { newChannelList.add(ChannelBuilder .create(new ChannelUID(this.getThing().getUID(), currentChannelID), diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/BaseSensorValues.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/BaseSensorValues.java index 4c4656c5a959b..c9d08af3cd770 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/BaseSensorValues.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/BaseSensorValues.java @@ -75,7 +75,7 @@ protected void addSensorValue(JsonObject jObject, boolean outdoor) { private void addSensorValue(CachedSensorValue cachedSensorValue) { if (sensorValues == null) { - sensorValues = new LinkedList(); + sensorValues = new LinkedList<>(); sensorValues.add(cachedSensorValue); } else { sensorValues.add(cachedSensorValue); @@ -88,7 +88,7 @@ private void addSensorValue(CachedSensorValue cachedSensorValue) { * @return available sensor types */ public List getAvailableSensorTypes() { - List sensorTypes = new LinkedList(); + List sensorTypes = new LinkedList<>(); if (sensorValues != null) { for (CachedSensorValue cSensorValue : sensorValues) { sensorTypes.add(cSensorValue.getSensorType()); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/AssignedSensors.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/AssignedSensors.java index 3b7896d8d1e28..398bcff565d3d 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/AssignedSensors.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/AssignedSensors.java @@ -65,7 +65,7 @@ private void init(JsonObject jObject) { && jObject.get(JSONApiResponseKeysEnum.SENSORS.getKey()).isJsonArray()) { JsonArray jArray = jObject.get(JSONApiResponseKeysEnum.SENSORS.getKey()).getAsJsonArray(); if (jArray.size() != 0) { - sensors = new LinkedList(); + sensors = new LinkedList<>(); Iterator iter = jArray.iterator(); while (iter.hasNext()) { JsonObject assignedSensor = iter.next().getAsJsonObject(); @@ -90,7 +90,7 @@ private void init(JsonObject jObject) { * @return list of all assigned sensor types */ public List getAssignedZoneSensorTypes() { - List sensorTypes = new LinkedList(); + List sensorTypes = new LinkedList<>(); if (sensors != null) { for (AssignSensorType aSensorValue : sensors) { sensorTypes.add(aSensorValue.getSensorType()); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/TemperatureControlValues.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/TemperatureControlValues.java index 6828d026ae11e..789f619bdb1b0 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/TemperatureControlValues.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/climate/jsonresponsecontainer/impl/TemperatureControlValues.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl; import java.util.HashMap; +import java.util.Map; import java.util.Set; import org.openhab.binding.digitalstrom.internal.lib.climate.constants.OperationModes; @@ -31,7 +32,7 @@ */ public class TemperatureControlValues extends BaseZoneIdentifier { - private HashMap temperatureControlValues; + private Map temperatureControlValues; private String controlDSUID; private Boolean isConfigured; @@ -69,7 +70,7 @@ private void init(JsonObject jObject) { if (jObject.get(JSONApiResponseKeysEnum.CONTROL_DSUID.getKey()) != null) { this.controlDSUID = jObject.get(JSONApiResponseKeysEnum.CONTROL_DSUID.getKey()).getAsString(); } - temperatureControlValues = new HashMap(OperationModes.values().length); + temperatureControlValues = new HashMap<>(OperationModes.values().length); for (OperationModes opMode : OperationModes.values()) { if (jObject.get(opMode.getKey()) != null) { temperatureControlValues.put(opMode, jObject.get(opMode.getKey()).getAsFloat()); @@ -114,11 +115,11 @@ public Set getOperationModes() { } /** - * Returns a {@link HashMap} that maps the available operation modes to the set values. + * Returns a {@link Map} that maps the available operation modes to the set values. * - * @return HashMap with operation modes and their values + * @return Map with operation modes and their values */ - public HashMap getTemperatureControlValues() { + public Map getTemperatureControlValues() { return temperatureControlValues; } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/EventListener.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/EventListener.java index c71b017da35b0..8e113d2c09954 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/EventListener.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/EventListener.java @@ -65,7 +65,7 @@ public class EventListener { private int subscriptionID = 15; private final int timeout = 500; - private final List subscribedEvents = Collections.synchronizedList(new LinkedList()); + private final List subscribedEvents = Collections.synchronizedList(new LinkedList<>()); private boolean subscribed = false; // error message @@ -74,7 +74,7 @@ public class EventListener { // found." private final ConnectionManager connManager; - private final List eventHandlers = Collections.synchronizedList(new LinkedList()); + private final List eventHandlers = Collections.synchronizedList(new LinkedList<>()); private final Config config; private boolean isStarted = false; @@ -218,7 +218,7 @@ public void addEventHandler(EventHandler eventHandler) { */ public void removeEventHandler(EventHandler eventHandler) { if (eventHandler != null && eventHandlers.contains(eventHandler)) { - List tempSubsList = new ArrayList(); + List tempSubsList = new ArrayList<>(); int index = -1; EventHandler intEventHandler = null; boolean subscribedEventsChanged = false; diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/constants/EventResponseEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/constants/EventResponseEnum.java index ff4b747b6885f..fff08a85728f1 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/constants/EventResponseEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/constants/EventResponseEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.event.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link EventResponseEnum} contains digitalSTROM-Event properties of the events at {@link EventNames}. @@ -66,7 +67,7 @@ public enum EventResponseEnum { INPUT_INDEX("inputIndex"); private final String id; - static final HashMap EVENT_RESPONSE_FIELDS = new HashMap(); + static final Map EVENT_RESPONSE_FIELDS = new HashMap<>(); static { for (EventResponseEnum ev : EventResponseEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/EventItemImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/EventItemImpl.java index b29eab5b923cd..cac8870c7356e 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/EventItemImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/EventItemImpl.java @@ -15,12 +15,11 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import org.openhab.binding.digitalstrom.internal.lib.event.constants.EventResponseEnum; import org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants.JSONApiResponseKeysEnum; -import java.util.Set; - import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -47,7 +46,7 @@ public EventItemImpl(JsonObject jsonEventItem) { if (jsonEventItem.get(JSONApiResponseKeysEnum.PROPERTIES.getKey()).isJsonObject()) { Set> propObjEntrySet = jsonEventItem .get(JSONApiResponseKeysEnum.PROPERTIES.getKey()).getAsJsonObject().entrySet(); - properties = new HashMap(propObjEntrySet.size()); + properties = new HashMap<>(propObjEntrySet.size()); for (Entry entry : propObjEntrySet) { if (EventResponseEnum.containsId(entry.getKey())) { addProperty(EventResponseEnum.getProperty(entry.getKey()), entry.getValue().getAsString()); @@ -57,7 +56,7 @@ public EventItemImpl(JsonObject jsonEventItem) { if (jsonEventItem.get(JSONApiResponseKeysEnum.SOURCE.getKey()).isJsonObject()) { Set> sourceObjEntrySet = jsonEventItem .get(JSONApiResponseKeysEnum.SOURCE.getKey()).getAsJsonObject().entrySet(); - source = new HashMap(sourceObjEntrySet.size()); + source = new HashMap<>(sourceObjEntrySet.size()); for (Entry entry : sourceObjEntrySet) { if (EventResponseEnum.containsId(entry.getKey())) { addSource(EventResponseEnum.getProperty(entry.getKey()), entry.getValue().getAsString()); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/JSONEventImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/JSONEventImpl.java index e11595e87c21c..c232ea6471dcc 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/JSONEventImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/event/types/JSONEventImpl.java @@ -33,7 +33,7 @@ public class JSONEventImpl implements Event { * @param jsonEventArray must not be null */ public JSONEventImpl(JsonArray jsonEventArray) { - this.eventItemList = new LinkedList(); + this.eventItemList = new LinkedList<>(); for (int i = 0; i < jsonEventArray.size(); i++) { if (jsonEventArray.get(i) instanceof JsonObject) { this.eventItemList.add(new EventItemImpl((JsonObject) jsonEventArray.get(i))); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/StructureManager.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/StructureManager.java index 58f781fe5c632..5602a8e024905 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/StructureManager.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/StructureManager.java @@ -12,7 +12,6 @@ */ package org.openhab.binding.digitalstrom.internal.lib.manager; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -94,12 +93,12 @@ public interface StructureManager { Map getDeviceHashMapReference(); /** - * Returns the reference of the structure as {@link Map}[zoneID, {@link HashMap}[groupID, + * Returns the reference of the structure as {@link Map}[zoneID, {@link Map}[groupID, * {@link List}[{@link Device}]]]. * * @return structure reference */ - Map>> getStructureReference(); + Map>> getStructureReference(); /** * Returns the Map of all groups as format HashMap[Short, List[Device]]. @@ -107,7 +106,7 @@ public interface StructureManager { * @param zoneID of the zone * @return groups */ - HashMap> getGroupsFromZoneX(int zoneID); + Map> getGroupsFromZoneX(int zoneID); /** * Returns the reference {@link List} of the {@link Device}'s of an zone-group. diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/DeviceStatusManagerImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/DeviceStatusManagerImpl.java index 791e6b43d0fc1..f28cf9ec5a8ed 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/DeviceStatusManagerImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/DeviceStatusManagerImpl.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -112,7 +113,7 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager { private SceneReadingJobExecutor sceneJobExecutor; private EventListener eventListener; - private final List trashDevices = new LinkedList(); + private final List trashDevices = new LinkedList<>(); private long lastBinCheck = 0; private ManagerStates state = ManagerStates.STOPPED; @@ -244,11 +245,11 @@ public void run() { stateChanged(ManagerStates.INITIALIZING); } } - HashMap tempDeviceMap; + Map tempDeviceMap; if (strucMan.getDeviceMap() != null) { - tempDeviceMap = (HashMap) strucMan.getDeviceMap(); + tempDeviceMap = strucMan.getDeviceMap(); } else { - tempDeviceMap = new HashMap(); + tempDeviceMap = new HashMap<>(); } List currentDeviceList = getDetailedDevices(); @@ -403,7 +404,7 @@ public void run() { } private List getDetailedDevices() { - List deviceList = new LinkedList(); + List deviceList = new LinkedList<>(); JsonObject result = connMan.getDigitalSTROMAPI().query2(connMan.getSessionToken(), GET_DETAILD_DEVICES); if (result != null && result.isJsonObject()) { if (result.getAsJsonObject().get(GeneralLibConstance.QUERY_BROADCAST_ZONE_STRING).isJsonObject()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/SceneManagerImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/SceneManagerImpl.java index 1334e664e4457..247eeee541644 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/SceneManagerImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/SceneManagerImpl.java @@ -54,9 +54,8 @@ public class SceneManagerImpl implements SceneManager { private final Logger logger = LoggerFactory.getLogger(SceneManagerImpl.class); - private final List echoBox = Collections.synchronizedList(new LinkedList()); - private final Map internalSceneMap = Collections - .synchronizedMap(new HashMap()); + private final List echoBox = Collections.synchronizedList(new LinkedList<>()); + private final Map internalSceneMap = Collections.synchronizedMap(new HashMap<>()); private EventListener eventListener; private final StructureManager structureManager; @@ -507,7 +506,7 @@ public synchronized ManagerStates getManagerState() { @Override public List getScenes() { - return this.internalSceneMap != null ? new LinkedList(this.internalSceneMap.values()) : null; + return this.internalSceneMap != null ? new LinkedList<>(this.internalSceneMap.values()) : null; } @Override diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/StructureManagerImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/StructureManagerImpl.java index 5fca6688aa1e1..549fb25efc2c4 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/StructureManagerImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/StructureManagerImpl.java @@ -21,6 +21,7 @@ import org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager; import org.openhab.binding.digitalstrom.internal.lib.manager.StructureManager; +import org.openhab.binding.digitalstrom.internal.lib.serverconnection.DsAPI; import org.openhab.binding.digitalstrom.internal.lib.structure.devices.AbstractGeneralDeviceInformations; import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit; import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device; @@ -75,11 +76,11 @@ public short getGroupID(String groupName) { */ public static final String ZONE_GROUP_NAMES = "/apartment/zones/*(ZoneID,name)/groups/*(group,name)"; - private final Map>> zoneGroupDeviceMap = Collections - .synchronizedMap(new HashMap>>()); - private final Map deviceMap = Collections.synchronizedMap(new HashMap()); - private final Map circuitMap = Collections.synchronizedMap(new HashMap()); - private final Map dSUIDToDSIDMap = Collections.synchronizedMap(new HashMap()); + private final Map>> zoneGroupDeviceMap = Collections + .synchronizedMap(new HashMap<>()); + private final Map deviceMap = Collections.synchronizedMap(new HashMap<>()); + private final Map circuitMap = Collections.synchronizedMap(new HashMap<>()); + private final Map dSUIDToDSIDMap = Collections.synchronizedMap(new HashMap<>()); private Map zoneGroupIdNameMap; private Map zoneGroupNameIdMap; @@ -118,8 +119,8 @@ public boolean generateZoneGroupNames(ConnectionManager connectionManager) { if (resultJsonObj != null && resultJsonObj.get("zones") instanceof JsonArray) { JsonArray zones = (JsonArray) resultJsonObj.get("zones"); if (zoneGroupIdNameMap == null) { - zoneGroupIdNameMap = new HashMap(zones.size()); - zoneGroupNameIdMap = new HashMap(zones.size()); + zoneGroupIdNameMap = new HashMap<>(zones.size()); + zoneGroupNameIdMap = new HashMap<>(zones.size()); } if (zones != null) { for (int i = 0; i < zones.size(); i++) { @@ -172,7 +173,7 @@ public boolean checkZoneID(int zoneID) { @Override public boolean checkZoneGroupID(int zoneID, short groupID) { - final HashMap> tmp = getGroupsFromZoneX(zoneID); + final Map> tmp = getGroupsFromZoneX(zoneID); return tmp != null ? tmp.get(groupID) != null : false; } @@ -187,7 +188,7 @@ public short getZoneGroupId(String zoneName, String groupName) { @Override public Map getDeviceMap() { - return new HashMap(deviceMap); + return new HashMap<>(deviceMap); } private void putDeviceToHashMap(Device device) { @@ -205,7 +206,7 @@ private void putDeviceToHashMap(Device device) { * Note: the zone id 0 is the broadcast address and the group id 0, too. */ private void handleStructure(List deviceList) { - HashMap> groupXHashMap = new HashMap>(); + Map> groupXHashMap = new HashMap<>(); groupXHashMap.put((short) 0, deviceList); zoneGroupDeviceMap.put(0, groupXHashMap); @@ -221,18 +222,18 @@ public Map getDeviceHashMapReference() { } @Override - public Map>> getStructureReference() { + public Map>> getStructureReference() { return zoneGroupDeviceMap; } @Override - public HashMap> getGroupsFromZoneX(int zoneID) { + public Map> getGroupsFromZoneX(int zoneID) { return zoneGroupDeviceMap.get(zoneID); } @Override public List getReferenceDeviceListFromZoneXGroupX(int zoneID, short groupID) { - final HashMap> tmp = getGroupsFromZoneX(zoneID); + final Map> tmp = getGroupsFromZoneX(zoneID); return tmp != null ? tmp.get(groupID) : null; } @@ -336,14 +337,14 @@ public void addDeviceToStructure(Device device) { } private void addDevicetoZoneXGroupX(int zoneID, short groupID, Device device) { - HashMap> groupXHashMap = zoneGroupDeviceMap.get(zoneID); + Map> groupXHashMap = zoneGroupDeviceMap.get(zoneID); if (groupXHashMap == null) { - groupXHashMap = new HashMap>(); + groupXHashMap = new HashMap<>(); zoneGroupDeviceMap.put(zoneID, groupXHashMap); } List groupDeviceList = groupXHashMap.get(groupID); if (groupDeviceList == null) { - groupDeviceList = new LinkedList(); + groupDeviceList = new LinkedList<>(); groupDeviceList.add(device); groupXHashMap.put(groupID, groupDeviceList); } else { @@ -419,6 +420,6 @@ public Circuit deleteCircuit(String dSUID) { @Override public Map getCircuitMap() { - return new HashMap(circuitMap); + return new HashMap<>(circuitMap); } } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/TemperatureControlManager.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/TemperatureControlManager.java index 767b10173e106..023f98043f0c2 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/TemperatureControlManager.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/manager/impl/TemperatureControlManager.java @@ -114,7 +114,7 @@ public class TemperatureControlManager implements EventHandler, TemperatureContr private String currentHeatingWaterSystemStage; - private final List echoBox = Collections.synchronizedList(new LinkedList()); + private final List echoBox = Collections.synchronizedList(new LinkedList<>()); /** * Creates a new {@link TemperatureControlManager}. The {@link ConnectionManager} is needed. The other fields are @@ -196,8 +196,7 @@ public static boolean isHeatingControllerInstallated(ConnectionManager connectio * @return all temperature controlled zones */ public Collection getTemperatureControlStatusFromAllZones() { - return temperationControlStatus != null ? this.temperationControlStatus.values() - : new LinkedList(); + return temperationControlStatus != null ? this.temperationControlStatus.values() : new LinkedList<>(); } /** @@ -222,7 +221,7 @@ public void registerTemperatureControlStatusListener( } } else { if (zoneTemperationControlListenerMap == null) { - zoneTemperationControlListenerMap = new HashMap(); + zoneTemperationControlListenerMap = new HashMap<>(); } TemperatureControlStatus tempConStat = checkAndGetTemperatureControlStatus( temperatureControlStatusListener.getTemperationControlStatusListenrID()); @@ -339,7 +338,7 @@ public void handleEvent(EventItem eventItem) { private void addTemperatureControlStatus(TemperatureControlStatus temperationControlStatus) { if (temperationControlStatus.isNotSetOff()) { if (this.temperationControlStatus == null) { - this.temperationControlStatus = new HashMap(); + this.temperationControlStatus = new HashMap<>(); } if (this.temperationControlStatus.get(temperationControlStatus.getZoneID()) == null && discovery != null) { discovery.configChanged(temperationControlStatus); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/AbstractSensorJobExecutor.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/AbstractSensorJobExecutor.java index d4a86717c4637..33fee86c8775a 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/AbstractSensorJobExecutor.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/AbstractSensorJobExecutor.java @@ -57,7 +57,7 @@ public abstract class AbstractSensorJobExecutor { protected Config config; private final ConnectionManager connectionManager; - private final List circuitSchedulerList = new LinkedList(); + private final List circuitSchedulerList = new LinkedList<>(); private class ExecutorRunnable implements Runnable { private final CircuitScheduler circuit; @@ -109,7 +109,7 @@ public synchronized void shutdown() { public synchronized void startExecutor() { logger.debug("start all circuit schedulers."); if (pollingSchedulers == null) { - pollingSchedulers = new HashMap>(); + pollingSchedulers = new HashMap<>(); } if (circuitSchedulerList != null && !circuitSchedulerList.isEmpty()) { for (CircuitScheduler circuit : circuitSchedulerList) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/CircuitScheduler.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/CircuitScheduler.java index f7fec839446c3..5e2467125a25f 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/CircuitScheduler.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/sensorjobexecutor/CircuitScheduler.java @@ -43,7 +43,7 @@ public int compare(SensorJob job1, SensorJob job2) { private final DSID meterDSID; private long nextExecutionTime = System.currentTimeMillis(); - private final PriorityQueue sensorJobQueue = new PriorityQueue(10, new SensorJobComparator()); + private final PriorityQueue sensorJobQueue = new PriorityQueue<>(10, new SensorJobComparator()); private final Config config; /** diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/DsAPI.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/DsAPI.java index 1aa03836a49d4..56bfcadf6fd64 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/DsAPI.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/DsAPI.java @@ -12,10 +12,11 @@ */ package org.openhab.binding.digitalstrom.internal.lib.serverconnection; -import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openhab.binding.digitalstrom.internal.lib.climate.constants.ControlModes; +import org.openhab.binding.digitalstrom.internal.lib.climate.constants.OperationModes; import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.BaseSensorValues; import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.AssignedSensors; import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.SensorValues; @@ -829,7 +830,7 @@ TemperatureControlInternals getZoneTemperatureControlInternals(String sessionTok * registered at the {@link HttpTransport} * @return temperature control status of all zones */ - HashMap getApartmentTemperatureControlConfig(String sessionToken); + Map getApartmentTemperatureControlConfig(String sessionToken); /** * Returns the temperature control status of all zones. @@ -839,7 +840,7 @@ TemperatureControlInternals getZoneTemperatureControlInternals(String sessionTok * registered at the {@link HttpTransport} * @return temperature control status of all zones */ - HashMap getApartmentTemperatureControlValues(String sessionToken); + Map getApartmentTemperatureControlValues(String sessionToken); /** * Returns the assigned Sensor dSUID of all zones. @@ -850,7 +851,7 @@ TemperatureControlInternals getZoneTemperatureControlInternals(String sessionTok * registered at the {@link HttpTransport} * @return assigned Sensor dSUID of all zones. */ - HashMap getApartmentAssignedSensors(String sessionToken); + Map getApartmentAssignedSensors(String sessionToken); /** * Returns the value of a Sensor of all zones. @@ -860,7 +861,7 @@ TemperatureControlInternals getZoneTemperatureControlInternals(String sessionTok * registered at the {@link HttpTransport} * @return value of a Sensor of all zones */ - HashMap getApartmentSensorValues(String sessionToken); + Map getApartmentSensorValues(String sessionToken); /** * Description taken form digitalSTROM JSON-API:
diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/impl/DsAPIImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/impl/DsAPIImpl.java index 4b1f85a7ccb6e..ba9d423f45ead 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/impl/DsAPIImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/serverconnection/impl/DsAPIImpl.java @@ -191,7 +191,7 @@ public List getApartmentDevices(String token) { && responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey()) instanceof JsonArray) { JsonArray array = (JsonArray) responseObj.get(JSONApiResponseKeysEnum.RESULT.getKey()); - List deviceList = new LinkedList(); + List deviceList = new LinkedList<>(); for (int i = 0; i < array.size(); i++) { if (array.get(i) instanceof JsonObject) { deviceList.add(new DeviceImpl((JsonObject) array.get(i))); @@ -199,7 +199,7 @@ public List getApartmentDevices(String token) { } return deviceList; } - return new LinkedList(); + return new LinkedList<>(); } @Override @@ -214,7 +214,7 @@ public List getApartmentCircuits(String sessionToken) { if (responseObj.get(JSONApiResponseKeysEnum.CIRCUITS.getKey()).isJsonArray()) { JsonArray array = responseObj.get(JSONApiResponseKeysEnum.CIRCUITS.getKey()).getAsJsonArray(); - List circuitList = new LinkedList(); + List circuitList = new LinkedList<>(); for (int i = 0; i < array.size(); i++) { if (array.get(i).isJsonObject()) { circuitList.add(new CircuitImpl(array.get(i).getAsJsonObject())); @@ -223,7 +223,7 @@ public List getApartmentCircuits(String sessionToken) { return circuitList; } } - return new LinkedList(); + return new LinkedList<>(); } @Override @@ -483,7 +483,7 @@ public List getResolutions(String token) { if (resObj != null && resObj.get(JSONApiResponseKeysEnum.RESOLUTIONS.getKey()) instanceof JsonArray) { JsonArray array = (JsonArray) resObj.get(JSONApiResponseKeysEnum.RESOLUTIONS.getKey()); - List resolutionList = new LinkedList(); + List resolutionList = new LinkedList<>(); for (int i = 0; i < array.size(); i++) { if (array.get(i) instanceof JsonObject) { JsonObject jObject = (JsonObject) array.get(i); @@ -543,7 +543,7 @@ public List getLatest(String token, MeteringTypeEnum type, if (latestObj != null && latestObj.get(JSONApiResponseKeysEnum.VALUES.getKey()) instanceof JsonArray) { JsonArray array = (JsonArray) latestObj.get(JSONApiResponseKeysEnum.VALUES.getKey()); - List list = new LinkedList(); + List list = new LinkedList<>(); for (int i = 0; i < array.size(); i++) { if (array.get(i) instanceof JsonObject) { list.add(new JSONCachedMeteringValueImpl((JsonObject) array.get(i), type, unit)); @@ -572,7 +572,7 @@ public boolean setDeviceValue(String token, DSID dSID, String dSUID, String name @Override public List getMeterList(String token) { - List meterList = new LinkedList(); + List meterList = new LinkedList<>(); JsonObject responseObj = query(token, QUERY_GET_METERLIST); if (responseObj != null && responseObj.get(JSONApiResponseKeysEnum.DS_METERS.getKey()).isJsonArray()) { JsonArray array = responseObj.get(JSONApiResponseKeysEnum.DS_METERS.getKey()).getAsJsonArray(); @@ -647,7 +647,7 @@ public Map getDSID(String token) { if (JSONResponseHandler.checkResponse(responseObj)) { JsonObject obj = JSONResponseHandler.getResultJsonObject(responseObj); if (obj != null) { - Map dsidMap = new HashMap(obj.entrySet().size()); + Map dsidMap = new HashMap<>(obj.entrySet().size()); for (Entry entry : obj.entrySet()) { dsidMap.put(entry.getKey(), entry.getValue().getAsString()); } @@ -1109,7 +1109,7 @@ public List getApartmentTemperatureControlStatus(Strin if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); if (jArray.size() != 0) { - List list = new ArrayList(jArray.size()); + List list = new ArrayList<>(jArray.size()); Iterator iter = jArray.iterator(); while (iter.hasNext()) { TemperatureControlStatus tContStat = new TemperatureControlStatus( @@ -1124,7 +1124,7 @@ public List getApartmentTemperatureControlStatus(Strin } @Override - public HashMap getApartmentTemperatureControlConfig(String sessionToken) { + public Map getApartmentTemperatureControlConfig(String sessionToken) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT) .addFunction(FunctionKeys.GET_TEMPERATURE_CONTROL_CONFIG) .addParameter(ParameterKeys.TOKEN, sessionToken).buildRequestString()); @@ -1135,8 +1135,7 @@ public HashMap getApartmentTemperatureControl if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); if (jArray.size() != 0) { - HashMap map = new HashMap( - jArray.size()); + Map map = new HashMap<>(jArray.size()); Iterator iter = jArray.iterator(); while (iter.hasNext()) { TemperatureControlConfig tContConf = new TemperatureControlConfig( @@ -1151,7 +1150,7 @@ public HashMap getApartmentTemperatureControl } @Override - public HashMap getApartmentTemperatureControlValues(String sessionToken) { + public Map getApartmentTemperatureControlValues(String sessionToken) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT) .addFunction(FunctionKeys.GET_TEMPERATURE_CONTROL_VALUES) .addParameter(ParameterKeys.TOKEN, sessionToken).buildRequestString()); @@ -1162,8 +1161,7 @@ public HashMap getApartmentTemperatureControl if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); if (jArray.size() != 0) { - HashMap map = new HashMap( - jArray.size()); + Map map = new HashMap<>(jArray.size()); Iterator iter = jArray.iterator(); while (iter.hasNext()) { TemperatureControlValues tContVal = new TemperatureControlValues(iter.next().getAsJsonObject()); @@ -1177,7 +1175,7 @@ public HashMap getApartmentTemperatureControl } @Override - public HashMap getApartmentAssignedSensors(String sessionToken) { + public Map getApartmentAssignedSensors(String sessionToken) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT) .addFunction(FunctionKeys.GET_ASSIGNED_SENSORS).addParameter(ParameterKeys.TOKEN, sessionToken) .buildRequestString()); @@ -1188,7 +1186,7 @@ public HashMap getApartmentAssignedSensors(String sess if (obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).isJsonArray()) { JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); if (jArray.size() != 0) { - HashMap map = new HashMap(jArray.size()); + HashMap map = new HashMap<>(jArray.size()); Iterator iter = jArray.iterator(); while (iter.hasNext()) { AssignedSensors assignedSensors = new AssignedSensors(iter.next().getAsJsonObject()); @@ -1202,7 +1200,7 @@ public HashMap getApartmentAssignedSensors(String sess } @Override - public HashMap getApartmentSensorValues(String sessionToken) { + public Map getApartmentSensorValues(String sessionToken) { String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.APARTMENT) .addFunction(FunctionKeys.GET_SENSOR_VALUES).addParameter(ParameterKeys.TOKEN, sessionToken) .buildRequestString()); @@ -1214,7 +1212,7 @@ public HashMap getApartmentSensorValues(String sessio JsonArray jArray = obj.get(JSONApiResponseKeysEnum.ZONES.getKey()).getAsJsonArray(); WeatherSensorData weather = new WeatherSensorData(obj); if (jArray.size() != 0) { - HashMap map = new HashMap(jArray.size() + 1); + HashMap map = new HashMap<>(jArray.size() + 1); Iterator iter = jArray.iterator(); while (iter.hasNext()) { SensorValues sensorValues = new SensorValues(iter.next().getAsJsonObject()); @@ -1363,7 +1361,7 @@ public Map propertyTreeGetFlages(String sessionToken, String pa if (JSONResponseHandler.checkResponse(responseObj)) { responseObj = JSONResponseHandler.getResultJsonObject(responseObj); Set> flagEntries = responseObj.entrySet(); - Map flags = new HashMap(flagEntries.size()); + Map flags = new HashMap<>(flagEntries.size()); for (Entry flag : flagEntries) { flags.put(flag.getKey(), flag.getValue().getAsBoolean()); } @@ -1399,7 +1397,7 @@ public Map getSystemVersion() { JsonObject responseObj = JSONResponseHandler.toJsonObject(response); if (JSONResponseHandler.checkResponse(responseObj)) { Set> entries = JSONResponseHandler.getResultJsonObject(responseObj).entrySet(); - Map versions = new HashMap(entries.size()); + Map versions = new HashMap<>(entries.size()); for (Entry entry : entries) { versions.put(entry.getKey(), entry.getValue().getAsString()); } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FuncNameAndColorGroupEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FuncNameAndColorGroupEnum.java index d5aa248d7d9a8..795ddf7d7df20 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FuncNameAndColorGroupEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FuncNameAndColorGroupEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link FuncNameAndColorGroupEnum} contains all digitalSTROM functional group names and links to their @@ -61,7 +62,7 @@ public enum FuncNameAndColorGroupEnum { private final short colorGroup; private final FunctionalColorGroupEnum color; - static final HashMap COLOR_GROUPS = new HashMap(); + static final Map COLOR_GROUPS = new HashMap<>(); static { for (FuncNameAndColorGroupEnum colorGroup : FuncNameAndColorGroupEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FunctionalColorGroupEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FunctionalColorGroupEnum.java index add9cad553560..d6640cfe5b9c7 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FunctionalColorGroupEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/FunctionalColorGroupEnum.java @@ -15,6 +15,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Map; /** * The {@link FunctionalColorGroupEnum} contains all digitalSTROM functional color groups. @@ -56,7 +57,7 @@ public enum FunctionalColorGroupEnum { private final List colorGroup; - static final HashMap COLOR_GROUPS = new HashMap(); + static final Map COLOR_GROUPS = new HashMap<>(); static { for (FunctionalColorGroupEnum colorGroup : FunctionalColorGroupEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/OutputModeEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/OutputModeEnum.java index cdcde7b619952..74171e85e238c 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/OutputModeEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/OutputModeEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link OutputModeEnum} lists all available digitalSTROM-device output modes. @@ -89,7 +90,7 @@ public enum OutputModeEnum { private final int mode; - static final HashMap OUTPUT_MODES = new HashMap(); + static final Map OUTPUT_MODES = new HashMap<>(); static { for (OutputModeEnum out : OutputModeEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/SensorEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/SensorEnum.java index 7a887553e114e..f6c581329bcba 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/SensorEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/deviceparameters/constants/SensorEnum.java @@ -82,7 +82,7 @@ public enum SensorEnum { private final Float max; private final Float resolution; - static final Map SENSOR_ENUMS = new HashMap(); + static final Map SENSOR_ENUMS = new HashMap<>(); SensorEnum(Short sensorType, String unit, String unitShortcut, int min, float max, float resolution, String plattern) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/impl/DeviceImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/impl/DeviceImpl.java index 33400de0d2e3d..8f89c85407e96 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/impl/DeviceImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/devices/impl/DeviceImpl.java @@ -68,7 +68,7 @@ public class DeviceImpl extends AbstractGeneralDeviceInformations implements Dev private DSID meterDSID; private int zoneId = 0; - private List groupList = new LinkedList(); + private List groupList = new LinkedList<>(); private FunctionalColorGroupEnum functionalGroup; private FuncNameAndColorGroupEnum functionalName; @@ -90,12 +90,10 @@ public class DeviceImpl extends AbstractGeneralDeviceInformations implements Dev private final int maxSlatPosition = DeviceConstants.MAX_ROLLERSHUTTER; private final int minSlatPosition = DeviceConstants.MIN_ROLLERSHUTTER; - private final List deviceSensorValues = Collections - .synchronizedList(new ArrayList()); - private final List deviceBinaryInputs = Collections - .synchronizedList(new ArrayList()); - private final List devicePowerSensorTypes = new ArrayList(); - private final List deviceClimateSensorTypes = new ArrayList(); + private final List deviceSensorValues = Collections.synchronizedList(new ArrayList<>()); + private final List deviceBinaryInputs = Collections.synchronizedList(new ArrayList<>()); + private final List devicePowerSensorTypes = new ArrayList<>(); + private final List deviceClimateSensorTypes = new ArrayList<>(); // for scenes private short activeSceneNumber = -1; @@ -105,13 +103,11 @@ public class DeviceImpl extends AbstractGeneralDeviceInformations implements Dev private short slatAngleBeforeSceneCall = 0; private boolean lastCallWasUndo = false; - private final Map sceneConfigMap = Collections - .synchronizedMap(new HashMap()); - private final Map sceneOutputMap = Collections.synchronizedMap(new HashMap()); + private final Map sceneConfigMap = Collections.synchronizedMap(new HashMap<>()); + private final Map sceneOutputMap = Collections.synchronizedMap(new HashMap<>()); // saves outstanding commands - private final List deviceStateUpdates = Collections - .synchronizedList(new LinkedList()); + private final List deviceStateUpdates = Collections.synchronizedList(new LinkedList<>()); /* * Saves the refresh priorities and reading initialized flag of power sensors as an matrix. @@ -137,8 +133,7 @@ public class DeviceImpl extends AbstractGeneralDeviceInformations implements Dev * the key is the output value and the value is an Integer array for the sensor values (0 = active power, 1 = * output current, 2 = power consumption, 3 = output current high) */ - private final Map cachedSensorPowerValues = Collections - .synchronizedMap(new HashMap()); + private final Map cachedSensorPowerValues = Collections.synchronizedMap(new HashMap<>()); public static final int ACTIVE_POWER_ARRAY_FIELD = 0; public static final int OUTPUT_CURRENT_ARRAY_FIELD = 1; @@ -275,7 +270,7 @@ public String getHWinfo() { @Override public List getGroups() { - return new LinkedList(groupList); + return new LinkedList<>(groupList); } @Override @@ -890,9 +885,9 @@ private void internalSetSceneOutputValue(short sceneId, int value, int angle) { @Override public List getSavedScenes() { - Set bothKeySet = new HashSet(sceneOutputMap.keySet()); + Set bothKeySet = new HashSet<>(sceneOutputMap.keySet()); bothKeySet.addAll(sceneConfigMap.keySet()); - return new LinkedList(bothKeySet); + return new LinkedList<>(bothKeySet); } @Override @@ -1176,7 +1171,7 @@ private short internalSetAngleValue(int value) { // Device sensors @Override public List getSensorTypes() { - List list = new ArrayList(devicePowerSensorTypes); + List list = new ArrayList<>(devicePowerSensorTypes); list.addAll(deviceClimateSensorTypes); return list; } @@ -1247,7 +1242,7 @@ private boolean isEchoSensor(SensorEnum sensorType) { return sensorEchoBox != null ? sensorEchoBox.contains(sensorType) : false; } - private List sensorEchoBox = Collections.synchronizedList(new LinkedList()); + private List sensorEchoBox = Collections.synchronizedList(new LinkedList<>()); @Override public void setDeviceSensorDsValueBySensorJob(SensorEnum sensorType, Integer value) { @@ -1268,7 +1263,7 @@ public void setDeviceSensorDsValueBySensorJob(SensorEnum sensorType, Integer val @Override public void enableSensorEchoBox() { if (sensorEchoBox == null) { - sensorEchoBox = Collections.synchronizedList(new LinkedList()); + sensorEchoBox = Collections.synchronizedList(new LinkedList<>()); } } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONApartmentImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONApartmentImpl.java index 2ed1f57f7e409..21240858f25c9 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONApartmentImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONApartmentImpl.java @@ -31,7 +31,7 @@ */ public class JSONApartmentImpl implements Apartment { - private Map zoneMap = new HashMap(); + private Map zoneMap = new HashMap<>(); /** * Creates a new {@link JSONApartmentImpl} through the {@link JsonObject}. diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONDetailedGroupInfoImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONDetailedGroupInfoImpl.java index 700585d8b8074..10ed3a7944018 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONDetailedGroupInfoImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONDetailedGroupInfoImpl.java @@ -40,7 +40,7 @@ public class JSONDetailedGroupInfoImpl implements DetailedGroupInfo { * @param jObject of the server response, must not be null */ public JSONDetailedGroupInfoImpl(JsonObject jObject) { - this.deviceList = new LinkedList(); + this.deviceList = new LinkedList<>(); if (jObject.get(JSONApiResponseKeysEnum.NAME.getKey()) != null) { name = jObject.get(JSONApiResponseKeysEnum.NAME.getKey()).getAsString(); } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONZoneImpl.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONZoneImpl.java index d12ad3b7b1f27..ce889aff7a6dd 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONZoneImpl.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/impl/JSONZoneImpl.java @@ -45,8 +45,8 @@ public class JSONZoneImpl implements Zone { * @param jObject of the server response, must not be null */ public JSONZoneImpl(JsonObject jObject) { - this.groupList = new LinkedList(); - this.deviceList = new LinkedList(); + this.groupList = new LinkedList<>(); + this.deviceList = new LinkedList<>(); if (jObject.get(JSONApiResponseKeysEnum.NAME.getKey()) != null) { this.name = jObject.get(JSONApiResponseKeysEnum.NAME.getKey()).getAsString(); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/InternalScene.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/InternalScene.java index 89736643a03b8..19ebbdae401e5 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/InternalScene.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/InternalScene.java @@ -38,7 +38,7 @@ public class InternalScene { private boolean deviceHasChanged = false; private String sceneType = SceneTypes.GROUP_SCENE; - private List devices = Collections.synchronizedList(new LinkedList()); + private List devices = Collections.synchronizedList(new LinkedList<>()); private SceneStatusListener listener; /** diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/SceneDiscovery.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/SceneDiscovery.java index ba7ce818dbcd7..21b34a2d884b4 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/SceneDiscovery.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/SceneDiscovery.java @@ -50,7 +50,7 @@ public class SceneDiscovery { // fields: 0 = namedScenes, 1 = apartmentScenes, 2 = zoneScenes, 3 = reachableScenes private final char[] scenesGenerated = "0000".toCharArray(); - private final List namedScenes = new LinkedList(); + private final List namedScenes = new LinkedList<>(); private boolean genList = false; ScheduledFuture generateReachableScenesScheduledFuture; @@ -347,14 +347,14 @@ private HashMap> getReachableGroups(ConnectionManager conne JsonObject resultJsonObj = JSONResponseHandler.getResultJsonObject(responsJsonObj); if (resultJsonObj.get(JSONApiResponseKeysEnum.ZONES.getKey()) instanceof JsonArray) { JsonArray zones = (JsonArray) resultJsonObj.get(JSONApiResponseKeysEnum.ZONES.getKey()); - reachableGroupsMap = new HashMap>(zones.size()); + reachableGroupsMap = new HashMap<>(zones.size()); List groupList; for (int i = 0; i < zones.size(); i++) { if (((JsonObject) zones.get(i)) .get(JSONApiResponseKeysEnum.GROUPS.getKey()) instanceof JsonArray) { JsonArray groups = (JsonArray) ((JsonObject) zones.get(i)) .get(JSONApiResponseKeysEnum.GROUPS.getKey()); - groupList = new LinkedList(); + groupList = new LinkedList<>(); for (int k = 0; k < groups.size(); k++) { groupList.add(groups.get(k).getAsShort()); } diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ApartmentSceneEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ApartmentSceneEnum.java index 34ad4a36e1663..2a5feab37dc67 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ApartmentSceneEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ApartmentSceneEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link ApartmentSceneEnum} lists all group independent scenes from digitalSTROM which are callable at the @@ -51,7 +52,7 @@ public enum ApartmentSceneEnum implements Scene { NO_HAIL((short) 91); private final short sceneNumber; - static final HashMap APARTAMENT_SCENES = new HashMap(); + static final Map APARTAMENT_SCENES = new HashMap<>(); static { for (ApartmentSceneEnum as : ApartmentSceneEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/SceneEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/SceneEnum.java index ca251b1a1b01a..2dfceb0d7097a 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/SceneEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/SceneEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link SceneEnum} lists all available scenes of digitalSTROM. @@ -128,7 +129,7 @@ public enum SceneEnum implements Scene { NO_HAIL((short) 91); private final short sceneNumber; - static final HashMap DIGITALSTROM_SCENES = new HashMap(); + static final Map DIGITALSTROM_SCENES = new HashMap<>(); static { for (SceneEnum zs : SceneEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ZoneSceneEnum.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ZoneSceneEnum.java index bef880cce01b0..7304389f45c14 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ZoneSceneEnum.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/lib/structure/scene/constants/ZoneSceneEnum.java @@ -13,6 +13,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants; import java.util.HashMap; +import java.util.Map; /** * The {@link ZoneSceneEnum} lists all zone scenes which are available on the dSS-web-interface. @@ -28,7 +29,7 @@ public enum ZoneSceneEnum implements Scene { WAKEUP((short) 70); private final short sceneNumber; - static final HashMap ZONE_SCENES = new HashMap(); + static final Map ZONE_SCENES = new HashMap<>(); static { for (ZoneSceneEnum zs : ZoneSceneEnum.values()) { diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsChannelTypeProvider.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsChannelTypeProvider.java index 7f552cde30ee5..e26c8bc439fad 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsChannelTypeProvider.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsChannelTypeProvider.java @@ -341,7 +341,7 @@ private String getStageChannelOption(String type, String option) { private StateDescription getStageDescription(String channelID, Locale locale) { if (channelID.contains(STAGE.toLowerCase())) { - List stateOptions = new ArrayList(); + List stateOptions = new ArrayList<>(); if (channelID.contains(LIGHT)) { stateOptions.add(new StateOption(DigitalSTROMBindingConstants.OPTION_COMBINED_BOTH_OFF, getText( getStageChannelOption(LIGHT, DigitalSTROMBindingConstants.OPTION_COMBINED_BOTH_OFF), locale))); diff --git a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsDeviceThingTypeProvider.java b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsDeviceThingTypeProvider.java index f111f75a02963..11f7c3f0a2975 100644 --- a/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsDeviceThingTypeProvider.java +++ b/bundles/org.openhab.binding.digitalstrom/src/main/java/org/openhab/binding/digitalstrom/internal/providers/DsDeviceThingTypeProvider.java @@ -124,7 +124,7 @@ protected void init() { @Override public Collection getThingTypes(Locale locale) { - List thingTypes = new LinkedList(); + List thingTypes = new LinkedList<>(); for (SupportedThingTypes supportedThingType : SupportedThingTypes.values()) { thingTypes.add(getThingType( new ThingTypeUID(DigitalSTROMBindingConstants.BINDING_ID, supportedThingType.toString()), locale)); @@ -157,7 +157,7 @@ public ThingType getThingType(ThingTypeUID thingTypeUID, Locale locale) { .build())); } if (SupportedThingTypes.circuit.equals(supportedThingType)) { - List channelDefinitions = new ArrayList(3); + List channelDefinitions = new ArrayList<>(3); for (MeteringTypeEnum meteringType : MeteringTypeEnum.values()) { channelDefinitions.add(new ChannelDefinitionBuilder( DsChannelTypeProvider.getMeteringChannelID(meteringType, MeteringUnitsEnum.WH, false), diff --git a/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.core.resources.prefs b/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index abdea9ac032d4..0000000000000 --- a/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,4 +0,0 @@ -eclipse.preferences.version=1 -encoding//src/main/java=UTF-8 -encoding//src/main/resources=UTF-8 -encoding/=UTF-8 diff --git a/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.m2e.core.prefs b/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.m2e.core.prefs deleted file mode 100644 index f897a7f1cb238..0000000000000 --- a/bundles/org.openhab.binding.dlinksmarthome/.settings/org.eclipse.m2e.core.prefs +++ /dev/null @@ -1,4 +0,0 @@ -activeProfiles= -eclipse.preferences.version=1 -resolveWorkspaceProjects=true -version=1 diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/ValueSet.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/ValueSet.java index 2c696a1363db3..63b815dfa20bd 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/ValueSet.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/ValueSet.java @@ -31,7 +31,7 @@ public class ValueSet { private int fadeTime; private int holdTime; - private final List values = new ArrayList(); + private final List values = new ArrayList<>(); /** * constructor with fade times only diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/DmxOverEthernetHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/DmxOverEthernetHandler.java index e0603383b117d..45b7fe64ed7ad 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/DmxOverEthernetHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/DmxOverEthernetHandler.java @@ -38,7 +38,7 @@ public abstract class DmxOverEthernetHandler extends DmxBridgeHandler { protected DmxOverEthernetPacket packetTemplate; protected IpNode senderNode = new IpNode(); - protected List receiverNodes = new ArrayList(); + protected List receiverNodes = new ArrayList<>(); protected boolean refreshAlways = false; diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/IpNode.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/IpNode.java index d347db5439fcf..a519cd0912c16 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/IpNode.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/dmxoverethernet/IpNode.java @@ -146,7 +146,7 @@ public String toString() { * @return a List of IpNodes */ public static List fromString(String addrString, int defaultPort) throws IllegalArgumentException { - List ipNodes = new ArrayList(); + List ipNodes = new ArrayList<>(); int port; for (String singleAddrString : addrString.split(",")) { diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ChaserThingHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ChaserThingHandler.java index 9e6fe2f8f9477..83bf8f8bda48e 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ChaserThingHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ChaserThingHandler.java @@ -54,8 +54,8 @@ public class ChaserThingHandler extends DmxThingHandler { private final Logger logger = LoggerFactory.getLogger(ChaserThingHandler.class); - private final List channels = new ArrayList(); - private List values = new ArrayList(); + private final List channels = new ArrayList<>(); + private List values = new ArrayList<>(); private boolean resumeAfter = false; private OnOffType isRunning = OnOffType.OFF; @@ -186,7 +186,7 @@ public void initialize() { @Override public void dispose() { - if (channels.size() != 0) { + if (!channels.isEmpty()) { Bridge bridge = getBridge(); if (bridge != null) { DmxBridgeHandler bridgeHandler = (DmxBridgeHandler) bridge.getHandler(); diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ColorThingHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ColorThingHandler.java index 74b456a8b732b..27e8c28e18564 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ColorThingHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/ColorThingHandler.java @@ -33,11 +33,11 @@ import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.RefreshType; +import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.DmxBridgeHandler; import org.openhab.binding.dmx.internal.DmxThingHandler; import org.openhab.binding.dmx.internal.Util; import org.openhab.binding.dmx.internal.ValueSet; -import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.action.FadeAction; import org.openhab.binding.dmx.internal.config.ColorThingHandlerConfiguration; import org.openhab.binding.dmx.internal.multiverse.BaseDmxChannel; @@ -57,9 +57,9 @@ public class ColorThingHandler extends DmxThingHandler { private final Logger logger = LoggerFactory.getLogger(ColorThingHandler.class); - private final List channels = new ArrayList(); + private final List channels = new ArrayList<>(); - private final List currentValues = new ArrayList(); + private final List currentValues = new ArrayList<>(); private HSBType currentColor = new HSBType(); private ValueSet turnOnValue = new ValueSet(0, -1, DmxChannel.MAX_VALUE); @@ -284,7 +284,7 @@ public void initialize() { @Override public void dispose() { - if (channels.size() != 0) { + if (!channels.isEmpty()) { channels.get(0).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_R)); channels.get(1).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_G)); channels.get(2).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_B)); diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/DimmerThingHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/DimmerThingHandler.java index c723005e4d854..c8f9181562d2b 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/DimmerThingHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/DimmerThingHandler.java @@ -32,11 +32,11 @@ import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.RefreshType; +import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.DmxBridgeHandler; import org.openhab.binding.dmx.internal.DmxThingHandler; import org.openhab.binding.dmx.internal.Util; import org.openhab.binding.dmx.internal.ValueSet; -import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.action.FadeAction; import org.openhab.binding.dmx.internal.config.DimmerThingHandlerConfiguration; import org.openhab.binding.dmx.internal.multiverse.BaseDmxChannel; @@ -56,7 +56,7 @@ public class DimmerThingHandler extends DmxThingHandler { private final Logger logger = LoggerFactory.getLogger(DimmerThingHandler.class); - private final List channels = new ArrayList(); + private final List channels = new ArrayList<>(); private PercentType currentBrightness = PercentType.ZERO; @@ -220,7 +220,7 @@ public void initialize() { @Override public void dispose() { - if (channels.size() != 0) { + if (!channels.isEmpty()) { channels.get(0).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS)); Bridge bridge = getBridge(); diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/Lib485BridgeHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/Lib485BridgeHandler.java index 61570ac3aa3a9..f086422a8dddd 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/Lib485BridgeHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/Lib485BridgeHandler.java @@ -46,7 +46,7 @@ public class Lib485BridgeHandler extends DmxBridgeHandler { public static final int DEFAULT_PORT = 9020; private final Logger logger = LoggerFactory.getLogger(Lib485BridgeHandler.class); - private final Map receiverNodes = new HashMap(); + private final Map receiverNodes = new HashMap<>(); public Lib485BridgeHandler(Bridge lib485Bridge) { super(lib485Bridge); diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/SacnBridgeHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/SacnBridgeHandler.java index 71803b9626ad0..0dcaf22761449 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/SacnBridgeHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/SacnBridgeHandler.java @@ -73,7 +73,7 @@ protected void updateConfiguration() { } } } else { - receiverNodes = new ArrayList(); + receiverNodes = new ArrayList<>(); receiverNodes.add(SacnNode.getBroadcastNode(universe.getUniverseId())); logger.debug("using multicast mode to {} for {}", receiverNodes, this.thing.getUID()); } diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/TunableWhiteThingHandler.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/TunableWhiteThingHandler.java index 42bcabcfbabc9..b25b279002141 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/TunableWhiteThingHandler.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/handler/TunableWhiteThingHandler.java @@ -32,11 +32,11 @@ import org.eclipse.smarthome.core.thing.ThingTypeUID; import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.RefreshType; +import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.DmxBridgeHandler; import org.openhab.binding.dmx.internal.DmxThingHandler; import org.openhab.binding.dmx.internal.Util; import org.openhab.binding.dmx.internal.ValueSet; -import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.action.FadeAction; import org.openhab.binding.dmx.internal.config.TunableWhiteThingHandlerConfiguration; import org.openhab.binding.dmx.internal.multiverse.BaseDmxChannel; @@ -56,9 +56,9 @@ public class TunableWhiteThingHandler extends DmxThingHandler { private final Logger logger = LoggerFactory.getLogger(TunableWhiteThingHandler.class); - private final List channels = new ArrayList(); + private final List channels = new ArrayList<>(); - private final List currentValues = new ArrayList(); + private final List currentValues = new ArrayList<>(); private PercentType currentBrightness = PercentType.ZERO; private PercentType currentColorTemperature = new PercentType(50); @@ -274,7 +274,7 @@ public void initialize() { @Override public void dispose() { - if (channels.size() != 0) { + if (!channels.isEmpty()) { channels.get(0).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_CW)); channels.get(1).removeListener(new ChannelUID(this.thing.getUID(), CHANNEL_BRIGHTNESS_WW)); } diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/BaseDmxChannel.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/BaseDmxChannel.java index a528d1b4317b1..b062438790edf 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/BaseDmxChannel.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/BaseDmxChannel.java @@ -117,7 +117,7 @@ public String toString() { */ public static List fromString(String dmxChannelString, int defaultUniverseId) throws IllegalArgumentException { - List dmxChannels = new ArrayList(); + List dmxChannels = new ArrayList<>(); Stream.of(dmxChannelString.split(",")).forEach(singleDmxChannelString -> { int dmxChannelId, dmxChannelWidth; diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/DmxChannel.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/DmxChannel.java index 1cd08c2401239..dbf1b799ca117 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/DmxChannel.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/DmxChannel.java @@ -16,15 +16,16 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import org.eclipse.smarthome.core.library.types.OnOffType; import org.eclipse.smarthome.core.library.types.PercentType; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; +import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.DmxThingHandler; import org.openhab.binding.dmx.internal.Util; -import org.openhab.binding.dmx.internal.DmxBindingConstants.ListenerType; import org.openhab.binding.dmx.internal.action.ActionState; import org.openhab.binding.dmx.internal.action.BaseAction; import org.slf4j.Logger; @@ -51,12 +52,12 @@ public class DmxChannel extends BaseDmxChannel { private int refreshTime = 0; private long lastStateTimestamp = 0; - private final List actions = new ArrayList(); - private final List suspendedActions = new ArrayList(); - private final List registeredThings = new ArrayList(); + private final List actions = new ArrayList<>(); + private final List suspendedActions = new ArrayList<>(); + private final List registeredThings = new ArrayList<>(); - private final HashMap onOffListeners = new HashMap(); - private final HashMap valueListeners = new HashMap(); + private final Map onOffListeners = new HashMap<>(); + private final Map valueListeners = new HashMap<>(); private Entry actionListener = null; public DmxChannel(int universeId, int dmxChannelId, int refreshTime) { @@ -324,7 +325,7 @@ public void addListener(ChannelUID thingChannel, DmxThingHandler listener, Liste } else { logger.debug("adding ACTION listener {} in channel {}", listener, this); } - actionListener = new AbstractMap.SimpleEntry(thingChannel, listener); + actionListener = new AbstractMap.SimpleEntry<>(thingChannel, listener); default: } } diff --git a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/Universe.java b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/Universe.java index c82f5c5d7a6a9..671fef0a2fbf3 100644 --- a/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/Universe.java +++ b/bundles/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/multiverse/Universe.java @@ -44,8 +44,8 @@ public class Universe { private long bufferChanged; private int refreshTime = DEFAULT_REFRESH_TIME; - private final List channels = new ArrayList(); - private final List applyCurve = new ArrayList(); + private final List channels = new ArrayList<>(); + private final List applyCurve = new ArrayList<>(); /** * universe constructor diff --git a/bundles/org.openhab.binding.dmx/src/test/java/org/openhab/binding/dmx/test/TestBridgeHandler.java b/bundles/org.openhab.binding.dmx/src/test/java/org/openhab/binding/dmx/test/TestBridgeHandler.java index f643a2506983c..8f1551bd0a4f0 100644 --- a/bundles/org.openhab.binding.dmx/src/test/java/org/openhab/binding/dmx/test/TestBridgeHandler.java +++ b/bundles/org.openhab.binding.dmx/src/test/java/org/openhab/binding/dmx/test/TestBridgeHandler.java @@ -34,8 +34,8 @@ */ public class TestBridgeHandler extends DmxBridgeHandler { - public final static ThingTypeUID THING_TYPE_TEST_BRIDGE = new ThingTypeUID(BINDING_ID, "test-bridge"); - public final static Set SUPPORTED_THING_TYPES = Collections.singleton(THING_TYPE_TEST_BRIDGE); + public static final ThingTypeUID THING_TYPE_TEST_BRIDGE = new ThingTypeUID(BINDING_ID, "test-bridge"); + public static final Set SUPPORTED_THING_TYPES = Collections.singleton(THING_TYPE_TEST_BRIDGE); public static final int MIN_UNIVERSE_ID = 0; public static final int MAX_UNIVERSE_ID = 0; @@ -83,7 +83,6 @@ public void initialize() { * calc buffer for timestamp after timespam * * @param time UNIX timestamp of calculation time - * * @return new timestamp */ public long calcBuffer(long time, long timespan) { diff --git a/bundles/org.openhab.binding.doorbird/README.md b/bundles/org.openhab.binding.doorbird/README.md index fc33ed0279bdf..b0fd966ff1284 100644 --- a/bundles/org.openhab.binding.doorbird/README.md +++ b/bundles/org.openhab.binding.doorbird/README.md @@ -8,15 +8,15 @@ The following thing types are supported: | Device | Thing ID | |----------------------------------|-----------| -| Doorbird D101/D201/D205 Doorbell | d101 | +| Doorbird D101/D201/D205/D1101V Doorbell | d101 | | Doorbird D210x Doorbell | d210x | | Doorbird A1081 Controller | a1081 | ## Thing Configuration -### D101/D201/D205 and D210x Doorbell +### D101/D201/D205/D1101V and D210x Doorbell -The following configuration parameters are available on the Doorbird D101/D201/D205 and D210x Doorbell things: +The following configuration parameters are available on the Doorbird D101/D201/D205/D1101V and D210x Doorbell things: | Parameter | Parameter ID | Required/Optional | Description | |--------------------------|--------------------|-------------------|-------------| @@ -137,9 +137,9 @@ Either put the Doorbird and openHAB on the same subnet/VLAN, or set up your netw ### Things ``` -Thing doorbird:d101:doorbell Doorbird D101 Doorbell [doorbirdHost="192.168.1.100",userId="dtfubb0004",userPassword="HG7afc5TvN",imageRefreshRate=60,doorbellOffDelay=3,motionOffDelay=30,montageNumImages=3,montageScaleFactor=35] +Thing doorbird:d101:doorbell "Doorbird D101 Doorbell" [doorbirdHost="192.168.1.100",userId="dtfubb0004",userPassword="HG7afc5TvN",imageRefreshRate=60,doorbellOffDelay=3,motionOffDelay=30,montageNumImages=3,montageScaleFactor=35] -Thing doorbird:a1081:controller Doorbird A1081 Controller [doorbirdHost="192.168.1.100",userId="dtfubb0004",userPassword="HG7afc5TvN"] +Thing doorbird:a1081:controller "Doorbird A1081 Controller" [doorbirdHost="192.168.1.100",userId="dtfubb0004",userPassword="HG7afc5TvN"] ``` ### Items @@ -149,7 +149,7 @@ Switch Doorbell_Pressed "Doorbell Pressed [%s]" ["Switch"] { channel="d DateTime Doorbell_PressedTimestamp "Doorbell Pressed Timestamp [%1$tA, %1$tm/%1$td/%1$tY %1$tl:%1$tM %1$tp]"