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 5a8037aac39b4..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 @@ -262,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); 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.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/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 dedd1713922af..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 @@ -324,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(); @@ -356,7 +355,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { mediaStartMs = System.currentTimeMillis() - this.mediaProgressMs; updateMediaProgress(false); } - } // Volume commands if (channelId.equals(CHANNEL_VOLUME)) { @@ -364,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) { @@ -385,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); @@ -395,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) @@ -427,7 +421,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { waitForUpdate = 3000; } } - } } if (channelId.equals(CHANNEL_PLAY_MUSIC_VOICE_COMMAND)) { @@ -485,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)) { @@ -575,7 +563,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { currentNotifcationUpdateTimer = scheduler.scheduleWithFixedDelay(() -> { updateNotificationTimerState(); }, 1, 1, TimeUnit.SECONDS); - } } } @@ -718,7 +705,6 @@ private boolean handleEqualizerCommands(String channelId, Command command, Conne logger.debug("Update equalizer failed", e); this.lastKnownEqualizer = null; } - } } return false; @@ -935,7 +921,6 @@ public void updateState(AccountHandler accountHandler, @Nullable Device device, } else { stopProgressTimer(); } - } else { stopProgressTimer(); mediaProgressMs = 0; @@ -947,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); } @@ -1053,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; @@ -1087,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; @@ -1155,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); @@ -1199,7 +1177,6 @@ private void updateEqualizerState() { if (treble != null) { updateState(CHANNEL_EQUALIZER_TREBLE, new DecimalType(treble)); } - } private void updateMediaProgress() { diff --git a/bundles/org.openhab.binding.atlona/src/main/java/org/openhab/binding/atlona/internal/StatefulHandlerCallback.java b/bundles/org.openhab.binding.atlona/src/main/java/org/openhab/binding/atlona/internal/StatefulHandlerCallback.java index 0395b8aebd827..b4e12f159df93 100644 --- a/bundles/org.openhab.binding.atlona/src/main/java/org/openhab/binding/atlona/internal/StatefulHandlerCallback.java +++ b/bundles/org.openhab.binding.atlona/src/main/java/org/openhab/binding/atlona/internal/StatefulHandlerCallback.java @@ -77,7 +77,6 @@ public void statusChanged(ThingStatus status, ThingStatusDetail detail, String m } // If we got this far - call the underlying one wrappedCallback.statusChanged(status, detail, msg); - } /** @@ -108,7 +107,6 @@ public void stateChanged(String channelId, State state) { // Something changed - save the new state and call the underlying wrapped this.state.put(channelId, state); wrappedCallback.stateChanged(channelId, state); - } /** @@ -133,7 +131,6 @@ public void removeState(String channelId) { @Override public void setProperty(String propertyName, String propertyValue) { wrappedCallback.setProperty(propertyName, propertyValue); - } /** diff --git a/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/BlueGigaBluetoothDevice.java b/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/BlueGigaBluetoothDevice.java index a8889a249ff5c..76d8951a12a3a 100644 --- a/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/BlueGigaBluetoothDevice.java +++ b/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/BlueGigaBluetoothDevice.java @@ -86,19 +86,16 @@ private enum BlueGigaProcedure { private @Nullable ScheduledFuture procedureTimer; private Runnable connectTimeoutTask = new Runnable() { - @Override public void run() { if (connectionState == ConnectionState.CONNECTING) { logger.debug("Connection timeout for device {}", address); connectionState = ConnectionState.DISCONNECTED; } - } }; private Runnable procedureTimeoutTask = new Runnable() { - @Override public void run() { logger.debug("Procedure {} timeout for device {}", procedureProgress, address); @@ -248,7 +245,6 @@ else if (event instanceof BlueGigaAttributeValueEvent) { } private void handleScanEvent(BlueGigaScanResponseEvent event) { - // Check if this is addressed to this device if (!address.equals(new BluetoothAddress(event.getSender()))) { return; diff --git a/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/handler/BlueGigaBridgeHandler.java b/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/handler/BlueGigaBridgeHandler.java index d34446fe5cc51..4b22a4fcfed78 100644 --- a/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/handler/BlueGigaBridgeHandler.java +++ b/bundles/org.openhab.binding.bluetooth.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/handler/BlueGigaBridgeHandler.java @@ -648,7 +648,6 @@ private boolean bgStartScanning(boolean active, int interval, int window) { */ private T sendCommand(BlueGigaCommand command, Class expectedResponse, boolean schedulePassiveScan) throws BlueGigaException { - if (!initComplete) { throw new BlueGigaException("BlueGiga not initialized"); } diff --git a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/BluetoothDevice.java b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/BluetoothDevice.java index eb1a65d8ce58b..a972cd82ed820 100644 --- a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/BluetoothDevice.java +++ b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/BluetoothDevice.java @@ -624,7 +624,6 @@ public boolean hasListeners() { * */ protected void dispose() { - } /** diff --git a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java index 65e002cdfeb84..37b8aa764d5cc 100644 --- a/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java +++ b/bundles/org.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/discovery/internal/BluetoothDeviceSnapshot.java @@ -210,7 +210,6 @@ public boolean equals(@Nullable Object obj) { * @return true if this snapshot changed as a result of this operation */ public void merge(BluetoothDevice device) { - Integer txPower = device.getTxPower(); Integer manufacturer = device.getManufacturerId(); String name = device.getName(); 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 662ef8a02f4d8..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; @@ -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/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 9365c4ae9745f..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 @@ -74,7 +74,6 @@ public BuienradarHandler(Thing thing) { @Override public void handleCommand(ChannelUID channelUID, Command command) { - } @SuppressWarnings("null") diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java index 7ed0887fda8e8..bb5aef009b91a 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/PanelThingHandler.java @@ -413,7 +413,6 @@ private void verboseTroubleStatusHandler(EventObject event) { * @param dscAlarmCode */ private void restorePartitionsInAlarm(DSCAlarmCode dscAlarmCode) { - logger.debug("restorePartitionsInAlarm(): DSC Alarm Code: {}!", dscAlarmCode.toString()); ChannelUID channelUID = null; diff --git a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/ZoneThingHandler.java b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/ZoneThingHandler.java index bf9182d04294e..a90247a35972c 100644 --- a/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/ZoneThingHandler.java +++ b/bundles/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm/internal/handler/ZoneThingHandler.java @@ -107,7 +107,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (dscAlarmBridgeHandler != null && dscAlarmBridgeHandler.isConnected() && channelUID.getId().equals(ZONE_BYPASS_MODE)) { - String data = String.valueOf(getPartitionNumber()) + "*1" + String.format("%02d", getZoneNumber()) + "#"; dscAlarmBridgeHandler.sendCommand(DSCAlarmCode.KeySequence, data); diff --git a/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/data/SeverityComparator.java b/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/data/SeverityComparator.java index e0c5abe2fd638..054d56ffdc8c0 100644 --- a/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/data/SeverityComparator.java +++ b/bundles/org.openhab.binding.dwdunwetter/src/main/java/org/openhab/binding/dwdunwetter/internal/data/SeverityComparator.java @@ -25,7 +25,6 @@ public class SeverityComparator implements Comparator { @Override public int compare(DwdWarningData o1, DwdWarningData o2) { - Comparator.comparingInt(d -> ((DwdWarningData) d).getSeverity().getOrder()); Comparator.comparing(DwdWarningData::getOnset); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanHandlerFactory.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanHandlerFactory.java index 8d069eda839e5..7262ab0fe6ab6 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanHandlerFactory.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/EnOceanHandlerFactory.java @@ -67,7 +67,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (EnOceanBridgeHandler.SUPPORTED_THING_TYPES.contains(thingTypeUID)) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01.java index 8e959f5a6f738..0d3b4632a2411 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01.java @@ -53,7 +53,6 @@ private State getIllumination() { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_BATTERY_VOLTAGE: return getBatteryVoltage(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01_ELTAKO.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01_ELTAKO.java index 871727e4d2900..b9a85457243b8 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01_ELTAKO.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_06/A5_06_01_ELTAKO.java @@ -48,7 +48,6 @@ private State getIllumination() { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_ILLUMINATION: return getIllumination(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_07/A5_07.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_07/A5_07.java index 92fafb20cf631..32f5bca5b2ff8 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_07/A5_07.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_07/A5_07.java @@ -41,7 +41,6 @@ public A5_07(ERP1Message packet) { protected abstract State getSupplyVoltage(); protected State getSupplyVoltage(int value) { - if (value > 250) { logger.warn("EEP A5-07 error code {}", value); return UnDefType.UNDEF; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_13/A5_13_01.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_13/A5_13_01.java index b0de634652e19..e5879bbd664b6 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_13/A5_13_01.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_13/A5_13_01.java @@ -27,7 +27,7 @@ /** * Convertes EEP A5-13 messages of type 0x01 into Temperature, Illumination, Wind Speed and Temperature states - * + * * @author Daniel Weber - Initial contribution */ public class A5_13_01 extends A5_13 { @@ -71,7 +71,6 @@ protected State getRainStatus() { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - if (isPartOne()) { switch (channelId) { case CHANNEL_ILLUMINATION: diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_20/A5_20_04.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_20/A5_20_04.java index 2591357cb23f6..6f82dc4dfc897 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_20/A5_20_04.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_20/A5_20_04.java @@ -169,7 +169,6 @@ private byte getSer(Function getCurrentStateFunc) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (CHANNEL_SEND_COMMAND.equals(channelId) && (command.equals(OnOffType.ON))) { byte db3 = getPos(getCurrentStateFunc); byte db2 = getTsp(getCurrentStateFunc); @@ -186,7 +185,6 @@ protected void convertFromCommandImpl(String channelId, String channelTypeId, Co @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_VALVE_POSITION: return getValvePosition(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_30/A5_30_03_ELTAKO.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_30/A5_30_03_ELTAKO.java index 28587efc2055f..e3d48ca41fe09 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_30/A5_30_03_ELTAKO.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_30/A5_30_03_ELTAKO.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.enocean.internal.eep.A5_30; -import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*; +import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.CHANNEL_SMOKEDETECTION; import java.util.function.Function; @@ -47,12 +47,10 @@ public A5_30_03_ELTAKO(ERP1Message packet) { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - byte db1 = getDB_1(); switch (channelId) { case CHANNEL_SMOKEDETECTION: - return db1 == ALARM_ON ? OnOffType.ON - : (db1 == ALARM_OFF ? OnOffType.OFF : UnDefType.UNDEF); + return db1 == ALARM_ON ? OnOffType.ON : (db1 == ALARM_OFF ? OnOffType.OFF : UnDefType.UNDEF); } return super.convertToStateImpl(channelId, channelTypeId, getCurrentStateFunc, config); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Blinds.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Blinds.java index d50af0b7b641f..316e72574e8f4 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Blinds.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Blinds.java @@ -64,7 +64,6 @@ public A5_38_08_Blinds(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command outputCommand, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_ROLLERSHUTTER: byte db0 = ZERO | SEND_NEW_STATE | TeachInBit; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Switching.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Switching.java index f3b0d985bd5dd..2bd3e3ed4f9bc 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Switching.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_38/A5_38_08_Switching.java @@ -44,7 +44,6 @@ public A5_38_08_Switching(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command outputCommand, Function getCurrentStateFunc, Configuration config) { - if ((OnOffType) outputCommand == OnOffType.ON) { setData(CommandId, ZERO, ZERO, (byte) (TeachInBit | SwitchOn)); } else { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFSB.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFSB.java index e8f65fa90a3bc..decea1b71d24e 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFSB.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_EltakoFSB.java @@ -51,7 +51,6 @@ public A5_3F_7F_EltakoFSB(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - int shutTime = 0xFF; if (config != null) { shutTime = Math.min(255, config.as(EnOceanChannelRollershutterConfig.class).shutTime); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_Universal.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_Universal.java index 4b7f84022cebf..2607e055bd96c 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_Universal.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/A5_3F/A5_3F_7F_Universal.java @@ -42,7 +42,6 @@ public A5_3F_7F_Universal(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (config != null) { try { EnOceanChannelTransformationConfig transformationInfo = config diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/PTM200Message.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/PTM200Message.java index 22b091efb138f..f7a346b0a4aa3 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/PTM200Message.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/PTM200Message.java @@ -50,7 +50,6 @@ public PTM200Message(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - } @Override diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/UTEResponse.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/UTEResponse.java index b5250bd0fd19a..56c6f7ac61c61 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/UTEResponse.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/UTEResponse.java @@ -28,7 +28,6 @@ public class UTEResponse extends _VLDMessage { public static final byte TeachIn_NotSpecified = 0x20; public UTEResponse(ERP1Message packet) { - int dataLength = packet.getPayload().length - ESP3_SENDERID_LENGTH - ESP3_RORG_LENGTH - ESP3_STATUS_LENGTH; setData(packet.getPayload(ESP3_RORG_LENGTH, dataLength)); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/_4BSMessage.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/_4BSMessage.java index 7490817602e80..443ff4b4cdd53 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/_4BSMessage.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Base/_4BSMessage.java @@ -76,14 +76,12 @@ public int getDB_3Value() { @Override protected void teachInQueryImpl(Configuration config) { - if (config == null) { return; } EnOceanChannelTeachInConfig c = config.as(EnOceanChannelTeachInConfig.class); if (c.teachInMSG == null || c.teachInMSG.isEmpty()) { - EEPType type = getEEPType(); byte db3 = (byte) ((getEEPType().getFunc() << 2) | ((type.getType()) >>> 5)); @@ -95,11 +93,9 @@ protected void teachInQueryImpl(Configuration config) { db2 += (manufId >>> 8); db1 += (manufId & 0xff); } catch (Exception e) { - } setData(db3, db2, db1, LRN_Type_Mask); - } else { try { byte[] msg = HexUtils.hexToBytes(c.teachInMSG); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01.java index 42fec882aac17..1347b683f9ce1 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01.java @@ -29,8 +29,8 @@ import org.eclipse.smarthome.core.types.UnDefType; import org.eclipse.smarthome.core.util.HexUtils; import org.openhab.binding.enocean.internal.config.EnOceanChannelDimmerConfig; -import org.openhab.binding.enocean.internal.eep.Base._VLDMessage; import org.openhab.binding.enocean.internal.eep.EEPHelper; +import org.openhab.binding.enocean.internal.eep.Base._VLDMessage; import org.openhab.binding.enocean.internal.messages.ERP1Message; /** @@ -198,7 +198,6 @@ public void addConfigPropertiesTo(DiscoveryResultBuilder discoveredThingResultBu @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (channelId.equals(CHANNEL_GENERAL_SWITCHING)) { if (command == RefreshType.REFRESH) { setSwitchingQueryData(AllChannels_Mask); @@ -233,7 +232,6 @@ protected void convertFromCommandImpl(String channelId, String channelTypeId, Co @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_GENERAL_SWITCHING: return getSwitchingData(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_09_Permundo.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_09_Permundo.java index f9dcd6a8f54bf..be405311f49f1 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_09_Permundo.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_09_Permundo.java @@ -43,7 +43,6 @@ public D2_01_09_Permundo(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (channelId.equals(CHANNEL_REPEATERMODE)) { setRepeaterMode(command); } else if (channelId.equals(CHANNEL_ECOMODE)) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0F_NodON.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0F_NodON.java index b3596fdefdaa5..75a25ff36fa98 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0F_NodON.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_0F_NodON.java @@ -42,9 +42,7 @@ public D2_01_0F_NodON(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (channelId.equalsIgnoreCase(CHANNEL_REPEATERMODE)) { - if (command instanceof RefreshType) { senderId = null; // make this message invalid as we do not support refresh of repeter status } else if (command instanceof StringType) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_12_NodON.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_12_NodON.java index afc0b069f14cc..3f0f4abf163fe 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_12_NodON.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_01/D2_01_12_NodON.java @@ -42,9 +42,7 @@ public D2_01_12_NodON(ERP1Message packet) { @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (channelId.equalsIgnoreCase(CHANNEL_REPEATERMODE)) { - if (command instanceof RefreshType) { senderId = null; // make this message invalid as we do not support refresh of repeter status } else if (command instanceof StringType) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_05/D2_05_00.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_05/D2_05_00.java index 89477d232179d..746b01d4ea9ca 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_05/D2_05_00.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/D2_05/D2_05_00.java @@ -62,7 +62,6 @@ protected byte getCMD() { } protected void setPositionData(Command command, byte outputChannel) { - if (command instanceof UpDownType) { if (command == UpDownType.DOWN) { setData(DOWN, (byte) 0x00, (byte) 0x00, (byte) (outputChannel + CMD_ACTUATOR_SET_POSITION)); @@ -105,7 +104,6 @@ public void addConfigPropertiesTo(DiscoveryResultBuilder discoveredThingResultBu @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (channelId.equals(CHANNEL_ROLLERSHUTTER)) { if (command == RefreshType.REFRESH) { setPositionQueryData(ChannelA_Mask); @@ -118,7 +116,6 @@ protected void convertFromCommandImpl(String channelId, String channelTypeId, Co @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - switch (channelId) { case CHANNEL_ROLLERSHUTTER: return getPositionData(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEP.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEP.java index caa59c7278dc6..5dcfc72b6150b 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEP.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEP.java @@ -171,7 +171,6 @@ public EEP setSuppressRepeating(boolean suppressRepeating) { public final ERP1Message getERP1Message() { if (isValid()) { - int optionalDataLength = 0; if (optionalData != null) { optionalDataLength = optionalData.length; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java index 367f20796fcc8..75694835e14df 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/EEPFactory.java @@ -40,7 +40,6 @@ public class EEPFactory { private static final Logger logger = LoggerFactory.getLogger(EEPFactory.class); public static EEP createEEP(EEPType eepType) { - try { Class cl = eepType.getEEPClass(); if (cl == null) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_01.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_01.java index 37c425a92ff6d..d1912bc22d6ae 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_01.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_01.java @@ -60,7 +60,6 @@ protected String convertToEventImpl(String channelId, String channelTypeId, Stri } if (t21 && nu) { - byte dir1 = channelId.equals(CHANNEL_ROCKERSWITCH_CHANNELA) ? A0 : B0; byte dir2 = channelId.equals(CHANNEL_ROCKERSWITCH_CHANNELA) ? AI : BI; @@ -85,9 +84,7 @@ protected String convertToEventImpl(String channelId, String channelTypeId, Stri @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (command instanceof StringType) { - StringType s = (StringType) command; if (s.equals(CommonTriggerEvents.DIR1_RELEASED) || s.equals(CommonTriggerEvents.DIR2_RELEASED)) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_02.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_02.java index e9a3b11d9e187..58a480c34314f 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_02.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_02/F6_02_02.java @@ -57,7 +57,6 @@ protected String convertToEventImpl(String channelId, String channelTypeId, Stri } if (t21 && nu) { - byte dir1 = channelId.equals(CHANNEL_ROCKERSWITCH_CHANNELA) ? AI : BI; byte dir2 = channelId.equals(CHANNEL_ROCKERSWITCH_CHANNELA) ? A0 : B0; @@ -82,9 +81,7 @@ protected String convertToEventImpl(String channelId, String channelTypeId, Stri @Override protected void convertFromCommandImpl(String channelId, String channelTypeId, Command command, Function getCurrentStateFunc, Configuration config) { - if (command instanceof StringType) { - StringType s = (StringType) command; if (s.equals(CommonTriggerEvents.DIR1_RELEASED) || s.equals(CommonTriggerEvents.DIR2_RELEASED)) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00.java index 885b4b578b4c5..12765cc6c9e70 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00.java @@ -47,7 +47,6 @@ public F6_10_00(ERP1Message packet) { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - if (!isValid()) { return UnDefType.UNDEF; } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00_EltakoFPE.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00_EltakoFPE.java index 72faaf5a68b78..c9d8b41d59fb7 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00_EltakoFPE.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_00_EltakoFPE.java @@ -12,7 +12,7 @@ */ package org.openhab.binding.enocean.internal.eep.F6_10; -import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.*; +import static org.openhab.binding.enocean.internal.EnOceanBindingConstants.CHANNEL_CONTACT; import java.util.function.Function; @@ -44,7 +44,6 @@ public F6_10_00_EltakoFPE(ERP1Message packet) { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - if (channelId.equals(CHANNEL_CONTACT)) { EnOceanChannelContactConfig c = config.as(EnOceanChannelContactConfig.class); if (c.inverted) { diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_01.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_01.java index 180fa9d9850e1..451766ba88a33 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_01.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/F6_10/F6_10_01.java @@ -47,7 +47,6 @@ public F6_10_01(ERP1Message packet) { @Override protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { - if (!isValid()) { return UnDefType.UNDEF; } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Generic/GenericEEP.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Generic/GenericEEP.java index 30a999187eb3b..ab2ede1c0e700 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Generic/GenericEEP.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/eep/Generic/GenericEEP.java @@ -103,7 +103,6 @@ protected void convertFromCommandImpl(String channelId, String channelTypeId, Co protected State convertToStateImpl(String channelId, String channelTypeId, Function getCurrentStateFunc, Configuration config) { if (config != null) { - EnOceanChannelTransformationConfig transformationInfo = config.as(EnOceanChannelTransformationConfig.class); String payload = HexUtils.bytesToHex(bytes); @@ -120,7 +119,6 @@ protected State convertToStateImpl(String channelId, String channelTypeId, if (state != null) { if (state.isEnum()) { - for (State s : state.getEnumConstants()) { if (s.toString().equalsIgnoreCase(parts[1])) { return s; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseActuatorHandler.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseActuatorHandler.java index b245bfe6b44e0..161ac3c63561f 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseActuatorHandler.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseActuatorHandler.java @@ -75,7 +75,6 @@ private boolean validateSenderIdOffset(int senderIdOffset) { } if (senderIdOffset > 0 && senderIdOffset < 128) { - EnOceanBridgeHandler bridgeHandler = getBridgeHandler(); if (bridgeHandler != null) { return !bridgeHandler.existsSender(senderIdOffset, this.thing); @@ -107,7 +106,6 @@ Collection getEEPTypes() { @Override boolean validateConfig() { - EnOceanActuatorConfig config = getConfiguration(); if (config == null) { configurationErrorDescription = "Configuration is not valid"; @@ -128,14 +126,12 @@ boolean validateConfig() { if (super.validateConfig()) { try { - if (sendingEEPType.getSupportsRefresh()) { if (getConfiguration().pollingInterval > 0) { refreshJob = scheduler.scheduleWithFixedDelay(() -> { try { refreshStates(); } catch (Exception e) { - } }, 30, getConfiguration().pollingInterval, TimeUnit.SECONDS); } @@ -146,7 +142,6 @@ boolean validateConfig() { } else { destinationId = HexUtils.hexToBytes(config.enoceanId); } - } catch (Exception e) { configurationErrorDescription = "Configuration is not valid"; return false; @@ -201,7 +196,6 @@ private boolean initializeIdForSending() { } private void refreshStates() { - logger.debug("polling channels"); if (thing.getStatus().equals(ThingStatus.ONLINE)) { for (Channel channel : this.getThing().getChannels()) { @@ -212,7 +206,6 @@ private void refreshStates() { @Override public void handleCommand(ChannelUID channelUID, Command command) { - // We must have a valid sendingEEPType and sender id to send commands if (sendingEEPType == null || senderId == null) { return; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseThingHandler.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseThingHandler.java index 7b0dd143f9536..9f7240f206319 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseThingHandler.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBaseThingHandler.java @@ -126,7 +126,6 @@ protected boolean validateEnoceanId(String id) { abstract Collection getEEPTypes(); protected void updateChannels() { - @NonNull List<@NonNull Channel> channelList = new LinkedList<>(this.getThing().getChannels()); Collection eeps = getEEPTypes(); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBridgeHandler.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBridgeHandler.java index e387c7b90a285..b8f02b340c6e0 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBridgeHandler.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanBridgeHandler.java @@ -88,7 +88,6 @@ public EnOceanBridgeHandler(Bridge bridge, SerialPortManager serialPortManager) @Override public void handleCommand(ChannelUID channelUID, Command command) { - if (transceiver == null) { updateStatus(ThingStatus.OFFLINE); return; @@ -99,7 +98,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof RefreshType) { sendMessage(ESP3PacketFactory.CO_RD_REPEATER, new ResponseListenerIgnoringTimeouts() { - @Override public void responseReceived(RDRepeaterResponse response) { if (response.isValid() && response.isOK()) { @@ -112,14 +110,12 @@ public void responseReceived(RDRepeaterResponse response) { } else if (command instanceof StringType) { sendMessage(ESP3PacketFactory.CO_WR_REPEATER((StringType) command), new ResponseListenerIgnoringTimeouts() { - @Override public void responseReceived(BaseResponse response) { if (response.isOK()) { updateState(channelUID, (StringType) command); } } - }); } break; @@ -127,15 +123,12 @@ public void responseReceived(BaseResponse response) { case CHANNEL_SETBASEID: if (command instanceof StringType) { try { - byte[] id = HexUtils.hexToBytes(((StringType) command).toFullString()); sendMessage(ESP3PacketFactory.CO_WR_IDBASE(id), new ResponseListenerIgnoringTimeouts() { - @Override public void responseReceived(BaseResponse response) { - if (response.isOK()) { updateState(channelUID, new StringType("New Id successfully set")); } else if (response.getResponseType() == ResponseType.RET_FLASH_HW_ERROR) { @@ -147,9 +140,7 @@ public void responseReceived(BaseResponse response) { updateState(channelUID, new StringType("No more change possible")); } } - }); - } catch (IllegalArgumentException e) { updateState(channelUID, new StringType("BaseId could not be parsed")); } @@ -163,7 +154,6 @@ public void responseReceived(BaseResponse response) { @Override public void initialize() { - updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "trying to connect to gateway..."); if (this.serialPortManager == null) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, @@ -178,23 +168,19 @@ public void initialize() { if (connectorTask == null || connectorTask.isDone()) { connectorTask = scheduler.scheduleWithFixedDelay(new Runnable() { - @Override public void run() { if (thing.getStatus() != ThingStatus.ONLINE) { initTransceiver(); } } - }, 0, 60, TimeUnit.SECONDS); } } } private synchronized void initTransceiver() { - try { - EnOceanBridgeConfig c = getThing().getConfiguration().as(EnOceanBridgeConfig.class); if (transceiver != null) { transceiver.ShutDown(); @@ -209,7 +195,6 @@ private synchronized void initTransceiver() { break; default: break; - } updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "opening serial port..."); @@ -238,10 +223,8 @@ private synchronized void initTransceiver() { logger.debug("request base id"); transceiver.sendBasePacket(ESP3PacketFactory.CO_RD_IDBASE, new ResponseListenerIgnoringTimeouts() { - @Override public void responseReceived(RDBaseIdResponse response) { - logger.debug("received response for base id"); if (response.isValid() && response.isOK()) { baseId = response.getBaseId().clone(); @@ -262,10 +245,8 @@ public void responseReceived(RDBaseIdResponse response) { logger.debug("request version info"); transceiver.sendBasePacket(ESP3PacketFactory.CO_RD_VERSION, new ResponseListenerIgnoringTimeouts() { - @Override public void responseReceived(RDVersionResponse response) { - if (response.isValid() && response.isOK()) { updateProperty(PROPERTY_APP_VERSION, response.getAPPVersion()); updateProperty(PROPERTY_API_VERSION, response.getAPIVersion()); @@ -398,6 +379,5 @@ public void ErrorOccured(Throwable exception) { transceiver.ShutDown(); transceiver = null; updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, exception.getMessage()); - } } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanClassicDeviceHandler.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanClassicDeviceHandler.java index c9a4e67f22135..f25fd428a1105 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanClassicDeviceHandler.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/handler/EnOceanClassicDeviceHandler.java @@ -126,7 +126,6 @@ protected boolean addListener(Channel channel) { getBridgeHandler().addPacketListener(this, Long.parseLong(config.enoceanId, 16)); return true; } catch (NumberFormatException e) { - } return false; @@ -208,7 +207,6 @@ private StringType convertToPressedCommand(Command command, SwitchMode switchMod @Override public void handleCommand(@NonNull ChannelUID channelUID, @NonNull Command command) { - // We must have a valid sendingEEPType and sender id to send commands if (sendingEEPType == null || senderId == null || command == RefreshType.REFRESH) { return; diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/BasePacket.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/BasePacket.java index 16b1b4cf5e590..0b45e9fcef9ad 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/BasePacket.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/BasePacket.java @@ -73,7 +73,6 @@ public BasePacket(int dataLength, int optionalDataLength, ESPPacketType packetTy } public BasePacket(int dataLength, int optionalDataLength, byte packetType, byte[] payload) { - if (!ESPPacketType.hasValue(packetType)) { throw new InvalidParameterException("Packet type is unknown"); } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2Packet.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2Packet.java index 8572c77b411d7..f90b0cae33c47 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2Packet.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2Packet.java @@ -199,7 +199,6 @@ private byte[] getSenderId(BasePacket basePacket) { } private byte getStatus(BasePacket basePacket) { - if (basePacket.getPacketType() == ESPPacketType.RADIO_ERP1) { ERP1Message message = (ERP1Message) basePacket; return message.getPayload(ESP2_ORG_LENGTH + message.getRORG().getDataLength() + ESP2_SENDERID_LENGTH, @@ -210,7 +209,6 @@ private byte getStatus(BasePacket basePacket) { } private byte calcCheckSum(byte data[], int offset, int length) { - int checkSum = 0; for (int i = 0; i < length; i++) { checkSum += (data[offset + i] & 0xff); @@ -221,7 +219,6 @@ private byte calcCheckSum(byte data[], int offset, int length) { public byte[] serialize() throws EnOceanException { try { - byte[] result = new byte[ESP2_SYNC_BYTE_LENGTH + ESP2_HEADER_LENGTH + ESP2_ORG_LENGTH + ESP2_DATA_LENGTH + ESP2_SENDERID_LENGTH + ESP2_STATUS_LENGTH + ESP2_CHECKSUM_LENGTH]; Arrays.fill(result, ZERO); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2PacketConverter.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2PacketConverter.java index 390a08921c489..d12ca22fc83e2 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2PacketConverter.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/messages/ESP2PacketConverter.java @@ -73,7 +73,6 @@ private static BasePacket handleMessageTelegram(int dataLength, byte packetType, System.arraycopy(description, 0, data, 17, description.length); return ESP3PacketFactory.BuildPacket(data.length, 0, ESPPacketType.RESPONSE.getValue(), data); } - case UNKOWN: // try to interpret it as a radio telegram return handleRadioTelegram(dataLength, packetType, payload); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP2Transceiver.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP2Transceiver.java index e0b1e6a9876e0..bd135c7717007 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP2Transceiver.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP2Transceiver.java @@ -52,13 +52,11 @@ enum ReadingState { @Override protected void processMessage(byte firstByte) { - byte[] readingBuffer = new byte[ENOCEAN_MAX_DATA]; int bytesRead = -1; byte _byte; try { - readingBuffer[0] = firstByte; bytesRead = this.inputStream.read(readingBuffer, 1, inputStream.available()); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP3Transceiver.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP3Transceiver.java index 87caf28fbdf20..1cdbc08da91d3 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP3Transceiver.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanESP3Transceiver.java @@ -52,13 +52,11 @@ enum ReadingState { @Override protected void processMessage(byte firstByte) { - byte[] readingBuffer = new byte[ENOCEAN_MAX_DATA]; int bytesRead = -1; byte _byte; try { - readingBuffer[0] = firstByte; bytesRead = this.inputStream.read(readingBuffer, 1, inputStream.available()); @@ -86,7 +84,6 @@ protected void processMessage(byte firstByte) { if (ESP3Packet.checkCRC8(dataBuffer, ESP3Packet.ESP3_HEADER_LENGTH, _byte) && ((dataBuffer[0] & 0xFF) << 8) + (dataBuffer[1] & 0xFF) + (dataBuffer[2] & 0xFF) > 0) { - state = ReadingState.ReadingData; dataLength = ((dataBuffer[0] & 0xFF << 8) | (dataBuffer[1] & 0xFF)); diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanTransceiver.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanTransceiver.java index a44ac5085dc3a..b3fde1a517b3f 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanTransceiver.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/EnOceanTransceiver.java @@ -96,12 +96,10 @@ private synchronized void sendNext() throws IOException { private synchronized void send() throws IOException { if (!queue.isEmpty()) { - currentRequest = queue.peek(); try { if (currentRequest != null && currentRequest.RequestPacket != null) { synchronized (currentRequest) { - logger.debug("Sending data, type {}, payload {}{}", currentRequest.RequestPacket.getPacketType().name(), HexUtils.bytesToHex(currentRequest.RequestPacket.getPayload()), @@ -151,7 +149,6 @@ private synchronized void send() throws IOException { public EnOceanTransceiver(String path, TransceiverErrorListener errorListener, ScheduledExecutorService scheduler, SerialPortManager serialPortManager) { - requestQueue = new RequestQueue(scheduler); listeners = new HashMap<>(); @@ -164,7 +161,6 @@ public EnOceanTransceiver(String path, TransceiverErrorListener errorListener, S public void Initialize() throws UnsupportedCommOperationException, PortInUseException, IOException, TooManyListenersException { - SerialPortIdentifier id = serialPortManager.getIdentifier(path); if (id == null) { throw new IOException("Could not find a gateway on given path '" + path + "', " @@ -189,15 +185,12 @@ public void Initialize() } public void StartReceiving(ScheduledExecutorService scheduler) { - if (readingTask == null || readingTask.isCancelled()) { readingTask = scheduler.submit(new Runnable() { - @Override public void run() { receivePackets(); } - }); } } @@ -249,7 +242,6 @@ private void receivePackets() { byte[] buffer = new byte[1]; while (readingTask != null && !readingTask.isCancelled()) { - int bytesRead = read(buffer, 1); if (bytesRead > 0) { processMessage(buffer[0]); @@ -268,7 +260,6 @@ protected int read(byte[] buffer, int length) { } protected void informListeners(ERP1Message msg) { - try { byte[] senderId = msg.getSenderId(); @@ -321,12 +312,10 @@ protected void handleResponse(Response response) throws IOException { } else { logger.trace("Response without request"); } - } public void sendBasePacket(BasePacket packet, ResponseListener responseCallback) throws IOException { - if (packet == null) { return; } @@ -343,7 +332,6 @@ public void sendBasePacket(BasePacket packet, ResponseListener new HashSet<>()).add(listener)) { logger.debug("Listener added: {}", senderIdToListenTo); } @@ -375,9 +363,7 @@ public void setFilteredDeviceId(byte[] filteredDeviceId) { @Override public void serialEvent(SerialPortEvent event) { - if (event.getEventType() == SerialPortEvent.DATA_AVAILABLE) { - synchronized (this) { this.notify(); } diff --git a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/ResponseListenerIgnoringTimeouts.java b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/ResponseListenerIgnoringTimeouts.java index ad0dddd280001..453626bf27b08 100644 --- a/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/ResponseListenerIgnoringTimeouts.java +++ b/bundles/org.openhab.binding.enocean/src/main/java/org/openhab/binding/enocean/internal/transceiver/ResponseListenerIgnoringTimeouts.java @@ -30,6 +30,5 @@ public ResponseListenerIgnoringTimeouts() { @Override public void responseTimeOut() { - } } diff --git a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java index 54978d7f583e0..029d83ba90fbd 100644 --- a/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java +++ b/bundles/org.openhab.binding.enturno/src/main/java/org/openhab/binding/enturno/internal/EnturNoHandler.java @@ -26,7 +26,11 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.smarthome.core.library.types.DateTimeType; import org.eclipse.smarthome.core.library.types.StringType; -import org.eclipse.smarthome.core.thing.*; +import org.eclipse.smarthome.core.thing.Channel; +import org.eclipse.smarthome.core.thing.ChannelUID; +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.binding.BaseThingHandler; import org.eclipse.smarthome.core.thing.type.ChannelKind; import org.eclipse.smarthome.core.types.Command; @@ -163,7 +167,6 @@ private boolean requestData(EnturNoConnection connection) throws EnturConfigurationException, EnturCommunicationException { logger.debug("Update real-time data of thing '{}'.", getThing().getUID()); try { - processedData = connection.getEnturTimeTable(stopId, config.getLineCode()); return true; diff --git a/bundles/org.openhab.binding.etherrain/src/main/java/org/openhab/binding/etherrain/internal/api/EtherRainCommunication.java b/bundles/org.openhab.binding.etherrain/src/main/java/org/openhab/binding/etherrain/internal/api/EtherRainCommunication.java index 0ef80d707096f..cfc468ad45737 100644 --- a/bundles/org.openhab.binding.etherrain/src/main/java/org/openhab/binding/etherrain/internal/api/EtherRainCommunication.java +++ b/bundles/org.openhab.binding.etherrain/src/main/java/org/openhab/binding/etherrain/internal/api/EtherRainCommunication.java @@ -200,13 +200,11 @@ private synchronized List sendGet(String command) throws IOException { } private static List updBroadcast() { - List rList = new LinkedList<>(); // Find the server using UDP broadcast try (DatagramSocket c = new DatagramSocket()) { - c.setSoTimeout(BROADCAST_TIMEOUT); c.setBroadcast(true); diff --git a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/ApiAccess.java b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/ApiAccess.java index 43dda5efb345f..1bcc711d02202 100644 --- a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/ApiAccess.java +++ b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/ApiAccess.java @@ -91,7 +91,6 @@ public void setApplicationId(String applicationId) { */ public TOut doRequest(HttpMethod method, String url, Map headers, String requestData, String contentType, Class outClass) throws TimeoutException { - TOut retVal = null; logger.debug("Requesting: [{}]", url); @@ -166,7 +165,6 @@ public void doAuthenticatedPut(String url, Object requestContainer) throws Timeo */ private TOut doRequest(HttpMethod method, String url, Map headers, Object requestContainer, Class outClass) throws TimeoutException { - String json = null; if (requestContainer != null) { json = this.gson.toJson(requestContainer); diff --git a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/EvohomeApiClient.java b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/EvohomeApiClient.java index 98ea2a22efd1b..60efa794a3013 100644 --- a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/EvohomeApiClient.java +++ b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/api/EvohomeApiClient.java @@ -189,7 +189,6 @@ private LocationsStatus requestLocationsStatus() throws TimeoutException { } private boolean authenticate(String credentials, String grantType) { - String data = credentials + "&" + "Host=rs.alarmnet.com%2F&" + "Pragma=no-cache&" + "Cache-Control=no-store+no-cache&" + "scope=EMEA-V1-Basic+EMEA-V1-Anonymous+EMEA-V1-Get-Current-User-Account&" + "grant_type=" + grantType diff --git a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/handler/EvohomeHeatingZoneHandler.java b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/handler/EvohomeHeatingZoneHandler.java index 7b5da55c27aa8..b71895fe4cc9b 100644 --- a/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/handler/EvohomeHeatingZoneHandler.java +++ b/bundles/org.openhab.binding.evohome/src/main/java/org/openhab/binding/evohome/internal/handler/EvohomeHeatingZoneHandler.java @@ -72,7 +72,6 @@ public void update(ThingStatus tcsStatus, ZoneStatus zoneStatus) { @Override public void handleCommand(ChannelUID channelUID, Command command) { - if (command == RefreshType.REFRESH) { update(tcsStatus, zoneStatus); } else { diff --git a/bundles/org.openhab.binding.foobot/src/main/java/org/openhab/binding/foobot/internal/handler/FoobotDeviceHandler.java b/bundles/org.openhab.binding.foobot/src/main/java/org/openhab/binding/foobot/internal/handler/FoobotDeviceHandler.java index 5f7244429f697..f2e6db6ce7de4 100644 --- a/bundles/org.openhab.binding.foobot/src/main/java/org/openhab/binding/foobot/internal/handler/FoobotDeviceHandler.java +++ b/bundles/org.openhab.binding.foobot/src/main/java/org/openhab/binding/foobot/internal/handler/FoobotDeviceHandler.java @@ -175,7 +175,6 @@ private void updateTime(final FoobotJsonData sensorData) { if (lastTime instanceof DecimalType) { ((DecimalType) lastTime).intValue(); } - } @Override diff --git a/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java b/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java index ccd59bfcc2e1e..fb793c68b3de2 100644 --- a/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java +++ b/bundles/org.openhab.binding.fsinternetradio/src/test/java/org/openhab/binding/fsinternetradio/test/FSInternetRadioHandlerJavaTest.java @@ -500,7 +500,6 @@ public void invalidAbsVolumeValues() { */ @Test public void volumeChannelUpdatedPercIncDec() { - /* * The volume is set through the CHANNEL_VOLUME_PERCENT in order to check if * the absolute volume will be updated properly. @@ -532,7 +531,6 @@ public void volumeChannelUpdatedPercIncDec() { */ @Test public void volumeChannelUpdatedPercUpDown() { - /* * The volume is set through the CHANNEL_VOLUME_PERCENT in order to check if * the absolute volume will be updated properly. @@ -773,7 +771,6 @@ private void createThePowerChannel() { } private Item initializeItem(ChannelUID channelUID, String itemName, String acceptedItemType) { - Item item = null; switch (acceptedItemType) { diff --git a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/FtpUploadHandlerFactory.java b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/FtpUploadHandlerFactory.java index c380462eedfb2..e8326dc8223e1 100644 --- a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/FtpUploadHandlerFactory.java +++ b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/FtpUploadHandlerFactory.java @@ -60,7 +60,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_IMAGERECEIVER)) { diff --git a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FTPUserManager.java b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FTPUserManager.java index 909f011788e6d..11d813b3cf713 100644 --- a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FTPUserManager.java +++ b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FTPUserManager.java @@ -71,7 +71,6 @@ public void setIdleTimeout(int idleTimeout) { public synchronized void addAuthenticationCredentials(String username, String password) throws IllegalArgumentException { - if (authenticationData.containsKey(username)) { throw new IllegalArgumentException("Credentials for user '" + username + "' already exists!"); } diff --git a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FtpServer.java b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FtpServer.java index c4c2df3575b3f..da851e22ff23b 100644 --- a/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FtpServer.java +++ b/bundles/org.openhab.binding.ftpupload/src/main/java/org/openhab/binding/ftpupload/internal/ftp/FtpServer.java @@ -87,7 +87,6 @@ public synchronized void addEventListener(FtpServerEventListener listener) { public synchronized void addAuthenticationCredentials(String username, String password) throws IllegalArgumentException { - FTPUserManager.addAuthenticationCredentials(username, password); } @@ -191,7 +190,6 @@ public FtpletResult onConnect(FtpSession session) throws FtpException, IOExcepti @Override public FtpletResult onUploadEnd(final FtpSession session, final FtpRequest request) throws FtpException, IOException { - String userRoot = session.getUser().getHomeDirectory(); String currDir = session.getFileSystemView().getWorkingDirectory().getAbsolutePath(); String fileName = request.getArgument(); diff --git a/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/GlobalCacheHandlerFactory.java b/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/GlobalCacheHandlerFactory.java index abec1634f637d..71512b198790f 100644 --- a/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/GlobalCacheHandlerFactory.java +++ b/bundles/org.openhab.binding.globalcache/src/main/java/org/openhab/binding/globalcache/internal/GlobalCacheHandlerFactory.java @@ -40,7 +40,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/parser/GetParamsetParser.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/parser/GetParamsetParser.java index 03810ea2fea68..620d7722d533b 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/parser/GetParamsetParser.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/parser/GetParamsetParser.java @@ -41,7 +41,6 @@ public GetParamsetParser(HmChannel channel, HmParamsetType paramsetType) { @Override @SuppressWarnings("unchecked") public Void parse(Object[] message) throws IOException { - if (message == null || message.length == 0 || !(message[0] instanceof Map)) { return null; } diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/converter/type/QuantityTypeConverter.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/converter/type/QuantityTypeConverter.java index 40f7cc60bedc2..f0c1c9800177e 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/converter/type/QuantityTypeConverter.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/converter/type/QuantityTypeConverter.java @@ -45,12 +45,10 @@ protected boolean toBindingValidation(HmDatapoint dp, Class type @Override protected Object toBinding(QuantityType> type, HmDatapoint dp) throws ConverterException { - if (dp.isIntegerType()) { return toUnitFromDatapoint(type, dp).intValue(); } return round(toUnitFromDatapoint(type, dp).doubleValue()).doubleValue(); - } private QuantityType> toUnitFromDatapoint(QuantityType> type, diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/discovery/HomematicDeviceDiscoveryService.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/discovery/HomematicDeviceDiscoveryService.java index f7c7f3de7595b..6420f4ad51f75 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/discovery/HomematicDeviceDiscoveryService.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/discovery/HomematicDeviceDiscoveryService.java @@ -183,7 +183,6 @@ private void waitForLoadDevicesFinished() throws InterruptedException, Execution * Waits for the discovery scan to finish and then returns. */ public void waitForScanFinishing() { - logger.debug("Waiting for finishing Homematic device discovery scan"); try { waitForInstallModeFinished(DISCOVER_TIMEOUT_SECONDS * 1000); diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicBridgeHandler.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicBridgeHandler.java index 02a2f99be72c5..d01545526d88b 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicBridgeHandler.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicBridgeHandler.java @@ -124,7 +124,6 @@ private void initializeInternal() { } } gateway.startWatchdogs(); - } catch (IOException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); logger.debug( diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicThingHandler.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicThingHandler.java index 8fbd02fcb2613..fa7805e0d1b19 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicThingHandler.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/handler/HomematicThingHandler.java @@ -44,6 +44,7 @@ import org.eclipse.smarthome.core.types.Command; import org.eclipse.smarthome.core.types.RefreshType; import org.eclipse.smarthome.core.types.State; +import org.openhab.binding.homematic.internal.HomematicBindingConstants; import org.openhab.binding.homematic.internal.common.HomematicConfig; import org.openhab.binding.homematic.internal.communicator.HomematicGateway; import org.openhab.binding.homematic.internal.converter.ConverterException; @@ -104,8 +105,7 @@ public void initialize() { }); } - private void doInitializeInBackground() - throws GatewayNotAvailableException, HomematicClientException, IOException { + private void doInitializeInBackground() throws GatewayNotAvailableException, HomematicClientException, IOException { HomematicGateway gateway = getHomematicGateway(); HmDevice device = gateway.getDevice(UidUtils.getHomematicAddress(getThing())); HmChannel channelZero = device.getChannel(0); @@ -310,7 +310,7 @@ private void sendDatapoint(HmDatapoint dp, HmDatapointConfig config, Object newV * Returns the rx mode that shall be used for transmitting a new value of a datapoint to the device. The * HomematicThingHandler always uses the default rx mode; custom thing handlers can override this method to * adjust the rx mode. - * + * * @param datapointName The datapoint that will be updated on the device * @param currentValue The current value of the datapoint * @param newValue The value that will be sent to the device @@ -367,7 +367,6 @@ protected void updateDatapointState(HmDatapoint dp) { */ private void updateChannelState(final HmDatapoint dp, Channel channel) throws IOException, GatewayNotAvailableException, ConverterException { - if (dp.isTrigger()) { if (dp.getValue() != null) { triggerChannel(channel.getUID(), ObjectUtils.toString(dp.getValue())); @@ -388,8 +387,7 @@ private void updateChannelState(final HmDatapoint dp, Channel channel) /** * Loads all values for the given Homematic channel if it is not initialized. */ - private void loadHomematicChannelValues(HmChannel hmChannel) - throws GatewayNotAvailableException, IOException { + private void loadHomematicChannelValues(HmChannel hmChannel) throws GatewayNotAvailableException, IOException { if (!hmChannel.isInitialized()) { synchronized (this) { if (!hmChannel.isInitialized()) { diff --git a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/MetadataUtils.java b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/MetadataUtils.java index 2a1f5a5726477..f588d7b23ef8b 100644 --- a/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/MetadataUtils.java +++ b/bundles/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/type/MetadataUtils.java @@ -75,7 +75,6 @@ private static void loadStandardDatapoints() { Bundle bundle = FrameworkUtil.getBundle(MetadataUtils.class); try (InputStream stream = bundle.getResource("homematic/standard-datapoints.properties").openStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) { - String line; while ((line = reader.readLine()) != null) { if (StringUtils.trimToNull(line) != null && !StringUtils.startsWith(line, "#")) { diff --git a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/communicator/virtual/ButtonDatapointTest.java b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/communicator/virtual/ButtonDatapointTest.java index 55a144308f424..3979c6f9dc539 100644 --- a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/communicator/virtual/ButtonDatapointTest.java +++ b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/communicator/virtual/ButtonDatapointTest.java @@ -21,7 +21,6 @@ import org.eclipse.smarthome.test.java.JavaTest; import org.junit.Before; import org.junit.Test; -import org.openhab.binding.homematic.internal.communicator.virtual.ButtonVirtualDatapointHandler; import org.openhab.binding.homematic.internal.misc.HomematicClientException; import org.openhab.binding.homematic.internal.misc.HomematicConstants; import org.openhab.binding.homematic.internal.misc.MiscUtils; @@ -138,7 +137,6 @@ private HmDatapoint getButtonVirtualDatapoint(HmDatapoint originalDatapoint) { private class MockEventReceiver { public void eventReceived(HmDatapoint dp) throws IOException, HomematicClientException { - if (bvdpHandler.canHandleEvent(dp)) { bvdpHandler.handleEvent(null, dp); } @@ -154,7 +152,6 @@ private void disableDatapoint(HmDatapoint dp) { Thread.sleep(DISABLE_DATAPOINT_DELAY); dp.setValue(Boolean.FALSE); } catch (InterruptedException e) { - } }).start(); } diff --git a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConvertToBindingTest.java b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConvertToBindingTest.java index 1c76595a4a566..197a8d229b95b 100644 --- a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConvertToBindingTest.java +++ b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConvertToBindingTest.java @@ -101,14 +101,12 @@ public void testQuantityTypeConverter() throws ConverterException { @Test(expected = ConverterException.class) public void testQuantityTypeConverterFailsToConvertDecimalType() throws ConverterException { - QuantityTypeConverter converter = new QuantityTypeConverter(); converter.convertToBinding(new DecimalType(99.9), floatDp); } @Test(expected = ConverterException.class) public void testDecimalTypeConverterFailsToConvertQuantityType() throws ConverterException { - DecimalTypeConverter converter = new DecimalTypeConverter(); converter.convertToBinding(new QuantityType<>("99.9 %"), floatDp); } diff --git a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConverterFactoryTest.java b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConverterFactoryTest.java index 7bd75bf89a736..52d257f52ae2b 100644 --- a/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConverterFactoryTest.java +++ b/bundles/org.openhab.binding.homematic/src/test/java/org/openhab/binding/homematic/internal/converter/ConverterFactoryTest.java @@ -16,8 +16,6 @@ import static org.hamcrest.MatcherAssert.assertThat; import org.junit.Test; -import org.openhab.binding.homematic.internal.converter.ConverterException; -import org.openhab.binding.homematic.internal.converter.ConverterFactory; import org.openhab.binding.homematic.internal.converter.type.DecimalTypeConverter; import org.openhab.binding.homematic.internal.converter.type.OnOffTypeConverter; import org.openhab.binding.homematic.internal.converter.type.OpenClosedTypeConverter; @@ -35,7 +33,6 @@ public class ConverterFactoryTest { @Test public void testTypesOfCreatedConverters() throws ConverterException { - assertThat(ConverterFactory.createConverter("Switch"), instanceOf(OnOffTypeConverter.class)); assertThat(ConverterFactory.createConverter("Rollershutter"), instanceOf(PercentTypeConverter.class)); assertThat(ConverterFactory.createConverter("Dimmer"), instanceOf(PercentTypeConverter.class)); @@ -44,7 +41,6 @@ public void testTypesOfCreatedConverters() throws ConverterException { assertThat(ConverterFactory.createConverter("Number"), instanceOf(DecimalTypeConverter.class)); assertThat(ConverterFactory.createConverter("Number:Temperature"), instanceOf(QuantityTypeConverter.class)); assertThat(ConverterFactory.createConverter("Number:Percent"), instanceOf(QuantityTypeConverter.class)); - } } diff --git a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/HydrawiseHandler.java b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/HydrawiseHandler.java index 324cae403a68c..888f7b150d8fa 100644 --- a/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/HydrawiseHandler.java +++ b/bundles/org.openhab.binding.hydrawise/src/main/java/org/openhab/binding/hydrawise/internal/HydrawiseHandler.java @@ -93,7 +93,6 @@ public HydrawiseHandler(Thing thing) { @SuppressWarnings({ "null", "unused" }) // compiler does not like relayMap.get can return null @Override public void handleCommand(ChannelUID channelUID, Command command) { - if (getThing().getStatus() != ThingStatus.ONLINE) { logger.warn("Controller is NOT ONLINE and is not responding to commands"); return; diff --git a/bundles/org.openhab.binding.hyperion/src/main/java/org/openhab/binding/hyperion/internal/handler/HyperionHandler.java b/bundles/org.openhab.binding.hyperion/src/main/java/org/openhab/binding/hyperion/internal/handler/HyperionHandler.java index 8ceaf9081ba36..17378fe2fdb68 100644 --- a/bundles/org.openhab.binding.hyperion/src/main/java/org/openhab/binding/hyperion/internal/handler/HyperionHandler.java +++ b/bundles/org.openhab.binding.hyperion/src/main/java/org/openhab/binding/hyperion/internal/handler/HyperionHandler.java @@ -139,7 +139,6 @@ private void updateTransform(List transform) { .findFirst(); if (defaultTransform.isPresent()) { - double luminanceGain = defaultTransform.get().getLuminanceGain(); if (luminanceGain >= 0.0 && luminanceGain <= 1.0) { PercentType luminanceGainPercentType = new PercentType((int) (luminanceGain * 100)); diff --git a/bundles/org.openhab.binding.iaqualink/src/main/java/org/openhab/binding/iaqualink/internal/handler/IAqualinkHandler.java b/bundles/org.openhab.binding.iaqualink/src/main/java/org/openhab/binding/iaqualink/internal/handler/IAqualinkHandler.java index 0072ae1b9a27b..48304ce9709c5 100644 --- a/bundles/org.openhab.binding.iaqualink/src/main/java/org/openhab/binding/iaqualink/internal/handler/IAqualinkHandler.java +++ b/bundles/org.openhab.binding.iaqualink/src/main/java/org/openhab/binding/iaqualink/internal/handler/IAqualinkHandler.java @@ -303,7 +303,6 @@ private void configure() { } initPolling(COMMAND_REFRESH_SECONDS); - } catch (IOException e) { logger.debug("Could not connect to service {}", e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); @@ -527,7 +526,6 @@ private void addNewChannelToList(List list, ChannelUID channelUID, Stri @SuppressWarnings("unchecked") private @Nullable BigDecimal commandToRoundedTemperature(Command command, Unit unit) throws IllegalArgumentException { - QuantityType quantity; if (command instanceof QuantityType) { quantity = (QuantityType) command; diff --git a/bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/converters/OnOffTypeWSIntegerValueConverter.java b/bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/converters/OnOffTypeWSIntegerValueConverter.java index bb8382d45863b..b64816ba950ef 100644 --- a/bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/converters/OnOffTypeWSIntegerValueConverter.java +++ b/bundles/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/converters/OnOffTypeWSIntegerValueConverter.java @@ -34,7 +34,6 @@ public OnOffType convertFromResourceValue(@NonNull WSIntegerValue from, @Override public WSIntegerValue convertFromOHType(@NonNull OnOffType from, @NonNull WSIntegerValue value, @NonNull ConverterAdditionalInfo convertData) throws ConversionException { - int onLevel = Math.min(value.maximumValue, getCommandLevel(value, convertData, OnOffType.ON)); int newVal = from == OnOffType.ON ? onLevel : value.minimumValue; diff --git a/bundles/org.openhab.binding.innogysmarthome/src/main/java/org/openhab/binding/innogysmarthome/internal/handler/InnogyDeviceHandler.java b/bundles/org.openhab.binding.innogysmarthome/src/main/java/org/openhab/binding/innogysmarthome/internal/handler/InnogyDeviceHandler.java index 8557c5f752f88..2163f9aecd01f 100644 --- a/bundles/org.openhab.binding.innogysmarthome/src/main/java/org/openhab/binding/innogysmarthome/internal/handler/InnogyDeviceHandler.java +++ b/bundles/org.openhab.binding.innogysmarthome/src/main/java/org/openhab/binding/innogysmarthome/internal/handler/InnogyDeviceHandler.java @@ -188,7 +188,6 @@ public void handleCommand(final ChannelUID channelUID, final Command command) { if (command instanceof OnOffType) { innogyBridgeHandler.commandSwitchAlarm(deviceId, OnOffType.ON.equals(command)); } - } else { logger.debug("UNSUPPORTED channel {} for device {}.", channelUID.getId(), deviceId); } @@ -378,7 +377,6 @@ public void onDeviceStateChanged(final Device device) { "State is " + device.getDeviceState().getDeviceInclusionState()); } } - } if (device.isBatteryPowered()) { @@ -675,7 +673,6 @@ public void onDeviceStateChanged(final Device device) { } } } - } /** diff --git a/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactHandler.java b/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactHandler.java index 28d7b6d55f46a..722481ab5b69e 100644 --- a/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactHandler.java +++ b/bundles/org.openhab.binding.keba/src/main/java/org/openhab/binding/keba/internal/handler/KeContactHandler.java @@ -183,7 +183,6 @@ protected Configuration getConfig() { } isReport100needed = false; } - } } } catch (NumberFormatException | IOException e) { @@ -558,15 +557,17 @@ public void handleCommand(ChannelUID channelUID, Command command) { if (command instanceof DecimalType) { transceiver.send( "setenergy " + String.valueOf( - Math.min(Math.max(0, ((DecimalType) command).intValue()*10), 999999999)), this); + Math.min(Math.max(0, ((DecimalType) command).intValue() * 10), 999999999)), + this); } break; } case CHANNEL_AUTHENTICATE: { if (command instanceof StringType) { String cmd = command.toString(); - // cmd must contain ID + CLASS (works only if the RFID TAG is in the whitelist of the Keba station) - transceiver.send("start " + cmd , this); + // cmd must contain ID + CLASS (works only if the RFID TAG is in the whitelist of the Keba + // station) + transceiver.send("start " + cmd, this); } break; } diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/AbstractSpec.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/AbstractSpec.java index 318b887908aa8..a6ec05d3c220f 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/AbstractSpec.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/AbstractSpec.java @@ -38,7 +38,6 @@ protected AbstractSpec(@Nullable ChannelConfiguration channelConfiguration, Stri } else { this.dpt = defaultDPT; } - } /** diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelType.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelType.java index 3ce5b6b78ebbd..b8e009ecb3b2d 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelType.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelType.java @@ -72,7 +72,6 @@ protected final ChannelConfiguration parse(@Nullable String fancy) { Matcher matcher = PATTERN.matcher(fancy.replace(" ", "")); if (matcher.matches()) { - // Listen GAs String input = matcher.group("listenGAs"); Matcher m2 = PATTERN_LISTEN.matcher(input); diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelTypes.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelTypes.java index c74db5674bb1c..05bd8477af9df 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelTypes.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/KNXChannelTypes.java @@ -55,7 +55,6 @@ public static KNXChannelType getType(@Nullable ChannelTypeUID channelTypeUID) th } } throw new IllegalArgumentException(channelTypeUID.getId() + " is not a valid value channel type ID"); - } } diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/WriteSpecImpl.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/WriteSpecImpl.java index 07b3fd97f1373..dd72b7fa0067b 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/WriteSpecImpl.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/channel/WriteSpecImpl.java @@ -35,7 +35,6 @@ public WriteSpecImpl(@Nullable ChannelConfiguration channelConfiguration, String super(channelConfiguration, defaultDPT); if (channelConfiguration != null) { this.groupAddress = new GroupAddress(channelConfiguration.getMainGA().getGA()); - } else { this.groupAddress = null; } diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/client/DeviceInspector.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/client/DeviceInspector.java index 8a80ed03e20bb..5434c79cc62df 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/client/DeviceInspector.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/client/DeviceInspector.java @@ -100,7 +100,6 @@ private Map readDeviceProperties(IndividualAddress address) { byte[] elements = getClient().readDeviceProperties(address, DEVICE_OBJECT, PID.OBJECT_TYPE, 0, 1, false, OPERATION_TIMEOUT); if ((elements == null ? 0 : toUnsigned(elements)) == 1) { - Thread.sleep(OPERATION_INTERVAL); String ManufacturerID = Manufacturer.getName(toUnsigned(getClient().readDeviceProperties(address, DEVICE_OBJECT, PID.MANUFACTURER_ID, 1, 1, false, OPERATION_TIMEOUT))); diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java index 2dcdd2950d264..0035e02d91d57 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java @@ -108,7 +108,6 @@ public class KNXCoreTypeMapper implements KNXTypeMapper { private final Map, String> defaultDptMap; public KNXCoreTypeMapper() { - @SuppressWarnings("unused") final List> xlators = Arrays.> asList(DPTXlator1BitControlled.class, DPTXlator2ByteFloat.class, DPTXlator2ByteUnsigned.class, DPTXlator3BitControlled.class, @@ -573,7 +572,6 @@ public KNXCoreTypeMapper() { @Override public String toDPTValue(Type type, String dptID) { - DPT dpt; int mainNumber = getMainNumber(dptID); if (mainNumber == -1) { diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java index ba6b0abea116a..dd06106c0937b 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java @@ -242,7 +242,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { break; } } - } private boolean isControl(ChannelUID channelUID) { diff --git a/bundles/org.openhab.binding.konnected/src/main/java/org/openhab/binding/konnected/internal/handler/KonnectedHandler.java b/bundles/org.openhab.binding.konnected/src/main/java/org/openhab/binding/konnected/internal/handler/KonnectedHandler.java index 6e4cb5c6c02e6..b26e3e9b33235 100644 --- a/bundles/org.openhab.binding.konnected/src/main/java/org/openhab/binding/konnected/internal/handler/KonnectedHandler.java +++ b/bundles/org.openhab.binding.konnected/src/main/java/org/openhab/binding/konnected/internal/handler/KonnectedHandler.java @@ -191,7 +191,6 @@ private void checkConfiguration() throws ConfigValidationException { this.retryCount = 2; } try { - this.http.setRequestTimeout(Integer.parseInt(testRequestTimeout)); } catch (NumberFormatException e) { logger.debug( diff --git a/bundles/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/handler/LGWebOSTVKeyboardInput.java b/bundles/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/handler/LGWebOSTVKeyboardInput.java index 7988d73eb299a..a0eee268d90bf 100644 --- a/bundles/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/handler/LGWebOSTVKeyboardInput.java +++ b/bundles/org.openhab.binding.lgwebos/src/main/java/org/openhab/binding/lgwebos/internal/handler/LGWebOSTVKeyboardInput.java @@ -107,7 +107,6 @@ private void sendData() { } payload.addProperty("count", count); - } else { uri = "ssap://com.webos.service.ime/insertText"; StringBuilder sb = new StringBuilder(); @@ -120,7 +119,6 @@ private void sendData() { payload.addProperty("text", sb.toString()); payload.addProperty("replace", 0); - } ResponseListener responseListener = new ResponseListener() { diff --git a/bundles/org.openhab.binding.logreader/src/main/java/org/openhab/binding/logreader/internal/searchengine/SearchEngine.java b/bundles/org.openhab.binding.logreader/src/main/java/org/openhab/binding/logreader/internal/searchengine/SearchEngine.java index 35eaf7db7e4b3..63890f8aff007 100644 --- a/bundles/org.openhab.binding.logreader/src/main/java/org/openhab/binding/logreader/internal/searchengine/SearchEngine.java +++ b/bundles/org.openhab.binding.logreader/src/main/java/org/openhab/binding/logreader/internal/searchengine/SearchEngine.java @@ -84,7 +84,6 @@ private List compilePatterns(@Nullable String patterns) throws PatternS if (patterns != null && !patterns.isEmpty()) { String list[] = patterns.split("\\|"); if (list.length > 0) { - for (String patternStr : list) { patternsList.add(Pattern.compile(patternStr)); } diff --git a/bundles/org.openhab.binding.mcp23017/src/main/java/org/openhab/binding/mcp23017/internal/handler/Mcp23017Handler.java b/bundles/org.openhab.binding.mcp23017/src/main/java/org/openhab/binding/mcp23017/internal/handler/Mcp23017Handler.java index f218f681de120..d08cece5d2d96 100644 --- a/bundles/org.openhab.binding.mcp23017/src/main/java/org/openhab/binding/mcp23017/internal/handler/Mcp23017Handler.java +++ b/bundles/org.openhab.binding.mcp23017/src/main/java/org/openhab/binding/mcp23017/internal/handler/Mcp23017Handler.java @@ -62,7 +62,6 @@ public class Mcp23017Handler extends BaseThingHandler implements GpioPinListener public Mcp23017Handler(Thing thing) { super(thing); - } @Override diff --git a/bundles/org.openhab.binding.meteostick/src/main/java/org/openhab/binding/meteostick/internal/handler/MeteostickSensorHandler.java b/bundles/org.openhab.binding.meteostick/src/main/java/org/openhab/binding/meteostick/internal/handler/MeteostickSensorHandler.java index e4407bfdb4a39..5a1133a0de9b5 100644 --- a/bundles/org.openhab.binding.meteostick/src/main/java/org/openhab/binding/meteostick/internal/handler/MeteostickSensorHandler.java +++ b/bundles/org.openhab.binding.meteostick/src/main/java/org/openhab/binding/meteostick/internal/handler/MeteostickSensorHandler.java @@ -272,7 +272,6 @@ public RainHistory(long period) { } public BigDecimal getTotal(BigDecimal spoon) { - removeOldEntries(); int least = -1; @@ -341,7 +340,6 @@ public void put(BigDecimal speed, int directionDegrees) { } public WindStats getStats() { - removeOldEntries(); double ewSum = 0; diff --git a/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/handler/MieleBridgeHandler.java b/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/handler/MieleBridgeHandler.java index 50ad0db858fca..b0fcdabc54a27 100644 --- a/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/handler/MieleBridgeHandler.java +++ b/bundles/org.openhab.binding.miele/src/main/java/org/openhab/binding/miele/internal/handler/MieleBridgeHandler.java @@ -429,7 +429,6 @@ public JsonElement invokeOperation(String UID, String modelID, String methodName } public JsonElement invokeOperation(String UID, String modelID, String methodName, String protocol) { - if (getThing().getStatus() == ThingStatus.ONLINE) { Object[] args = new Object[4]; args[0] = protocol + UID; diff --git a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/handler/XiaomiDeviceBaseHandler.java b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/handler/XiaomiDeviceBaseHandler.java index f3cc506e3cdf6..2b3a9f794380b 100644 --- a/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/handler/XiaomiDeviceBaseHandler.java +++ b/bundles/org.openhab.binding.mihome/src/main/java/org/openhab/binding/mihome/internal/handler/XiaomiDeviceBaseHandler.java @@ -117,7 +117,6 @@ public void dispose() { if (!onlineCheckTask.isDone()) { onlineCheckTask.cancel(false); } - } @Override diff --git a/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java b/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java index 009423b3224f0..cdcf19c9807d9 100644 --- a/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java +++ b/bundles/org.openhab.binding.millheat/src/main/java/org/openhab/binding/millheat/internal/handler/MillheatAccountHandler.java @@ -402,7 +402,6 @@ public void updateRoomTemperature(final Long roomId, final Command command, fina public void updateIndependentHeaterProperties(@Nullable final String macAddress, @Nullable final Long heaterId, @Nullable final Command temperatureCommand, @Nullable final Command masterOnOffCommand, @Nullable final Command fanCommand) { - model.findHeaterByMacOrId(macAddress, heaterId).ifPresent(heater -> { int setTemp = heater.getTargetTemp(); if (temperatureCommand instanceof QuantityType) { @@ -429,7 +428,6 @@ public void updateIndependentHeaterProperties(@Nullable final String macAddress, } public void updateVacationProperty(Home home, String property, Command command) { - try { switch (property) { case SetHolidayParameterRequest.PROP_START: { diff --git a/bundles/org.openhab.binding.millheat/src/test/java/org/openhab/binding/millheat/internal/MillHeatAccountHandlerTest.java b/bundles/org.openhab.binding.millheat/src/test/java/org/openhab/binding/millheat/internal/MillHeatAccountHandlerTest.java index 1fa7da159fa97..2a72612640c8a 100644 --- a/bundles/org.openhab.binding.millheat/src/test/java/org/openhab/binding/millheat/internal/MillHeatAccountHandlerTest.java +++ b/bundles/org.openhab.binding.millheat/src/test/java/org/openhab/binding/millheat/internal/MillHeatAccountHandlerTest.java @@ -71,7 +71,6 @@ public void shutdown() throws Exception { @Test public void testUpdateModel() throws InterruptedException, IOException, MillheatCommunicationException { - final String getHomesResponse = IOUtils.toString(getClass().getResourceAsStream("/select_home_list_ok.json")); final String getRoomsByHomeResponse = IOUtils .toString(getClass().getResourceAsStream("/get_rooms_by_home_ok.json")); diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/DiscoverComponents.java b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/DiscoverComponents.java index c91e3449d7652..9dcd5d4f0f0f1 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/DiscoverComponents.java +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/DiscoverComponents.java @@ -131,7 +131,6 @@ public void processMessage(String topic, byte[] payload) { */ public CompletableFuture<@Nullable Void> startDiscovery(MqttBrokerConnection connection, int discoverTime, Set topicDescriptions, ComponentDiscovered componentsDiscoveredListener) { - this.topics = topicDescriptions.stream().map(id -> id.getTopic("config")).collect(Collectors.toSet()); this.discoverTime = discoverTime; this.discoveredListener = componentsDiscoveredListener; diff --git a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/handler/HomeAssistantThingHandler.java b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/handler/HomeAssistantThingHandler.java index 39afcf3e26ee0..532ca5f29becc 100644 --- a/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/handler/HomeAssistantThingHandler.java +++ b/bundles/org.openhab.binding.mqtt.homeassistant/src/main/java/org/openhab/binding/mqtt/homeassistant/internal/handler/HomeAssistantThingHandler.java @@ -308,7 +308,6 @@ private void updateThingType() { // if this is a dynamic type, then we update the type ThingTypeUID typeID = thing.getThingTypeUID(); if (!MqttBindingConstants.HOMEASSISTANT_MQTT_THING.equals(typeID)) { - List groupDefs; List channelDefs; synchronized (haComponents) { // sync whenever discoverComponents is started diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/discovery/Homie300Discovery.java b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/discovery/Homie300Discovery.java index f964c0644c4c2..ca3e57e7a6c5d 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/discovery/Homie300Discovery.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/discovery/Homie300Discovery.java @@ -103,7 +103,6 @@ public void receivedMessage(ThingUID connectionBridge, MqttBrokerConnection conn // The name is nice to have, but not required, use deviceId as fallback publishDevice(connectionBridge, connection, deviceID, topic, deviceID); } - } void publishDevice(ThingUID connectionBridge, MqttBrokerConnection connection, String deviceID, String topic, diff --git a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Node.java b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Node.java index 56132f21d25f2..81f37ab9aaf0a 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Node.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/main/java/org/openhab/binding/mqtt/homie/internal/homie300/Node.java @@ -184,7 +184,6 @@ protected void notifyPropertyRemoved(Property property) { @Override public void attributeChanged(String name, Object value, MqttBrokerConnection connection, ScheduledExecutorService scheduler, boolean allMandatoryFieldsReceived) { - if (!initialized || !allMandatoryFieldsReceived) { return; } diff --git a/bundles/org.openhab.binding.mqtt.homie/src/test/java/org/openhab/binding/mqtt/homie/internal/handler/HomieThingHandlerTests.java b/bundles/org.openhab.binding.mqtt.homie/src/test/java/org/openhab/binding/mqtt/homie/internal/handler/HomieThingHandlerTests.java index f2e2b551a1dc8..ce61a0a7ff5c9 100644 --- a/bundles/org.openhab.binding.mqtt.homie/src/test/java/org/openhab/binding/mqtt/homie/internal/handler/HomieThingHandlerTests.java +++ b/bundles/org.openhab.binding.mqtt.homie/src/test/java/org/openhab/binding/mqtt/homie/internal/handler/HomieThingHandlerTests.java @@ -144,7 +144,6 @@ public void setUp() { // We are by default online doReturn(thingStatus).when(thingHandler).getBridgeStatus(); - } @Test diff --git a/bundles/org.openhab.binding.mqtt/src/test/java/org/openhab/binding/mqtt/handler/BrokerHandlerTest.java b/bundles/org.openhab.binding.mqtt/src/test/java/org/openhab/binding/mqtt/handler/BrokerHandlerTest.java index 7e2c38c1a7d76..19fbb2adeb6a9 100644 --- a/bundles/org.openhab.binding.mqtt/src/test/java/org/openhab/binding/mqtt/handler/BrokerHandlerTest.java +++ b/bundles/org.openhab.binding.mqtt/src/test/java/org/openhab/binding/mqtt/handler/BrokerHandlerTest.java @@ -102,7 +102,6 @@ public void createBrokerConnection() { @Test public void handlerInit() throws InterruptedException, IllegalArgumentException, MqttException, ConfigurationException { - assertThat(initializeHandlerWaitForTimeout(), is(true)); ArgumentCaptor statusInfoCaptor = ArgumentCaptor.forClass(ThingStatusInfo.class); @@ -122,7 +121,6 @@ public void handlerInit() */ boolean initializeHandlerWaitForTimeout() throws InterruptedException, IllegalArgumentException, MqttException, ConfigurationException { - MqttBrokerConnection c = connection; MqttConnectionObserverEx o = new MqttConnectionObserverEx(); diff --git a/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubHandler.java b/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubHandler.java index ba5edd84848a2..7be9729e189c8 100644 --- a/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubHandler.java +++ b/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubHandler.java @@ -28,7 +28,7 @@ import org.eclipse.smarthome.core.thing.binding.BaseBridgeHandler; import org.eclipse.smarthome.core.thing.binding.ThingHandler; import org.eclipse.smarthome.core.types.Command; - +import org.openhab.binding.neohub.internal.NeoHubBindingConstants.NeoHubReturnResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ * * @author Andrew Fiddian-Green - Initial contribution (v2.x binding code) * @author Sebastian Prehn - Initial contribution (v1.x hub communication) - * + * */ public class NeoHubHandler extends BaseBridgeHandler { @@ -70,24 +70,27 @@ public void initialize() { return; } - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug("hostname={}", config.hostName); + } if (config.hostName.isEmpty()) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "parameter hostName must be set!"); return; } - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug("port={}", config.portNumber); + } if (config.portNumber <= 0 || config.portNumber > 0xFFFF) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "portNumber is invalid!"); return; } - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug("polling interval={}", config.pollingInterval); + } if (config.pollingInterval < FAST_POLL_INTERVAL || config.pollingInterval > LAZY_POLL_INTERVAL) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, String @@ -97,8 +100,9 @@ public void initialize() { socket = new NeoHubSocket(config.hostName, config.portNumber); - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug("start background polling.."); + } // create a "lazy" polling scheduler if (lazyPollingScheduler == null || lazyPollingScheduler.isCancelled()) { @@ -121,8 +125,9 @@ public void initialize() { @Override public void dispose() { - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled()) { logger.debug("stop background polling.."); + } // clean up the lazy polling scheduler if (lazyPollingScheduler != null && !lazyPollingScheduler.isCancelled()) { @@ -160,7 +165,6 @@ public synchronized NeoHubReturnResult toNeoHubSendChannelValue(String commandSt startFastPollingBurst(); return NeoHubReturnResult.SUCCEEDED; - } catch (Exception e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); logger.warn("set value error \"{}\"", e.getMessage()); @@ -170,9 +174,9 @@ public synchronized NeoHubReturnResult toNeoHubSendChannelValue(String commandSt /** * sends a JSON "INFO" request to the NeoHub - * + * * @return a class that contains the full status of all devices - * + * */ protected NeoHubInfoResponse fromNeoHubFetchPollingResponse() { if (socket == null || config == null) { @@ -183,7 +187,7 @@ protected NeoHubInfoResponse fromNeoHubFetchPollingResponse() { try { @Nullable String response = socket.sendMessage(CMD_CODE_INFO); - + NeoHubInfoResponse newInfoResponse = NeoHubInfoResponse.createInfoResponse(response); if (newInfoResponse == null) { @@ -203,7 +207,6 @@ protected NeoHubInfoResponse fromNeoHubFetchPollingResponse() { } return newInfoResponse; - } catch (Exception e) { logger.warn(MSG_FMT_POLL_ERR, e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); @@ -217,7 +220,7 @@ protected NeoHubInfoResponse fromNeoHubFetchPollingResponse() { * handlers */ private synchronized void lazyPollingSchedulerExecute() { - NeoHubInfoResponse infoResponse = fromNeoHubFetchPollingResponse(); + NeoHubInfoResponse infoResponse = fromNeoHubFetchPollingResponse(); if (infoResponse != null) { List children = getThing().getThings(); diff --git a/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubSocket.java b/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubSocket.java index 7c55b9b683ba7..50cdb88da099b 100644 --- a/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubSocket.java +++ b/bundles/org.openhab.binding.neohub/src/main/java/org/openhab/binding/neohub/internal/NeoHubSocket.java @@ -12,14 +12,12 @@ */ package org.openhab.binding.neohub.internal; -import static org.openhab.binding.neohub.internal.NeoHubBindingConstants.*; - import static java.nio.charset.StandardCharsets.US_ASCII; +import static org.openhab.binding.neohub.internal.NeoHubBindingConstants.TCP_SOCKET_TIMEOUT; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; - import java.net.InetSocketAddress; import java.net.Socket; @@ -29,10 +27,10 @@ /** * NeoHubConnector handles the ASCII based communication via TCP between openHAB * and NeoHub - * + * * @author Sebastian Prehn - Initial contribution * @author Andrew Fiddian-Green - Refactoring for openHAB v2.x - * + * */ public class NeoHubSocket { @@ -55,11 +53,11 @@ public NeoHubSocket(final String hostname, final int portNumber) { /** * sends the message over the network to the NeoHub and returns its response - * + * * @param request the message to be sent to the NeoHub * @return response received from NeoHub * @throws IOException, RuntimeException - * + * */ public String sendMessage(final String request) throws IOException, NeoHubException { try (Socket socket = new Socket()) { @@ -70,13 +68,12 @@ public String sendMessage(final String request) throws IOException, NeoHubExcept socket.setSoTimeout(TCP_SOCKET_TIMEOUT * 1000); try (InputStreamReader reader = new InputStreamReader(socket.getInputStream(), US_ASCII); - OutputStreamWriter writer = new OutputStreamWriter(socket.getOutputStream(), US_ASCII)) { - + OutputStreamWriter writer = new OutputStreamWriter(socket.getOutputStream(), US_ASCII)) { if (logger.isDebugEnabled()) { logger.debug("sending {} characters..", request.length()); logger.debug(">> {}", request); } - + writer.write(request); writer.write(0); // NULL terminate the command string writer.flush(); @@ -84,7 +81,7 @@ public String sendMessage(final String request) throws IOException, NeoHubExcept if (logger.isTraceEnabled()) { logger.trace("sent {} characters..", request.length()); } - + StringBuilder builder = new StringBuilder(); int inChar; while ((inChar = reader.read()) > 0) { // NULL termination & end of stream (-1) diff --git a/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/PresenceDetection.java b/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/PresenceDetection.java index 36449d3b1d585..de5f828bb60db 100644 --- a/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/PresenceDetection.java +++ b/bundles/org.openhab.binding.network/src/main/java/org/openhab/binding/network/internal/PresenceDetection.java @@ -566,7 +566,6 @@ protected void performSystemPing() { updateListener.partialDetectionResult(v); } }); - } catch (IOException e) { logger.trace("Failed to execute a native ping for ip {}", hostname, e); } catch (InterruptedException e) { diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/NibeHeatPumpHandlerFactory.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/NibeHeatPumpHandlerFactory.java index a356b1b8e33bf..4215cf23eb486 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/NibeHeatPumpHandlerFactory.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/NibeHeatPumpHandlerFactory.java @@ -39,7 +39,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/ConnectorFactory.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/ConnectorFactory.java index 9c7db29dd7b0a..1b0e2bc49ee98 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/ConnectorFactory.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/ConnectorFactory.java @@ -27,7 +27,6 @@ public class ConnectorFactory { public static NibeHeatPumpConnector getConnector(ThingTypeUID type) throws NibeHeatPumpException { if (type != null) { - if (THING_TYPE_F1X45_UDP.equals(type) || THING_TYPE_F1X55_UDP.equals(type) || THING_TYPE_F750_UDP.equals(type) || THING_TYPE_F470_UDP.equals(type)) { return new UDPConnector(); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/NibeHeatPumpBaseConnector.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/NibeHeatPumpBaseConnector.java index 2ba1eca1081fd..737a1a2f0d1ab 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/NibeHeatPumpBaseConnector.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/NibeHeatPumpBaseConnector.java @@ -62,7 +62,6 @@ public void sendMsgToListeners(byte[] data) { public void sendMsgToListeners(NibeHeatPumpMessage msg) { if (msg != null) { - for (NibeHeatPumpEventListener listener : listeners) { try { listener.msgReceived(msg); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/SimulatorConnector.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/SimulatorConnector.java index af034c84ffaf0..0e5eb21646d36 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/SimulatorConnector.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/SimulatorConnector.java @@ -134,16 +134,13 @@ public void interrupt() { @Override public void run() { - logger.debug("Data listener simulator started"); int i = 1; while (!interrupted) { - try { if (i++ % 60 == 0) { - // simulate CRC error ones a while ModbusDataReadOutMessage dataReadOut = new ModbusDataReadOutMessage.MessageBuilder() .values(dataReadoutValues).build(); @@ -153,15 +150,11 @@ public void run() { sendMsgToListeners(data); Thread.sleep(1000); continue; - } else if (i % 100 == 0) { - sendErrorToListeners("Simulated error"); Thread.sleep(1000); continue; - } else if (i % 10 == 0) { - // ok data ModbusDataReadOutMessage dataReadOut = new ModbusDataReadOutMessage.MessageBuilder() .values(dataReadoutValues).build(); @@ -171,7 +164,6 @@ public void run() { } if (!writeQueue.isEmpty()) { - byte[] data = writeQueue.remove(0); try { ModbusWriteRequestMessage writeReq = (ModbusWriteRequestMessage) MessageFactory @@ -184,9 +176,7 @@ public void run() { } catch (NibeHeatPumpException e) { logger.debug("Simulation error, cause {}", e.getMessage()); } - } else if (!readQueue.isEmpty()) { - byte[] data = readQueue.remove(0); try { ModbusReadRequestMessage readReq = (ModbusReadRequestMessage) MessageFactory diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/UDPConnector.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/UDPConnector.java index 5d55527262da7..1634f2b84f91f 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/UDPConnector.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/connection/UDPConnector.java @@ -132,7 +132,6 @@ public void interrupt() { @Override public void run() { - logger.debug("Data listener started"); while (!interrupted) { final int packetSize = 255; diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/handler/NibeHeatPumpHandler.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/handler/NibeHeatPumpHandler.java index 0915f98559c18..14a6536c54e61 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/handler/NibeHeatPumpHandler.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/handler/NibeHeatPumpHandler.java @@ -81,7 +81,6 @@ public class NibeHeatPumpHandler extends BaseThingHandler implements NibeHeatPum private final Runnable pollingRunnable = new Runnable() { @Override public void run() { - if (!configuration.enableReadCommands) { logger.trace("All read commands denied, skip polling!"); return; @@ -95,11 +94,9 @@ public void run() { for (int item : items) { if (connector != null && connector.isConnected() && getThing().getStatusInfo().getStatus() == ThingStatus.ONLINE) { - CacheObject oldValue = stateMap.get(item); if (oldValue == null || (oldValue.lastUpdateTime + refreshIntervalMillis()) < System.currentTimeMillis()) { - // it's time to refresh data logger.debug("Time to refresh variable '{}' data", item); @@ -450,7 +447,6 @@ private void clearCache(int coilAddress) { private synchronized NibeHeatPumpCommandResult sendMessageToNibe(NibeHeatPumpMessage msg) throws NibeHeatPumpException { - logger.debug("Sending message: {}", msg); connector.sendDatagram(msg); return new NibeHeatPumpCommandResult(); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/MessageFactory.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/MessageFactory.java index 315c8f2e7d6aa..25129dfe98be2 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/MessageFactory.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/MessageFactory.java @@ -25,9 +25,7 @@ public class MessageFactory { public static NibeHeatPumpMessage getMessage(byte[] message) throws NibeHeatPumpException { - if (message != null) { - byte messageTypeByte = NibeHeatPumpProtocol.getMessageType(message); MessageType messageType = NibeHeatPumpBaseMessage.getMessageType(messageTypeByte); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessage.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessage.java index f7d96f82502aa..d1c525a9e5875 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessage.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessage.java @@ -51,7 +51,6 @@ public byte[] decodeMessage() { } private byte[] createDataReadOutPdu(List values) { - byte datalen = (byte) (values.size() * 4); byte msglen = (byte) (6 + datalen); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusReadRequestMessage.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusReadRequestMessage.java index 8124598934bdf..8626ddb9dde28 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusReadRequestMessage.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusReadRequestMessage.java @@ -53,7 +53,6 @@ public byte[] decodeMessage() { } private byte[] createModbus40ReadPdu(int coilAddress) { - byte[] data = new byte[6]; data[0] = NibeHeatPumpProtocol.FRAME_START_CHAR_TO_NIBE; data[1] = NibeHeatPumpProtocol.CMD_MODBUS_READ_REQ; diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusWriteRequestMessage.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusWriteRequestMessage.java index 5bc915bf3b35f..df4d0081af265 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusWriteRequestMessage.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/ModbusWriteRequestMessage.java @@ -68,7 +68,6 @@ public byte[] decodeMessage() { } private byte[] createModbus40WritePdu(int coildAddress, int value) { - byte[] data = new byte[10]; data[0] = NibeHeatPumpProtocol.FRAME_START_CHAR_TO_NIBE; diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpBaseMessage.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpBaseMessage.java index 540c2591dffa8..e13e1d66e13ec 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpBaseMessage.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpBaseMessage.java @@ -13,7 +13,6 @@ package org.openhab.binding.nibeheatpump.internal.message; import org.eclipse.smarthome.core.util.HexUtils; - import org.openhab.binding.nibeheatpump.internal.NibeHeatPumpException; import org.openhab.binding.nibeheatpump.internal.protocol.NibeHeatPumpProtocol; @@ -61,7 +60,6 @@ public byte toByte() { public byte msgId; public NibeHeatPumpBaseMessage() { - } public NibeHeatPumpBaseMessage(byte[] data) throws NibeHeatPumpException { diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/models/PumpModel.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/models/PumpModel.java index 5778d278b805e..84408e8da2541 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/models/PumpModel.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/models/PumpModel.java @@ -36,7 +36,6 @@ public String toString() { } public static PumpModel getPumpModel(String pumpModel) throws IllegalArgumentException { - try { return PumpModel.valueOf(pumpModel.toUpperCase()); } catch (Exception e) { diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocol.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocol.java index 8ac807cbce79a..57051236eb12a 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocol.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocol.java @@ -43,10 +43,8 @@ public class NibeHeatPumpProtocol { public static final byte ADR_MODBUS40 = (byte) 0x20; public static boolean isModbus40DataReadOut(byte[] data) { - if (data[OFFSET_START] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_MODBUS40) { - return data[OFFSET_CMD] == CMD_MODBUS_DATA_MSG && data[OFFSET_LEN] >= (byte) 0x50; } @@ -54,10 +52,8 @@ public static boolean isModbus40DataReadOut(byte[] data) { } public static boolean isModbus40ReadResponse(byte[] data) { - if (data[OFFSET_START] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_MODBUS40) { - return data[OFFSET_CMD] == CMD_MODBUS_READ_RESP && data[OFFSET_LEN] >= (byte) 0x06; } @@ -65,9 +61,7 @@ public static boolean isModbus40ReadResponse(byte[] data) { } public static boolean isRmu40DataReadOut(byte[] data) { - if (data[0] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_RMU40) { - return data[OFFSET_CMD] == CMD_RMU_DATA_MSG && data[OFFSET_LEN] >= (byte) 0x18; } @@ -75,31 +69,26 @@ public static boolean isRmu40DataReadOut(byte[] data) { } public static boolean isModbus40WriteResponsePdu(byte[] data) { - return data[OFFSET_START] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_MODBUS40 && data[OFFSET_CMD] == CMD_MODBUS_WRITE_RESP; } public static boolean isModbus40WriteTokenPdu(byte[] data) { - return data[0] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_MODBUS40 && data[OFFSET_CMD] == CMD_MODBUS_WRITE_REQ && data[OFFSET_LEN] == 0x00; } public static boolean isModbus40ReadTokenPdu(byte[] data) { - return data[OFFSET_START] == FRAME_START_CHAR_FROM_NIBE && data[1] == (byte) 0x00 && data[OFFSET_ADR] == ADR_MODBUS40 && data[OFFSET_CMD] == CMD_MODBUS_READ_REQ && data[OFFSET_LEN] == 0x00; } public static boolean isModbus40WriteRequestPdu(byte[] data) { - return data[0] == FRAME_START_CHAR_TO_NIBE && data[1] == CMD_MODBUS_WRITE_REQ; } public static boolean isModbus40ReadRequestPdu(byte[] data) { - return data[OFFSET_START] == FRAME_START_CHAR_TO_NIBE && data[1] == CMD_MODBUS_READ_REQ; } @@ -150,7 +139,6 @@ public static byte[] checkMessageChecksumAndRemoveDoubles(byte[] data) throws Ni // if checksum is 0x5C (start character), heat pump seems to send 0xC5 checksum if (checksum == msgChecksum || (checksum == FRAME_START_CHAR_FROM_NIBE && msgChecksum == (byte) 0xC5)) { - // if data contains 0x5C (start character), data seems to contains double 0x5C characters // let's remove doubles diff --git a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java index d69c22609f590..8dd958493a0dd 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/main/java/org/openhab/binding/nibeheatpump/internal/protocol/NibeHeatPumpProtocolStates.java @@ -175,7 +175,6 @@ private static msgStatus checkNibeMessage(ByteBuffer byteBuffer) throws NibeHeat byte msgChecksum = byteBuffer.get(datalen + 5); if (calcChecksum != msgChecksum) { - // if checksum is 0x5C (start character), heat pump seems to // send 0xC5 checksum if (calcChecksum != 0x5C && msgChecksum != 0xC5) { diff --git a/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessageTest.java b/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessageTest.java index 25ae41d82732a..21019fae4d03b 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessageTest.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/ModbusDataReadOutMessageTest.java @@ -64,7 +64,6 @@ public void createMessageTest() throws NibeHeatPumpException { @Test public void parseModbusDataReadOutMessageTest() throws NibeHeatPumpException { - final String message = "5C0020685001A81F0100A86400FDA7D003449C1E004F9CA000509C7800519C0301529C1B01879C14014E9CC601479C010115B9B0FF3AB94B00C9AF0000489C0D014C9CE7004B9C0000FFFF0000FFFF0000FFFF000045"; @SuppressWarnings("serial") @@ -201,7 +200,6 @@ public void notModbusDataReadOutMessageTest() throws NibeHeatPumpException { private void checkRegisters(final String message, final ArrayList expectedRegs) throws NibeHeatPumpException { - final byte[] msg = HexUtils.hexToBytes(message); final ModbusDataReadOutMessage m = (ModbusDataReadOutMessage) MessageFactory.getMessage(msg); assertNotNull(m); diff --git a/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpProtocolTest.java b/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpProtocolTest.java index 7e1e79cfc8269..27c054534a6a3 100644 --- a/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpProtocolTest.java +++ b/bundles/org.openhab.binding.nibeheatpump/src/test/java/org/openhab/binding/nibeheatpump/internal/message/NibeHeatPumpProtocolTest.java @@ -76,7 +76,6 @@ public void Before() { @Test(timeout = 1000) public void test() { - //@formatter:off final String strTestData = // RMU40 message, acknowledge should be send @@ -120,7 +119,6 @@ public void test() { // run protocol state machine to process test data while (mockupContext.state().process(mockupContext)) { - } // test results diff --git a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/GenericStatusUpdate.java b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/GenericStatusUpdate.java index 36350d364e035..eea29f0032e7c 100644 --- a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/GenericStatusUpdate.java +++ b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/GenericStatusUpdate.java @@ -53,7 +53,6 @@ public GenericStatusUpdate(NibeUplinkHandler handler) { @Override protected Request prepareRequest(Request requestToPrepare) { - Fields fields = new Fields(); fields.add(DATA_API_FIELD_LAST_DATE, DATA_API_FIELD_LAST_DATE_DEFAULT_VALUE); fields.add(DATA_API_FIELD_ID, config.getNibeId()); @@ -93,9 +92,7 @@ public void onComplete(@Nullable Result result) { listener.update(getCommunicationStatus()); } handler.getWebInterface().enqueueCommand(this); - } else { - String json = getContentAsString(StandardCharsets.UTF_8); if (json != null) { logger.debug("JSON String: {}", json); diff --git a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/Login.java b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/Login.java index ba3b3ca6572db..88b0c4d593ab8 100644 --- a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/Login.java +++ b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/command/Login.java @@ -36,7 +36,6 @@ public Login(NibeUplinkHandler handler, StatusUpdateListener listener) { @Override protected Request prepareRequest(Request requestToPrepare) { - Fields fields = new Fields(); fields.add(LOGIN_FIELD_EMAIL, config.getUser()); fields.add(LOGIN_FIELD_PASSWORD, config.getPassword()); diff --git a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/connector/UplinkWebInterface.java b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/connector/UplinkWebInterface.java index 08e63aa3b9581..470a37b997dad 100644 --- a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/connector/UplinkWebInterface.java +++ b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/connector/UplinkWebInterface.java @@ -152,7 +152,6 @@ public void update(CommunicationStatus status) { uplinkHandler.setStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, status.getMessage()); setAuthenticated(false); - } } }; @@ -206,7 +205,6 @@ private synchronized void authenticate() { setAuthenticated(false); if (preCheck()) { - StatusUpdateListener statusUpdater = new StatusUpdateListener() { @Override diff --git a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/model/DataResponseTransformer.java b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/model/DataResponseTransformer.java index 19c99154a684a..2afdc6562f9e6 100644 --- a/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/model/DataResponseTransformer.java +++ b/bundles/org.openhab.binding.nibeuplink/src/main/java/org/openhab/binding/nibeuplink/internal/model/DataResponseTransformer.java @@ -71,7 +71,6 @@ public Map transform(DataResponse response) { } else { logger.debug("Channel {} transformed to NumberType ({})", channel.getFQName(), value); result.put(channel, new DecimalType(value)); - } } } diff --git a/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler.java b/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler.java index 30255e993357a..055ea0fd3c212 100644 --- a/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler.java +++ b/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler.java @@ -155,7 +155,6 @@ public void bridgeOnline() { @Override public void controllerOffline() { bridgeOffline(); - } @Override diff --git a/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler2.java b/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler2.java index 7dccb405b7f47..b6cdcfadba7cd 100644 --- a/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler2.java +++ b/bundles/org.openhab.binding.nikohomecontrol/src/main/java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlBridgeHandler2.java @@ -228,7 +228,6 @@ public String getToken() { } } return expiryDate; - } return null; diff --git a/bundles/org.openhab.binding.omnikinverter/src/main/java/org/openhab/binding/omnikinverter/internal/handler/OmnikInverterHandler.java b/bundles/org.openhab.binding.omnikinverter/src/main/java/org/openhab/binding/omnikinverter/internal/handler/OmnikInverterHandler.java index 9e7441fb45a20..26d26e3f206a1 100644 --- a/bundles/org.openhab.binding.omnikinverter/src/main/java/org/openhab/binding/omnikinverter/internal/handler/OmnikInverterHandler.java +++ b/bundles/org.openhab.binding.omnikinverter/src/main/java/org/openhab/binding/omnikinverter/internal/handler/OmnikInverterHandler.java @@ -75,7 +75,6 @@ public void initialize() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_INITIALIZING_ERROR, "Failed to initialize: " + e.getMessage()); } - } private void updateData() { diff --git a/bundles/org.openhab.binding.onewire/src/main/java/org/openhab/binding/onewire/internal/handler/OwBaseThingHandler.java b/bundles/org.openhab.binding.onewire/src/main/java/org/openhab/binding/onewire/internal/handler/OwBaseThingHandler.java index b22468a65a182..6cdb42224332d 100644 --- a/bundles/org.openhab.binding.onewire/src/main/java/org/openhab/binding/onewire/internal/handler/OwBaseThingHandler.java +++ b/bundles/org.openhab.binding.onewire/src/main/java/org/openhab/binding/onewire/internal/handler/OwBaseThingHandler.java @@ -234,7 +234,6 @@ public void refresh(OwserverBridgeHandler bridgeHandler, long now) { logger.debug("{}: refresh exception {}", this.thing.getUID(), e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "refresh exception"); } - } /** @@ -318,7 +317,6 @@ protected void updateSensorProperties() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "required properties missing"); bridgeHandler.scheduleForPropertiesUpdate(thing); - } /** diff --git a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java index 406b4c2800ea9..9de9b616cd88f 100644 --- a/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java +++ b/bundles/org.openhab.binding.paradoxalarm/src/main/java/org/openhab/binding/paradoxalarm/internal/parsers/EvoParser.java @@ -64,7 +64,6 @@ public PartitionState calculatePartitionState(byte[] partitionFlags) { @Override public ZoneState calculateZoneState(int id, ZoneStateFlags zoneStateFlags) { - int index = (id - 1) / 8; int bitNumber = id % 8 - 1; diff --git a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/PHCHandlerFactory.java b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/PHCHandlerFactory.java index 12425406fe233..86a81dac9d86f 100644 --- a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/PHCHandlerFactory.java +++ b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/PHCHandlerFactory.java @@ -51,19 +51,15 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, ThingUID thingUID, ThingUID bridgeUID) { - Thing thing; if (SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID)) { - if (thingTypeUID.equals(THING_TYPE_BRIDGE)) { thing = super.createThing(thingTypeUID, configuration, thingUID, null); - } else { ThingUID phcThingUID = new ThingUID(thingTypeUID, configuration.get(ADDRESS).toString().toUpperCase()); thing = super.createThing(thingTypeUID, configuration, phcThingUID, bridgeUID); } - } else { throw new IllegalArgumentException( "The thing type " + thingTypeUID + " is not supported by the phc binding."); @@ -74,7 +70,6 @@ public Thing createThing(ThingTypeUID thingTypeUID, Configuration configuration, @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); ThingHandler handler = null; diff --git a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCBridgeHandler.java b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCBridgeHandler.java index 638f9a9e78880..35068c1be073f 100644 --- a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCBridgeHandler.java +++ b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCBridgeHandler.java @@ -126,11 +126,9 @@ public void run() { } }.start(); - } catch (PortInUseException | TooManyListenersException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Could not open serial port " + serialPort + ": " + e.getMessage()); - } catch (UnsupportedCommOperationException e) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Could not configure serial port " + serialPort + ": " + e.getMessage()); @@ -175,7 +173,6 @@ public void serialEvent(SerialPortEvent event) { } else { processInputStream(buffer); } - } catch (IOException e) { // ignore } catch (InterruptedException e) { @@ -269,14 +266,12 @@ private void processQueueLoop() { } queue.put(System.currentTimeMillis() + SEND_RETRY_TIME_MILLIS, qo); - } else if (qo.getCounter() >= SEND_RETRY_COUNT && !qo.getModuleType().equals(PHCBindingConstants.CHANNELS_JRM)) { // Can´t process the acknowledgement of JRM yet. logger.info("No acknowlgdge from the module {} received.", qo.getModuleAddress()); } } - } } diff --git a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCHandler.java b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCHandler.java index 2f68704926691..9f80f00d6a7e0 100644 --- a/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCHandler.java +++ b/bundles/org.openhab.binding.phc/src/main/java/org/openhab/binding/phc/internal/handler/PHCHandler.java @@ -53,7 +53,6 @@ public class PHCHandler extends BaseThingHandler { public PHCHandler(Thing thing) { super(thing); - } @Override @@ -87,7 +86,6 @@ public void initialize() { } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE); } - } public void handleIncoming(String channelId, OnOffType state) { @@ -103,7 +101,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { if ((PHCBindingConstants.CHANNELS_AM.equals(channelUID.getGroupId())) || PHCBindingConstants.CHANNELS_JRM .equals(channelUID.getGroupId()) && (command instanceof OnOffType || command instanceof UpDownType || command instanceof StopMoveType)) { - if (getThing().getStatus().equals(ThingStatus.ONLINE)) { getPHCBridgeHandler().send(channelUID.getGroupId(), new StringBuilder(moduleAddress).reverse().toString(), channelUID.getIdWithoutGroup(), command, @@ -111,7 +108,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { ? upDownTimes[Integer.parseInt(channelUID.getIdWithoutGroup())] : 0); logger.debug("send command: {}, {}", channelUID, command); - } else { logger.info("The Thing {} is offline it requires to select a Bridge", getThing().getUID()); } @@ -129,7 +125,6 @@ public void handleUpdate(ChannelUID channelUID, State newState) { @Override public void handleConfigurationUpdate(Map configurationParameters) { if (isInitialized()) { // prevents change of address - validateConfigurationParameters(configurationParameters); Configuration configuration = editConfiguration(); @@ -145,7 +140,6 @@ public void handleConfigurationUpdate(Map configurationParameter dispose(); updateConfiguration(configuration); initialize(); - } else { super.handleConfigurationUpdate(configurationParameters); } diff --git a/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/handler/PLCCommonHandler.java b/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/handler/PLCCommonHandler.java index c6c13c81ec3f8..532f7ffeca82d 100644 --- a/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/handler/PLCCommonHandler.java +++ b/bundles/org.openhab.binding.plclogo/src/main/java/org/openhab/binding/plclogo/internal/handler/PLCCommonHandler.java @@ -246,7 +246,6 @@ protected void setOldValue(final String name, final @Nullable State value) { if ((handler != null) && (handler instanceof PLCBridgeHandler)) { return (PLCBridgeHandler) handler; } - } return null; } diff --git a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java index 8ee0422ecd570..fab9cbb8c684e 100644 --- a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java +++ b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java @@ -14,22 +14,33 @@ import static org.openhab.binding.pushbullet.internal.PushbulletBindingConstants.*; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Collection; +import java.util.Collections; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; + import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.http.MimeTypes; -import org.eclipse.smarthome.core.thing.binding.ThingHandlerService; -import org.eclipse.smarthome.io.net.http.HttpUtil; -import org.openhab.binding.pushbullet.internal.action.PushbulletActions; import org.eclipse.smarthome.core.thing.ChannelUID; import org.eclipse.smarthome.core.thing.Thing; import org.eclipse.smarthome.core.thing.ThingStatus; import org.eclipse.smarthome.core.thing.binding.BaseThingHandler; +import org.eclipse.smarthome.core.thing.binding.ThingHandlerService; import org.eclipse.smarthome.core.types.Command; +import org.eclipse.smarthome.io.net.http.HttpUtil; import org.openhab.binding.pushbullet.internal.PushbulletConfiguration; +import org.openhab.binding.pushbullet.internal.action.PushbulletActions; import org.openhab.binding.pushbullet.internal.model.Push; import org.openhab.binding.pushbullet.internal.model.PushResponse; import org.osgi.framework.FrameworkUtil; @@ -37,17 +48,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Collection; -import java.util.Collections; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; /** * The {@link PushbulletHandler} is responsible for handling commands, which are @@ -117,7 +119,6 @@ public boolean sendPush(@Nullable String recipient, @Nullable String title, @Nul String request = prepareMessageBody(recipient, title, message, type); try (InputStream stream = new ByteArrayInputStream(request.getBytes(StandardCharsets.UTF_8))) { - String pushAPI = configuration.getApiUrlBase() + "/" + API_METHOD_PUSHES; String responseString = HttpUtil.executeUrl(HttpMethod.POST.asString(), pushAPI, headers, stream, @@ -133,8 +134,7 @@ public boolean sendPush(@Nullable String recipient, @Nullable String title, @Nul if ((null != response) && (null == response.getPushError())) { result = true; } - } - catch (IOException e) { + } catch (IOException e) { logger.warn("IO problems pushing note: {}", e.getMessage()); } diff --git a/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/RotelRa1xHandlerFactory.java b/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/RotelRa1xHandlerFactory.java index 24c72744fb163..13954d2d97896 100644 --- a/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/RotelRa1xHandlerFactory.java +++ b/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/RotelRa1xHandlerFactory.java @@ -44,7 +44,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_AMP)) { diff --git a/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/handler/RotelRa1xHandler.java b/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/handler/RotelRa1xHandler.java index 12882298baaec..98ee982937b28 100644 --- a/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/handler/RotelRa1xHandler.java +++ b/bundles/org.openhab.binding.rotelra1x/src/main/java/org/openhab/binding/rotelra1x/internal/handler/RotelRa1xHandler.java @@ -296,7 +296,6 @@ private void inputLoop() { return; } } - } private void sendIfPowerOn(String text) throws IOException { diff --git a/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/WebSocketV2.java b/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/WebSocketV2.java index 354716c3982fd..2bea304f412fd 100644 --- a/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/WebSocketV2.java +++ b/bundles/org.openhab.binding.samsungtv/src/main/java/org/openhab/binding/samsungtv/internal/protocol/WebSocketV2.java @@ -102,7 +102,6 @@ public void onWebSocketText(@Nullable String msgarg) { break; default: logger.debug("V2 Unknown event: {}", msg); - } } catch (JsonSyntaxException e) { logger.warn("{}: Error ({}) in message: {}", this.getClass().getSimpleName(), e.getMessage(), msg, e); diff --git a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/handler/SatelEventLogHandler.java b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/handler/SatelEventLogHandler.java index d5db7469e36e9..c80221858a353 100644 --- a/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/handler/SatelEventLogHandler.java +++ b/bundles/org.openhab.binding.satel/src/main/java/org/openhab/binding/satel/internal/handler/SatelEventLogHandler.java @@ -81,7 +81,6 @@ public void initialize() { this.cacheExpirationJob = scheduler.scheduleWithFixedDelay(deviceNameCache::clear, CACHE_CLEAR_INTERVAL, CACHE_CLEAR_INTERVAL, TimeUnit.MILLISECONDS); } - } @Override diff --git a/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeHandlerFactory.java b/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeHandlerFactory.java index 11aa885574813..57e60f5b598a4 100644 --- a/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeHandlerFactory.java +++ b/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeHandlerFactory.java @@ -43,7 +43,6 @@ public boolean supportsThingType(ThingTypeUID thingTypeUID) { @Override protected ThingHandler createHandler(Thing thing) { - ThingTypeUID thingTypeUID = thing.getThingTypeUID(); if (thingTypeUID.equals(THING_TYPE_SENEYE)) { diff --git a/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeService.java b/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeService.java index 7fea63e04be48..077888674028a 100644 --- a/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeService.java +++ b/bundles/org.openhab.binding.seneye/src/main/java/org/openhab/binding/seneye/internal/SeneyeService.java @@ -62,7 +62,6 @@ public SeneyeService(SeneyeConfigurationParameters config) throws CommunicationE throw new CommunicationException("Cannot start HttpClient!", e); } } - } @Override @@ -101,7 +100,6 @@ public SeneyeDeviceReading getDeviceReadings() { logger.debug("seneye '{}' read", this.seneyeId); return readings; - } catch (Exception se) { // ok, this readout failed, swallow this error, this is a scheduled task and this is in a retry loop, // so it will be retried. @@ -110,7 +108,6 @@ public SeneyeDeviceReading getDeviceReadings() { } while (currentTry++ < this.retry); return null; - } public void initialize() throws CommunicationException, InvalidConfigurationException { diff --git a/bundles/org.openhab.binding.sensibo/src/main/java/org/openhab/binding/sensibo/internal/handler/SensiboSkyHandler.java b/bundles/org.openhab.binding.sensibo/src/main/java/org/openhab/binding/sensibo/internal/handler/SensiboSkyHandler.java index af6799d591e07..7950136d7e133 100644 --- a/bundles/org.openhab.binding.sensibo/src/main/java/org/openhab/binding/sensibo/internal/handler/SensiboSkyHandler.java +++ b/bundles/org.openhab.binding.sensibo/src/main/java/org/openhab/binding/sensibo/internal/handler/SensiboSkyHandler.java @@ -12,14 +12,7 @@ */ package org.openhab.binding.sensibo.internal.handler; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_CURRENT_HUMIDITY; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_CURRENT_TEMPERATURE; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_FAN_LEVEL; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_MASTER_SWITCH; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_MODE; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_SWING_MODE; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_TARGET_TEMPERATURE; -import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.CHANNEL_TIMER; +import static org.openhab.binding.sensibo.internal.SensiboBindingConstants.*; import java.util.ArrayList; import java.util.Collection; @@ -182,7 +175,6 @@ protected void handleCommand(final ChannelUID channelUID, final Command command, break; default: logger.debug("Received command on unknown channel {}, ignoring", channelUID.getId()); - } } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, @@ -420,7 +412,6 @@ public Collection getChannelTypes(@Nullable final Locale locale) { * Package private in order to be reachable from unit test */ StateChange checkStateChangeValid(SensiboSky sensiboSky, String property, Object newPropertyValue) { - StateChange stateChange = new StateChange(newPropertyValue); sensiboSky.getCurrentModeCapabilities().ifPresent(currentModeCapabilities -> { diff --git a/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/GetPodsResponseTest.java b/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/GetPodsResponseTest.java index daccf2c936dbb..b37cf8a6b7de0 100644 --- a/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/GetPodsResponseTest.java +++ b/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/GetPodsResponseTest.java @@ -31,7 +31,6 @@ public class GetPodsResponseTest extends AbstractSerializationDeserializationTes @Test public void testDeserialize() throws IOException { - final Type type = new TypeToken>() { }.getType(); diff --git a/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/SetAcStatePropertyResponseTest.java b/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/SetAcStatePropertyResponseTest.java index 8c4d82efb44a4..64e1907d11bb5 100644 --- a/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/SetAcStatePropertyResponseTest.java +++ b/bundles/org.openhab.binding.sensibo/src/test/java/org/openhab/binding/sensibo/internal/dto/SetAcStatePropertyResponseTest.java @@ -12,8 +12,7 @@ */ package org.openhab.binding.sensibo.internal.dto; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; import java.io.IOException; @@ -27,7 +26,6 @@ public class SetAcStatePropertyResponseTest extends AbstractSerializationDeseria @Test public void testDeserialize() throws IOException { - final SetAcStatePropertyReponse rsp = wireHelper.deSerializeResponse("/set_acstate_response.json", SetAcStatePropertyReponse.class); diff --git a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java index d44c68be9fcdd..1f2335d497290 100755 --- a/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java +++ b/bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyBaseHandler.java @@ -392,8 +392,6 @@ protected void updateStatus() { if (scheduledUpdates > 0) { --scheduledUpdates; logger.debug("{}: {} more updates requested", thingName, scheduledUpdates); - } else { - } if ((skipUpdate >= cacheCount) && !channelCache) { logger.debug("{}: Enabling channel cache ({} updates / {}s)", thingName, skipUpdate, diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeGatewayHandler.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeGatewayHandler.java index e618935e41690..c4f90cbf528da 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeGatewayHandler.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeGatewayHandler.java @@ -97,7 +97,6 @@ public void initialize() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE, "Can't connect to gateway. Please make sure that another instance is not connected."); } - } @Override @@ -177,7 +176,6 @@ synchronized SinopeAnswer execute(SinopeRequest command) throws UnknownHostExcep SinopeAnswer answ = command.getReplyAnswer(inputStream); return answ; - } synchronized SinopeAnswer execute(SinopeDataRequest command) throws UnknownHostException, IOException { @@ -211,7 +209,6 @@ public boolean unregisterThermostatHandler(SinopeThermostatHandler thermostatHan @Override public void handleCommand(ChannelUID channelUID, Command command) { - } @Override @@ -252,7 +249,6 @@ public void startSearch(final SinopeThingsDiscoveryService sinopeThingsDiscovery this.searching = true; pollSearch = scheduler.schedule(() -> search(sinopeThingsDiscoveryService), FIRST_POLL_INTERVAL, TimeUnit.SECONDS); - } private void search(final SinopeThingsDiscoveryService sinopeThingsDiscoveryService) { @@ -277,7 +273,6 @@ private void search(final SinopeThingsDiscoveryService sinopeThingsDiscoveryServ } catch (UnknownHostException e) { logger.warn("Unexpected error when searching for new devices", e); } catch (IOException e) { - logger.debug("Network connection error, expected when ending search", e); } finally { schedulePoll(); @@ -313,6 +308,5 @@ public void setCommunicationError(boolean hasError) { updateStatus(ThingStatus.ONLINE); schedulePoll(); } - } } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeThermostatHandler.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeThermostatHandler.java index 628f5443f05b9..712aaf2a38d27 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeThermostatHandler.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/handler/SinopeThermostatHandler.java @@ -108,11 +108,9 @@ private void setSetpointTemp(float temp) throws UnknownHostException, IOExceptio } finally { getSinopeGatewayHandler().schedulePoll(); } - } private void setSetpointMode(int mode) throws UnknownHostException, IOException { - getSinopeGatewayHandler().stopPoll(); try { if (getSinopeGatewayHandler().connectToBridge()) { diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeApiLoginRequest.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeApiLoginRequest.java index 03a27a6c3ddd5..ad6d2f0f82bb6 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeApiLoginRequest.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeApiLoginRequest.java @@ -21,7 +21,7 @@ /** * The Class SinopeApiLoginRequest. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeApiLoginRequest extends SinopeRequest { @@ -65,7 +65,6 @@ protected byte[] getFrameData() { // System.out.println(toString(bb.array())); return bb.array(); - } /** diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeAuthenticationKeyRequest.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeAuthenticationKeyRequest.java index 8c5259e024d49..b335bd7e6ff0d 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeAuthenticationKeyRequest.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/SinopeAuthenticationKeyRequest.java @@ -20,7 +20,7 @@ /** * The Class SinopeAuthenticationKeyRequest. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeAuthenticationKeyRequest extends SinopeRequest { @@ -58,9 +58,7 @@ protected byte[] getFrameData() { */ @Override public SinopeAuthenticationKeyAnswer getReplyAnswer(InputStream r) throws IOException { - return new SinopeAuthenticationKeyAnswer(r); - } /** diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeAppData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeAppData.java index 76a32d2830aee..58c4fc0f0c7ce 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeAppData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeAppData.java @@ -18,7 +18,7 @@ /** * The Class SinopeAppData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeAppData { @@ -48,10 +48,8 @@ public class SinopeAppData { * @param data the data */ public SinopeAppData(byte[] dataId, byte[] data) { - this.dataId = dataId; this.data = data; - } /** @@ -72,7 +70,6 @@ public void read(byte[] d) { this.data = new byte[len]; bb.get(this.data); - } } } @@ -134,7 +131,6 @@ public String toString() { */ public void cleanData() { this.data = null; - } } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeHeatLevelData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeHeatLevelData.java index 244e1f1cf53c4..fd341343c5f2c 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeHeatLevelData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeHeatLevelData.java @@ -14,7 +14,7 @@ /** * The Class SinopeRoomTempData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeHeatLevelData extends SinopeAppData { @@ -23,7 +23,6 @@ public class SinopeHeatLevelData extends SinopeAppData { * Instantiates a new sinope set point temp data. */ public SinopeHeatLevelData() { - super(new byte[] { 0x00, 0x00, 0x02, 0x20 }, new byte[] { 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeLocalTimeData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeLocalTimeData.java index 4645a544e1099..bd0079fb96a2c 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeLocalTimeData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeLocalTimeData.java @@ -14,7 +14,7 @@ /** * The Class SinopeLocalTimeData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeLocalTimeData extends SinopeAppData { @@ -23,7 +23,6 @@ public class SinopeLocalTimeData extends SinopeAppData { * Instantiates a new sinope local time data. */ public SinopeLocalTimeData() { - super(new byte[] { 0x00, 0x00, 0x06, 0x00 }, new byte[] { 0, 0, 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeOutTempData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeOutTempData.java index b8f6d94763ab0..e8af95fc37cd8 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeOutTempData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeOutTempData.java @@ -17,7 +17,7 @@ /** * The Class SinopeOutTempData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeOutTempData extends SinopeAppData { @@ -26,7 +26,6 @@ public class SinopeOutTempData extends SinopeAppData { * Instantiates a new sinope out temp data. */ public SinopeOutTempData() { - super(new byte[] { 0x00, 0x00, 0x02, 0x04 }, new byte[] { 0, 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeRoomTempData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeRoomTempData.java index 4b3fcb75e1bcf..0e6c4a20d1ecd 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeRoomTempData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeRoomTempData.java @@ -17,7 +17,7 @@ /** * The Class SinopeRoomTempData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeRoomTempData extends SinopeAppData { @@ -26,7 +26,6 @@ public class SinopeRoomTempData extends SinopeAppData { * Instantiates a new sinope room temp data. */ public SinopeRoomTempData() { - super(new byte[] { 0x00, 0x00, 0x02, 0x03 }, new byte[] { 0, 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointModeData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointModeData.java index 80a9eae8f216c..2e3443b92eebd 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointModeData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointModeData.java @@ -14,7 +14,7 @@ /** * The Class SinopeRoomTempData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeSetPointModeData extends SinopeAppData { @@ -23,7 +23,6 @@ public class SinopeSetPointModeData extends SinopeAppData { * Instantiates a new sinope set point temp data. */ public SinopeSetPointModeData() { - super(new byte[] { 0x00, 0x00, 0x02, 0x11 }, new byte[] { 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointTempData.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointTempData.java index d8d0098b82266..90a6994dfaa17 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointTempData.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/appdata/SinopeSetPointTempData.java @@ -17,7 +17,7 @@ /** * The Class SinopeRoomTempData. - * + * * @author Pascal Larin - Initial contribution */ public class SinopeSetPointTempData extends SinopeAppData { @@ -26,7 +26,6 @@ public class SinopeSetPointTempData extends SinopeAppData { * Instantiates a new sinope set point temp data. */ public SinopeSetPointTempData() { - super(new byte[] { 0x00, 0x00, 0x02, 0x08 }, new byte[] { 0, 0 }); } diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java index e44b5e9827bd5..0e41290bb8995 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeAnswer.java @@ -39,7 +39,6 @@ public abstract class SinopeAnswer extends SinopeRequest { * @throws IOException Signals that an I/O exception has occurred. */ public SinopeAnswer(InputStream r) throws IOException { - ; byte[] header = new byte[SinopeFrame.PREAMBLE_SIZE + SinopeFrame.FRAME_CTL_SIZE + SinopeFrame.SIZE_SIZE]; r.read(header, 0, header.length); @@ -105,7 +104,6 @@ protected final byte[] getFrameData() { int headerSize = SinopeFrame.PREAMBLE_SIZE + SinopeFrame.FRAME_CTL_SIZE + SinopeFrame.COMMAND_SIZE + SinopeFrame.SIZE_SIZE; return Arrays.copyOfRange(b, headerSize, b.length - SinopeFrame.CRC_SIZE); - } /** diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataAnswer.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataAnswer.java index 1ea1fbb501385..5bed6404e37ba 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataAnswer.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataAnswer.java @@ -21,7 +21,7 @@ /** * The Class SinopeDataAnswer. - * + * * @author Pascal Larin - Initial contribution */ public abstract class SinopeDataAnswer extends SinopeAnswer { @@ -59,7 +59,6 @@ public SinopeDataAnswer(InputStream r, SinopeAppData appData) throws IOException byte[] data = getData(); this.appData = appData; this.appData.read(data); - } /** diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataRequest.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataRequest.java index 3a75f1da174e0..384325ae60c34 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataRequest.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeDataRequest.java @@ -178,7 +178,6 @@ protected byte[] getFrameData() { // // System.out.println(toString(bb.array())); return bb.array(); - } /** diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeFrame.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeFrame.java index 091639463beba..33dc5289905d6 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeFrame.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/core/base/SinopeFrame.java @@ -49,13 +49,6 @@ abstract class SinopeFrame { /** The internal payload. */ protected byte[] internal_payload; - /** - * Instantiates a new sinope frame. - */ - public SinopeFrame() { - - } - /** * Gets the command. * diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/discovery/SinopeThingsDiscoveryService.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/discovery/SinopeThingsDiscoveryService.java index 10fa9f21b9e95..2fd0f0037d072 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/discovery/SinopeThingsDiscoveryService.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/discovery/SinopeThingsDiscoveryService.java @@ -57,7 +57,6 @@ public Set getSupportedThingTypes() { @Override public void startScan() { - logger.debug("Sinope Things starting scan"); try { sinopeGatewayHandler.startSearch(this); diff --git a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/util/ByteUtil.java b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/util/ByteUtil.java index 2ebc16bc914d5..8b6f58521d49d 100644 --- a/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/util/ByteUtil.java +++ b/bundles/org.openhab.binding.sinope/src/main/java/org/openhab/binding/sinope/internal/util/ByteUtil.java @@ -28,7 +28,6 @@ public class ByteUtil { * @return the reserved in byte[] */ public static byte[] reverse(byte[] array) { - if (array == null) { return null; } diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/connectors/ConnectorBase.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/connectors/ConnectorBase.java index 2f28b49f2d680..6c98a1f9427fe 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/connectors/ConnectorBase.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/connectors/ConnectorBase.java @@ -115,7 +115,6 @@ protected Publisher getRetryPublisher(Duration period, Publisher a * @param retryCount The current number of retries */ protected void retryHook(int retryCount) { - } @Override @@ -138,7 +137,6 @@ public Publisher getMeterValues(byte @Nullable [] initMessage, Duration perio } else { return result; } - } /** diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterConfigProvider.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterConfigProvider.java index 9c89efa51fe36..5b2560713aa05 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterConfigProvider.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterConfigProvider.java @@ -51,7 +51,6 @@ public class SmartMeterConfigProvider implements ConfigOptionProvider { } switch (param) { - case SmartMeterBindingConstants.CONFIGURATION_SERIAL_MODE: List options = new ArrayList<>(); diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterHandler.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterHandler.java index 6e2efcf986be3..055e78b51f845 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterHandler.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/SmartMeterHandler.java @@ -251,11 +251,9 @@ private void updateOBISChannel(ChannelUID channelId) { if (isLinked(channelId.getId())) { Channel channel = this.thing.getChannel(channelId.getId()); if (channel != null) { - String obis = channel.getProperties().get(SmartMeterBindingConstants.CHANNEL_PROPERTY_OBIS); MeterValue value = this.smlDevice.getMeterValue(obis); if (value != null) { - State state = getStateForObisValue(value, channel); updateState(channel.getUID(), state); } diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/Conformity.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/Conformity.java index 8ebaf1909d645..cf5f8ec7ea0b5 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/Conformity.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/conformity/Conformity.java @@ -45,7 +45,6 @@ public enum Conformity { @Override public > State apply(Channel channel, QuantityType currentState, Thing thing, MeterDevice device) { - return retrieveOverwrittenNegate(channel, currentState, thing, device, null); } }, @@ -70,21 +69,17 @@ public > QuantityType apply(Channel channel, QuantityTy String channelObis = channel.getProperties().get(SmartMeterBindingConstants.CHANNEL_PROPERTY_OBIS); MeterValue value = device.getMeterValue(channelObis); if (value != null && SmartHomeUnits.WATT.isCompatible(value.getUnit())) { - for (String obis : device.getObisCodes()) { try { MeterValue otherValue = device.getMeterValue(obis); ObisCode obisCode = ObisCode.from(obis); if (otherValue != null) { - if (obisCode.matches((byte) 0x60, (byte) 0x05, (byte) 0x05)) { - // we found status status obis 96.5.5 if (NegateHandler.isNegateSet(otherValue.getValue(), 5)) { return currentState.negate(); } } else if (obisCode.matches((byte) 0x01, (byte) 0x08, (byte) 0x00)) { - // check obis 1.8.0 for status if status has negate bit set. String status = otherValue.getStatus(); if (status != null && NegateHandler.isNegateSet(status, 5)) { @@ -95,7 +90,6 @@ public > QuantityType apply(Channel channel, QuantityTy } catch (Exception e) { logger.warn("Failed to check negate status for obis {}", obis, e); } - } } return currentState; @@ -119,7 +113,6 @@ private static > QuantityType applyNegation(QuantityTyp boolean shouldNegateState = NegateHandler.shouldNegateState(negateProperty, channelId -> { Channel negateChannel = thing.getChannel(channelId); if (negateChannel != null) { - return device.getMeterValue( negateChannel.getProperties().get(SmartMeterBindingConstants.CHANNEL_PROPERTY_OBIS)); } diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlFileDebugOutput.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlFileDebugOutput.java index 4fb8b4ee8135b..b761c293c7ca1 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlFileDebugOutput.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlFileDebugOutput.java @@ -47,15 +47,12 @@ private SmlFileDebugOutput() { * the SML file */ public static void printFile(SmlFile smlFile, Consumer consumer) { - List smlMessages = smlFile.getMessages(); for (SmlMessage smlMessage : smlMessages) { - EMessageBody messageBody = smlMessage.getMessageBody().getTag(); switch (messageBody) { - case OPEN_REQUEST: parseOpenRequest(smlMessage, consumer); break; diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlMeterReader.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlMeterReader.java index 5b5b88c8126f4..1f02d9365af26 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlMeterReader.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlMeterReader.java @@ -134,7 +134,6 @@ protected void populateValueCache(SmlFile smlFile) { addObisCache(smlValue); } } - } else { logger.warn("{}: no valid SML messages list retrieved.", this.toString()); } diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlUnitConversion.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlUnitConversion.java index 7901f1c4a4c6b..e55a8c0b88e5b 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlUnitConversion.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlUnitConversion.java @@ -23,7 +23,7 @@ /** * Converts a {@link EUnit} to an {@link Unit}. - * + * * @author Matthias Steigenberger - Initial contribution * */ @@ -34,7 +34,6 @@ public class SmlUnitConversion { public static @Nullable > Unit getUnit(EUnit unit) { Unit javaUnit = null; switch (unit) { - case AMPERE: javaUnit = SmartHomeUnits.AMPERE; break; @@ -211,7 +210,6 @@ public class SmlUnitConversion { break; default: break; - } return (Unit) javaUnit; } diff --git a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlValueExtractor.java b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlValueExtractor.java index 724ecaeed1764..b6a4b4da614c4 100644 --- a/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlValueExtractor.java +++ b/bundles/org.openhab.binding.smartmeter/src/main/java/org/openhab/binding/smartmeter/internal/sml/SmlValueExtractor.java @@ -95,7 +95,6 @@ public String toString() { * @return the value as String if available - otherwise null. */ public String getValue() { - org.openmuc.jsml.structures.SmlValue smlValue = smlListEntry.getValue(); ASNObject choice = smlValue.getChoice(); String value = choice.toString(); @@ -152,7 +151,6 @@ private static int byteToInt(byte b) { * @return the hex encoded OBIS code as readable string. */ protected static String getObisAsString(byte[] octetBytes) { - String formattedObis = String.format(SmartMeterBindingConstants.OBIS_FORMAT_MINIMAL, byteToInt(octetBytes[0]), byteToInt(octetBytes[1]), byteToInt(octetBytes[2]), byteToInt(octetBytes[3]), byteToInt(octetBytes[4])); diff --git a/bundles/org.openhab.binding.smartmeter/src/test/java/org/openhab/binding/smartmeter/MockMeterReaderConnector.java b/bundles/org.openhab.binding.smartmeter/src/test/java/org/openhab/binding/smartmeter/MockMeterReaderConnector.java index a44a0a6f423ad..6cabe35a11efe 100644 --- a/bundles/org.openhab.binding.smartmeter/src/test/java/org/openhab/binding/smartmeter/MockMeterReaderConnector.java +++ b/bundles/org.openhab.binding.smartmeter/src/test/java/org/openhab/binding/smartmeter/MockMeterReaderConnector.java @@ -39,7 +39,6 @@ public void openConnection() throws IOException { @Override public void closeConnection() { - } @Override diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePrivateApi.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePrivateApi.java index 17a9c6ea4b14d..51c005f8bd587 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePrivateApi.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePrivateApi.java @@ -116,9 +116,7 @@ public void onComplete(Result result) { if (retries++ < MAX_RETRIES) { handler.getWebInterface().enqueueCommand(this); } - } else { - String json = getContentAsString(StandardCharsets.UTF_8); if (json != null) { logger.debug("JSON String: {}", json); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePublicApi.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePublicApi.java index a363f9a99ec05..97c36846aa924 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePublicApi.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/AggregateDataUpdatePublicApi.java @@ -94,9 +94,7 @@ public void onComplete(Result result) { if (retries++ < MAX_RETRIES) { handler.getWebInterface().enqueueCommand(this); } - } else { - String json = getContentAsString(StandardCharsets.UTF_8); if (json != null) { logger.debug("JSON String: {}", json); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdateMeterless.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdateMeterless.java index b05e41fd19738..46eddbdda6d96 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdateMeterless.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdateMeterless.java @@ -64,9 +64,7 @@ public void onComplete(Result result) { if (retries++ < MAX_RETRIES) { handler.getWebInterface().enqueueCommand(this); } - } else { - String json = getContentAsString(StandardCharsets.UTF_8); if (json != null) { logger.debug("JSON String: {}", json); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdatePrivateApi.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdatePrivateApi.java index 243e79bd87335..91e520ed0d77d 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdatePrivateApi.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/LiveDataUpdatePrivateApi.java @@ -64,9 +64,7 @@ public void onComplete(Result result) { if (retries++ < MAX_RETRIES) { handler.getWebInterface().enqueueCommand(this); } - } else { - String json = getContentAsString(StandardCharsets.UTF_8); if (json != null) { logger.debug("JSON String: {}", json); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PrivateApiTokenCheck.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PrivateApiTokenCheck.java index 9ffac97af9a57..b3df8d99a3a56 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PrivateApiTokenCheck.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PrivateApiTokenCheck.java @@ -34,7 +34,6 @@ public PrivateApiTokenCheck(SolarEdgeHandler handler, StatusUpdateListener liste @Override protected Request prepareRequest(Request requestToPrepare) { - // as a token is used no real login is to be done here. It is just checked if a protected page can be retrieved // and therefore the token is valid. requestToPrepare.followRedirects(false); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PublicApiKeyCheck.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PublicApiKeyCheck.java index 6f6b3bdd2842f..c6dab3c25b328 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PublicApiKeyCheck.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/command/PublicApiKeyCheck.java @@ -34,7 +34,6 @@ public PublicApiKeyCheck(SolarEdgeHandler handler, StatusUpdateListener listener @Override protected Request prepareRequest(Request requestToPrepare) { - // as a key is used no real login is to be done here. It is just checked if a protected page can be retrieved // and therefore the key is valid. requestToPrepare.followRedirects(false); diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/connector/WebInterface.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/connector/WebInterface.java index 81bca37fe1f0c..fe8806798b158 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/connector/WebInterface.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/connector/WebInterface.java @@ -201,14 +201,12 @@ private synchronized void authenticate() { setAuthenticated(false); if (preCheck()) { - SolarEdgeCommand tokenCheckCommand; StatusUpdateListener tokenCheckListener = new StatusUpdateListener() { @Override public void update(CommunicationStatus status) { - String errorMessageCodeFound; String errorMessgaeCodeForbidden; if (config.isUsePrivateApi()) { diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponse.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponse.java index d766186772ac8..40ad20b07f5b8 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponse.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponse.java @@ -89,7 +89,6 @@ public Map getValues() { Map valueMap = new HashMap<>(); if (siteCurrentPowerFlow != null) { - if (siteCurrentPowerFlow.pv != null) { assignValue(valueMap, LiveDataChannels.PRODUCTION, siteCurrentPowerFlow.pv.currentPower, siteCurrentPowerFlow.unit); @@ -128,7 +127,6 @@ public Map getValues() { } else if (con.to.equalsIgnoreCase(GRID)) { assignValue(valueMap, LiveDataChannels.EXPORT, siteCurrentPowerFlow.grid.currentPower, siteCurrentPowerFlow.unit); - } if (con.from.equalsIgnoreCase(STORAGE)) { assignValue(valueMap, LiveDataChannels.BATTERY_DISCHARGE, diff --git a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponseMeterless.java b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponseMeterless.java index 38e63252f4179..a07945505153d 100644 --- a/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponseMeterless.java +++ b/bundles/org.openhab.binding.solaredge/src/main/java/org/openhab/binding/solaredge/internal/model/LiveDataResponseMeterless.java @@ -55,7 +55,6 @@ public Map getValues() { Map valueMap = new HashMap<>(); if (overview != null) { - if (overview.currentPower != null) { assignValue(valueMap, LiveDataChannels.PRODUCTION, overview.currentPower.power, SmartHomeUnits.WATT); } else { @@ -85,7 +84,6 @@ public Map getValues() { // week production is not available assignValue(valueMap, AggregateDataChannels.WEEK_PRODUCTION, null, null); - } return valueMap; } diff --git a/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java b/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java index 3a52488faddf4..9e850c9d37152 100644 --- a/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java +++ b/bundles/org.openhab.binding.squeezebox/src/main/java/org/openhab/binding/squeezebox/internal/handler/SqueezeBoxServerHandler.java @@ -380,7 +380,6 @@ private void connect() { // Mark the server ONLINE. bridgeStatusChanged will cause the players to come ONLINE updateStatus(ThingStatus.ONLINE); - } /** @@ -587,7 +586,6 @@ public void updateListener(SqueezeBoxPlayerEventListener listener) { break; default: logger.trace("Unhandled player update message type '{}'.", messageType); - } } diff --git a/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java b/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java index 30af4296f1679..73217314feee4 100644 --- a/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java +++ b/bundles/org.openhab.binding.systeminfo/src/main/java/org/openhab/binding/systeminfo/internal/handler/SysteminfoHandler.java @@ -117,7 +117,6 @@ public void initialize() { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.HANDLER_INITIALIZING_ERROR, "Thing cannot be initialized!"); } - } private boolean instantiateSysteminfoLibrary() { @@ -168,7 +167,6 @@ private boolean updateProperties() { logger.debug("Cannot get system properties! Please try to restart the binding.", e); return false; } - } private void groupChannelsByPriority() { diff --git a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/api/TadoApiTypeUtils.java b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/api/TadoApiTypeUtils.java index ab6bc16f24278..4e4ea0e9c9def 100644 --- a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/api/TadoApiTypeUtils.java +++ b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/api/TadoApiTypeUtils.java @@ -59,7 +59,6 @@ public static OverlayTerminationCondition cleanTerminationCondition( public static OverlayTerminationCondition terminationConditionTemplateToTerminationCondition( OverlayTerminationConditionTemplate template) { - Integer timerDuration = template.getType() == OverlayTerminationConditionType.TIMER ? ((TimerTerminationConditionTemplate) template).getDurationInSeconds() : null; diff --git a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/AirConditioningZoneSettingsBuilder.java b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/AirConditioningZoneSettingsBuilder.java index 3fd2379ebf0e0..0d1e7c8642589 100644 --- a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/AirConditioningZoneSettingsBuilder.java +++ b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/AirConditioningZoneSettingsBuilder.java @@ -70,9 +70,7 @@ public GenericZoneSetting build(ZoneStateProvider zoneStateProvider, GenericZone } private void addMissingSettingParts(ZoneStateProvider zoneStateProvider, - GenericZoneCapabilities genericCapabilities, CoolingZoneSetting setting) - throws IOException, ApiException { - + GenericZoneCapabilities genericCapabilities, CoolingZoneSetting setting) throws IOException, ApiException { if (setting.getMode() == null) { AcMode targetMode = getCurrentOrDefaultAcMode(zoneStateProvider); setting.setMode(targetMode); @@ -99,8 +97,7 @@ private void addMissingSettingParts(ZoneStateProvider zoneStateProvider, } } - private AcMode getCurrentOrDefaultAcMode(ZoneStateProvider zoneStateProvider) - throws IOException, ApiException { + private AcMode getCurrentOrDefaultAcMode(ZoneStateProvider zoneStateProvider) throws IOException, ApiException { CoolingZoneSetting zoneSetting = (CoolingZoneSetting) zoneStateProvider.getZoneState().getSetting(); return zoneSetting.getMode() != null ? zoneSetting.getMode() : DEFAULT_MODE; diff --git a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/HotWaterZoneSettingsBuilder.java b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/HotWaterZoneSettingsBuilder.java index 77fec684dd343..42ce4cb11ba9e 100644 --- a/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/HotWaterZoneSettingsBuilder.java +++ b/bundles/org.openhab.binding.tado/src/main/java/org/openhab/binding/tado/internal/builder/HotWaterZoneSettingsBuilder.java @@ -66,7 +66,6 @@ public GenericZoneSetting build(ZoneStateProvider zoneStateProvider, GenericZone private void addMissingSettingParts(HotWaterZoneSetting setting, ZoneStateProvider zoneStateProvider, HotWaterCapabilities capabilities) throws IOException, ApiException { - if (capabilities.isCanSetTemperature() && setting.getTemperature() == null) { TemperatureObject temperatureObject = getCurrentOrDefaultTemperature(zoneStateProvider); setting.setTemperature(temperatureObject); diff --git a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java index 80b3f2aadc844..23f59a6a9b0d1 100644 --- a/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java +++ b/bundles/org.openhab.binding.tellstick/src/main/java/org/openhab/binding/tellstick/internal/handler/TelldusDevicesHandler.java @@ -128,7 +128,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { } else { logger.warn("Setting of channel {} not possible. Read-only", channelUID); } - } private void refreshDevice(Device dev) { diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java index d9d453e8043e0..4429ac18f29a8 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaAccountHandler.java @@ -199,7 +199,6 @@ protected boolean checkResponse(Response response, boolean immediatelyFail) { } protected Vehicle[] queryVehicles() { - String authHeader = getAuthHeader(); if (authHeader != null) { diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java index ae85a7f869099..a98587339b023 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/handler/TeslaVehicleHandler.java @@ -546,7 +546,6 @@ protected void setActive() { } protected boolean checkResponse(Response response, boolean immediatelyFail) { - if (response != null && response.getStatus() == 200) { return true; } else { diff --git a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/protocol/VehicleConfig.java b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/protocol/VehicleConfig.java index 21e2709a5b8fb..4e303e97734a3 100644 --- a/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/protocol/VehicleConfig.java +++ b/bundles/org.openhab.binding.tesla/src/main/java/org/openhab/binding/tesla/internal/protocol/VehicleConfig.java @@ -42,7 +42,4 @@ public class VehicleConfig { public String trim_badging; public String wheel_type; - VehicleConfig() { - - } } diff --git a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicThingHandler.java b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicThingHandler.java index 0ce4440ce78c0..a51b0fb645dd5 100644 --- a/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicThingHandler.java +++ b/bundles/org.openhab.binding.vitotronic/src/main/java/org/openhab/binding/vitotronic/internal/handler/VitotronicThingHandler.java @@ -76,7 +76,6 @@ private synchronized VitotronicBridgeHandler getBridgeHandler() { } else { return getBridgeHandler(bridge); } - } private synchronized VitotronicBridgeHandler getBridgeHandler(Bridge bridge) { @@ -106,7 +105,6 @@ private void unregisterVitotronicThingListener(VitotronicBridgeHandler bridgeHan } else { logger.debug("Can't unregister {} at bridge bridgeHandler is null.", this.getThing().getUID()); } - } public void setChannelValue(String channelId, String value) { diff --git a/bundles/org.openhab.binding.volvooncall/src/main/java/org/openhab/binding/volvooncall/internal/handler/VehicleHandler.java b/bundles/org.openhab.binding.volvooncall/src/main/java/org/openhab/binding/volvooncall/internal/handler/VehicleHandler.java index 5316f978b2b0e..53b685471f571 100644 --- a/bundles/org.openhab.binding.volvooncall/src/main/java/org/openhab/binding/volvooncall/internal/handler/VehicleHandler.java +++ b/bundles/org.openhab.binding.volvooncall/src/main/java/org/openhab/binding/volvooncall/internal/handler/VehicleHandler.java @@ -17,17 +17,30 @@ import java.io.IOException; import java.time.ZonedDateTime; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.eclipse.jdt.annotation.NonNullByDefault; import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.smarthome.core.library.types.*; +import org.eclipse.smarthome.core.library.types.DateTimeType; +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.library.unit.SmartHomeUnits; -import org.eclipse.smarthome.core.thing.*; +import org.eclipse.smarthome.core.thing.Bridge; +import org.eclipse.smarthome.core.thing.Channel; +import org.eclipse.smarthome.core.thing.ChannelUID; +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.binding.BaseThingHandler; import org.eclipse.smarthome.core.thing.binding.BridgeHandler; import org.eclipse.smarthome.core.thing.binding.ThingHandlerService; @@ -37,7 +50,13 @@ import org.eclipse.smarthome.core.types.UnDefType; import org.openhab.binding.volvooncall.internal.action.VolvoOnCallActions; import org.openhab.binding.volvooncall.internal.config.VehicleConfiguration; -import org.openhab.binding.volvooncall.internal.dto.*; +import org.openhab.binding.volvooncall.internal.dto.Attributes; +import org.openhab.binding.volvooncall.internal.dto.Position; +import org.openhab.binding.volvooncall.internal.dto.Status; +import org.openhab.binding.volvooncall.internal.dto.Trip; +import org.openhab.binding.volvooncall.internal.dto.TripDetail; +import org.openhab.binding.volvooncall.internal.dto.Trips; +import org.openhab.binding.volvooncall.internal.dto.Vehicles; import org.openhab.binding.volvooncall.internal.wrapper.VehiclePositionWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -206,7 +225,6 @@ public void handleCommand(ChannelUID channelUID, Command command) { } } } - } private State getTripValue(String channelId, TripDetail tripDetails) { diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/handler/YamahaZoneThingHandler.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/handler/YamahaZoneThingHandler.java index 282eab8aa4da8..3f3f3ce689cea 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/handler/YamahaZoneThingHandler.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/handler/YamahaZoneThingHandler.java @@ -185,7 +185,6 @@ public void initialize() { @Override public void dispose() { - } protected YamahaBridgeHandler getBridgeHandler() { diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java index 37728d62a33b0..c60f2e597cdb6 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/AbstractConnection.java @@ -55,7 +55,6 @@ public String getHost() { } public void setProtocolSnifferEnable(boolean enable) { - if (enable) { File pathWithoutFilename = new File(ConfigConstants.getUserDataFolder()); pathWithoutFilename.mkdirs(); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/AbstractInputControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/AbstractInputControlXML.java index 8d0344f952fe6..4af16f4befff1 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/AbstractInputControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/AbstractInputControlXML.java @@ -87,7 +87,6 @@ protected DeviceDescriptorXML.FeatureDescriptor getInputFeatureDescriptor() { && deviceDescriptor.features.containsKey(Feature.NET_USB) && !deviceDescriptor.features.containsKey(Feature.NET_RADIO) && !deviceDescriptor.features.containsKey(Feature.USB)) { - // have to use the NET_USB xml element in this case inputElement = "NET_USB"; inputFeature = Feature.NET_USB; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXML.java index 582c81edea6d2..15c279ecdb51d 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXML.java @@ -157,7 +157,6 @@ public FeatureDescriptor(Feature feature, Element element) { * @param con */ public void load(XMLConnection con) { - // Get and store the Yamaha Description XML. This will be used to detect proper element naming in other areas. Node descNode = tryGetDescriptor(con); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputConverterXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputConverterXML.java index c19237f11049d..8c84ae9780d92 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputConverterXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputConverterXML.java @@ -125,7 +125,6 @@ public String toCommandName(String name) { @Override public String fromStateName(String name) { - String convertedName; String method; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithNavigationControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithNavigationControlXML.java index 0c2b3c105c8b4..db66fc2018cd5 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithNavigationControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithNavigationControlXML.java @@ -67,7 +67,6 @@ public class InputWithNavigationControlXML extends AbstractInputControlXML imple */ public InputWithNavigationControlXML(NavigationControlState state, String inputID, AbstractConnection con, NavigationControlStateListener observer, DeviceInformationState deviceInformationState) { - super(LoggerFactory.getLogger(InputWithNavigationControlXML.class), inputID, con, deviceInformationState); this.state = state; @@ -300,7 +299,8 @@ public void update() throws IOException, ReceivedMessageParseException { totalWaitingTime += YamahaReceiverBindingConstants.MENU_RETRY_DELAY; if (totalWaitingTime > YamahaReceiverBindingConstants.MENU_MAX_WAITING_TIME) { - logger.info("Menu still not ready after " + YamahaReceiverBindingConstants.MENU_MAX_WAITING_TIME + "ms. The menu state will be out of sync."); + logger.info("Menu still not ready after " + YamahaReceiverBindingConstants.MENU_MAX_WAITING_TIME + + "ms. The menu state will be out of sync."); // ToDo: this needs to redesigned to allow for some sort of async update // Note: there is not really that much we can do here. return; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithTunerDABControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithTunerDABControlXML.java index c89008468ff70..b9449b6aba9d6 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithTunerDABControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/InputWithTunerDABControlXML.java @@ -74,7 +74,6 @@ public class InputWithTunerDABControlXML extends AbstractInputControlXML public InputWithTunerDABControlXML(String inputID, AbstractConnection con, DabBandStateListener observerForBand, PresetInfoStateListener observerForPreset, PlayInfoStateListener observerForPlayInfo, DeviceInformationState deviceInformationState) { - super(LoggerFactory.getLogger(InputWithTunerDABControlXML.class), inputID, con, deviceInformationState); this.inputElement = "DAB"; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/SystemControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/SystemControlXML.java index 52716c523091f..2d25b36479477 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/SystemControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/SystemControlXML.java @@ -65,7 +65,6 @@ public class SystemControlXML implements SystemControl { public SystemControlXML(AbstractConnection xml, SystemControlStateListener observer, DeviceInformationState deviceInformationState) { - this.comReference = new WeakReference<>(xml); this.observer = observer; this.descriptorXML = DeviceDescriptorXML.getAttached(deviceInformationState); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java index 3a633e07644f7..e28867fdf40ad 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLConnection.java @@ -76,7 +76,9 @@ private T postMessage(String prefix, String message, String suffix, connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Length", Integer.toString(message.length())); - connection.setConnectTimeout(CONNECTION_TIMEOUT_MS); // set a timeout in case the device is not reachable (went offline) + // Set a timeout in case the device is not reachable (went offline) + connection.setConnectTimeout(CONNECTION_TIMEOUT_MS); + connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); @@ -142,7 +144,6 @@ private String consumeResponse(HttpURLConnection connection) throws IOException } public String getResponse(String path) throws IOException { - URL url = createBaseUrl(path); logger.debug("Making GET to {}", url); @@ -168,7 +169,6 @@ public String getResponse(String path) throws IOException { } private Charset getResponseCharset(HttpURLConnection connection, Charset defaultCharset) { - // See https://stackoverflow.com/a/3934280/1906057 Charset charset = defaultCharset; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolFactory.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolFactory.java index 1c0bc12757c48..a7aa7cd84d5a7 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolFactory.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolFactory.java @@ -53,7 +53,6 @@ public void createConnection(String host, ConnectionStateListener connectionStat @Override public SystemControl SystemControl(AbstractConnection connection, SystemControlStateListener listener, DeviceInformationState deviceInformationState) { - return new SystemControlXML(connection, listener, deviceInformationState); } @@ -61,14 +60,12 @@ public SystemControl SystemControl(AbstractConnection connection, SystemControlS public InputWithPlayControl InputWithPlayControl(AbstractConnection connection, String currentInputID, PlayInfoStateListener listener, YamahaBridgeConfig bridgeConfig, DeviceInformationState deviceInformationState) { - return new InputWithPlayControlXML(currentInputID, connection, listener, bridgeConfig, deviceInformationState); } @Override public InputWithPresetControl InputWithPresetControl(AbstractConnection connection, String currentInputID, PresetInfoStateListener listener, DeviceInformationState deviceInformationState) { - return new InputWithPresetControlXML(currentInputID, connection, listener, deviceInformationState); } @@ -76,7 +73,6 @@ public InputWithPresetControl InputWithPresetControl(AbstractConnection connecti public InputWithTunerBandControl InputWithDabBandControl(String currentInputID, AbstractConnection connection, DabBandStateListener observerForBand, PresetInfoStateListener observerForPreset, PlayInfoStateListener observerForPlayInfo, DeviceInformationState deviceInformationState) { - return new InputWithTunerDABControlXML(currentInputID, connection, observerForBand, observerForPreset, observerForPlayInfo, deviceInformationState); } @@ -85,7 +81,6 @@ public InputWithTunerBandControl InputWithDabBandControl(String currentInputID, public InputWithNavigationControl InputWithNavigationControl(AbstractConnection connection, NavigationControlState state, String inputID, NavigationControlStateListener observer, DeviceInformationState deviceInformationState) { - return new InputWithNavigationControlXML(state, inputID, connection, observer, deviceInformationState); } @@ -93,7 +88,6 @@ public InputWithNavigationControl InputWithNavigationControl(AbstractConnection public ZoneControl ZoneControl(AbstractConnection connection, YamahaZoneConfig zoneSettings, ZoneControlStateListener listener, Supplier inputConverterSupplier, DeviceInformationState deviceInformationState) { - if (isZoneB(zoneSettings.getZone(), deviceInformationState)) { return new ZoneBControlXML(connection, zoneSettings, listener, deviceInformationState, inputConverterSupplier); @@ -106,7 +100,6 @@ public ZoneControl ZoneControl(AbstractConnection connection, YamahaZoneConfig z public ZoneAvailableInputs ZoneAvailableInputs(AbstractConnection connection, YamahaZoneConfig zoneSettings, AvailableInputStateListener listener, Supplier inputConverterSupplier, DeviceInformationState deviceInformationState) { - if (isZoneB(zoneSettings.getZone(), deviceInformationState)) { return new ZoneBAvailableInputsXML(connection, listener, inputConverterSupplier); } diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolService.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolService.java index 79123aec62b1c..d742ddfac1042 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolService.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLProtocolService.java @@ -99,7 +99,6 @@ public static Node getResponse(AbstractConnection con, String cmd, String path) */ public static Collection getInputs(AbstractConnection con, Zone zone) throws IOException, ReceivedMessageParseException { - Node inputSelItem = getZoneResponse(con, zone, ZONE_INPUT_QUERY, ZONE_INPUT_PATH); List inputs = new LinkedList<>(); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLUtils.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLUtils.java index d8278971e07f2..f673e96c42609 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLUtils.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/XMLUtils.java @@ -168,7 +168,6 @@ public static Integer getNodeContentOrDefault(Node root, String nodePath, Intege * @throws IOException */ public static Document xml(String message) throws IOException, ReceivedMessageParseException { - // Ensure the message contains XML declaration String response = message.startsWith("" + message; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneAvailableInputsXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneAvailableInputsXML.java index f26c5d183d85a..5f347ca179dac 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneAvailableInputsXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneAvailableInputsXML.java @@ -49,7 +49,6 @@ public class ZoneAvailableInputsXML implements ZoneAvailableInputs { public ZoneAvailableInputsXML(AbstractConnection con, Zone zone, AvailableInputStateListener observer, Supplier inputConverterSupplier) { - this.conReference = new WeakReference<>(con); this.zone = zone; this.observer = observer; diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBAvailableInputsXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBAvailableInputsXML.java index 080107a559cf5..7592b19b5303a 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBAvailableInputsXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBAvailableInputsXML.java @@ -29,7 +29,6 @@ public class ZoneBAvailableInputsXML extends ZoneAvailableInputsXML { public ZoneBAvailableInputsXML(AbstractConnection con, AvailableInputStateListener observer, Supplier inputConverterSupplier) { - super(con, Zone.Main_Zone, observer, inputConverterSupplier); this.logger = LoggerFactory.getLogger(ZoneBAvailableInputsXML.class); } diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBControlXML.java index 5d052de352dcf..5b3ebdaad05e3 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneBControlXML.java @@ -31,7 +31,6 @@ public class ZoneBControlXML extends ZoneControlXML { public ZoneBControlXML(AbstractConnection con, YamahaZoneConfig zoneSettings, ZoneControlStateListener observer, DeviceInformationState deviceInformationState, Supplier inputConverterSupplier) { - // Commands will need to be send to Main_Zone super(con, Zone.Main_Zone, zoneSettings, observer, deviceInformationState, inputConverterSupplier); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneControlXML.java b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneControlXML.java index cc02f4ea860ef..639fbfc2b3c37 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneControlXML.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/ZoneControlXML.java @@ -81,9 +81,8 @@ public class ZoneControlXML implements ZoneControl { protected boolean dialogueLevelSupported = false; public ZoneControlXML(AbstractConnection con, Zone zone, YamahaZoneConfig zoneSettings, - ZoneControlStateListener observer, DeviceInformationState deviceInformationState, - Supplier inputConverterSupplier) { - + ZoneControlStateListener observer, DeviceInformationState deviceInformationState, + Supplier inputConverterSupplier) { this.comReference = new WeakReference<>(con); this.zone = zone; this.zoneConfig = zoneSettings; @@ -132,14 +131,17 @@ protected void applyModelVariations() { try { // Note: Detection for RX-V3900, which has a different XML node for surround program - Node basicStatusNode = getZoneResponse(comReference.get(), getZone(), ZONE_BASIC_STATUS_CMD, ZONE_BASIC_STATUS_PATH); + Node basicStatusNode = getZoneResponse(comReference.get(), getZone(), ZONE_BASIC_STATUS_CMD, + ZONE_BASIC_STATUS_PATH); String surroundProgram = getNodeContentOrEmpty(basicStatusNode, "Surr/Pgm_Sel/Pgm"); if (StringUtils.isNotEmpty(surroundProgram)) { - surroundSelProgram = new CommandTemplate("Off%s", "Surr/Pgm_Sel/Pgm"); + surroundSelProgram = new CommandTemplate( + "Off%s", "Surr/Pgm_Sel/Pgm"); logger.debug("Zone {} - adjusting command to: {}", getZone(), surroundSelProgram); - surroundSelStraight = new CommandTemplate("On", "Surr/Pgm_Sel/Straight"); + surroundSelStraight = new CommandTemplate("On", + "Surr/Pgm_Sel/Straight"); logger.debug("Zone {} - adjusting command to: {}", getZone(), surroundSelStraight); } diff --git a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/YamahaReceiverHandlerTest.java b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/YamahaReceiverHandlerTest.java index 2e579e33a42a6..4b0409d85e972 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/YamahaReceiverHandlerTest.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/YamahaReceiverHandlerTest.java @@ -102,7 +102,6 @@ protected void onSetUp() throws Exception { @Test public void afterInitializeBridgeShouldBeOnline() throws InterruptedException { - // when subject.initialize(); // internally there is an timer, let's allow it to execute diff --git a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/XMLProtocolFactoryTest.java b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/XMLProtocolFactoryTest.java index acac46021c299..e818abb58a04e 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/XMLProtocolFactoryTest.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/XMLProtocolFactoryTest.java @@ -60,7 +60,6 @@ protected void onSetUp() throws Exception { @Test public void given_HTR4069_with_ZONEB_then_Zone2_control_is_ZoneBControlXML() throws IOException, ReceivedMessageParseException { - // arrange ctx.prepareForModel("HTR-4069"); @@ -77,7 +76,6 @@ public void given_HTR4069_with_ZONEB_then_Zone2_control_is_ZoneBControlXML() @Test public void given_RXS601D_without_ZONEB_then_Zone2_control_is_ZoneControlXML() throws IOException, ReceivedMessageParseException { - // arrange ctx.prepareForModel("RX-S601D"); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXMLTest.java b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXMLTest.java index da2d5fa4b07d3..4c8784e8c59eb 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXMLTest.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceDescriptorXMLTest.java @@ -12,17 +12,17 @@ */ package org.openhab.binding.yamahareceiver.internal.protocol.xml; -import org.junit.Test; -import org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants; +import static org.junit.Assert.*; +import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Feature.*; +import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Zone.*; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.junit.Assert.*; -import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Feature.*; -import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Zone.*; +import org.junit.Test; +import org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants; /** * Unit test for {@link DeviceDescriptorXML}. @@ -33,77 +33,45 @@ public class DeviceDescriptorXMLTest extends AbstractXMLProtocolTest { @Test public void given_RXS601D_parsesDescriptor() throws IOException { - parsesDescriptor("RX-S601D", - Arrays.asList(Main_Zone, Zone_2), + parsesDescriptor("RX-S601D", Arrays.asList(Main_Zone, Zone_2), Arrays.asList(AIRPLAY, SPOTIFY, USB, BLUETOOTH, DAB, NET_RADIO), - new CommandsSpec(9, Arrays.asList( - "System,Power_Control,Power", - "System,Party_Mode,Mode", - "System,Party_Mode,Volume,Lvl", - "System,Party_Mode,Volume,Mute")), - new CommandsSpec[]{ + new CommandsSpec(9, + Arrays.asList("System,Power_Control,Power", "System,Party_Mode,Mode", + "System,Party_Mode,Volume,Lvl", "System,Party_Mode,Volume,Mute")), + new CommandsSpec[] { // Main_Zone - new CommandsSpec(29, Arrays.asList( - "Main_Zone,Power_Control,Power", - "Main_Zone,Volume,Lvl", - "Main_Zone,Volume,Mute", - "Main_Zone,Input,Input_Sel", - "Main_Zone,Input,Input_Sel_Item", - "Main_Zone,Scene,Scene_Sel", - "Main_Zone,Scene,Scene_Sel_Item", + new CommandsSpec(29, Arrays.asList("Main_Zone,Power_Control,Power", "Main_Zone,Volume,Lvl", + "Main_Zone,Volume,Mute", "Main_Zone,Input,Input_Sel", "Main_Zone,Input,Input_Sel_Item", + "Main_Zone,Scene,Scene_Sel", "Main_Zone,Scene,Scene_Sel_Item", "Main_Zone,Surround,Program_Sel,Current,Straight", "Main_Zone,Surround,Program_Sel,Current,Enhancer", "Main_Zone,Surround,Program_Sel,Current,Sound_Program")), // Zone_2 - new CommandsSpec(20, Arrays.asList( - "Zone_2,Power_Control,Power", - "Zone_2,Volume,Lvl", - "Zone_2,Volume,Mute", - "Zone_2,Input,Input_Sel", - "Zone_2,Input,Input_Sel_Item", - "Zone_2,Scene,Scene_Sel", - "Zone_2,Scene,Scene_Sel_Item")) - }); + new CommandsSpec(20, + Arrays.asList("Zone_2,Power_Control,Power", "Zone_2,Volume,Lvl", "Zone_2,Volume,Mute", + "Zone_2,Input,Input_Sel", "Zone_2,Input,Input_Sel_Item", + "Zone_2,Scene,Scene_Sel", "Zone_2,Scene,Scene_Sel_Item")) }); } @Test public void given_RXV3900_parsesDescriptor() throws IOException { - parsesDescriptor("RX-V3900", - Arrays.asList(Main_Zone, Zone_2, Zone_3), - Arrays.asList(BLUETOOTH, TUNER, NET_USB), - new CommandsSpec(2, Arrays.asList( - "System,Power_Control,Power")), - new CommandsSpec[]{ + parsesDescriptor("RX-V3900", Arrays.asList(Main_Zone, Zone_2, Zone_3), Arrays.asList(BLUETOOTH, TUNER, NET_USB), + new CommandsSpec(2, Arrays.asList("System,Power_Control,Power")), new CommandsSpec[] { // Main_Zone - new CommandsSpec(9, Arrays.asList( - "Main_Zone,Power_Control,Power", - "Main_Zone,Vol,Lvl", - "Main_Zone,Vol,Mute", - "Main_Zone,Input,Input_Sel", - "Main_Zone,Input,Input_Sel_Item")), + new CommandsSpec(9, Arrays.asList("Main_Zone,Power_Control,Power", "Main_Zone,Vol,Lvl", + "Main_Zone,Vol,Mute", "Main_Zone,Input,Input_Sel", "Main_Zone,Input,Input_Sel_Item")), // Zone_2 - new CommandsSpec(9, Arrays.asList( - "Zone_2,Power_Control,Power", - "Zone_2,Vol,Lvl", - "Zone_2,Vol,Mute", - "Zone_2,Input,Input_Sel", - "Zone_2,Input,Input_Sel_Item")), + new CommandsSpec(9, + Arrays.asList("Zone_2,Power_Control,Power", "Zone_2,Vol,Lvl", "Zone_2,Vol,Mute", + "Zone_2,Input,Input_Sel", "Zone_2,Input,Input_Sel_Item")), // Zone_3 - new CommandsSpec(9, Arrays.asList( - "Zone_3,Power_Control,Power", - "Zone_3,Vol,Lvl", - "Zone_3,Vol,Mute", - "Zone_3,Input,Input_Sel", - "Zone_3,Input,Input_Sel_Item")) - }); + new CommandsSpec(9, Arrays.asList("Zone_3,Power_Control,Power", "Zone_3,Vol,Lvl", + "Zone_3,Vol,Mute", "Zone_3,Input,Input_Sel", "Zone_3,Input,Input_Sel_Item")) }); } - private void parsesDescriptor(String model, - List zones, - Collection features, - CommandsSpec systemCommandsSpec, - CommandsSpec[] zonesCommandsSpec) throws IOException { - + private void parsesDescriptor(String model, List zones, + Collection features, CommandsSpec systemCommandsSpec, + CommandsSpec[] zonesCommandsSpec) throws IOException { // arrange ctx.prepareForModel(model); diff --git a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceInformationXMLTest.java b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceInformationXMLTest.java index d5791f920793f..71aaf9cf4b4de 100644 --- a/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceInformationXMLTest.java +++ b/bundles/org.openhab.binding.yamahareceiver/src/test/java/org/openhab/binding/yamahareceiver/internal/protocol/xml/DeviceInformationXMLTest.java @@ -12,16 +12,16 @@ */ package org.openhab.binding.yamahareceiver.internal.protocol.xml; -import org.junit.Test; -import org.openhab.binding.yamahareceiver.internal.protocol.ReceivedMessageParseException; -import org.openhab.binding.yamahareceiver.internal.state.DeviceInformationState; +import static org.junit.Assert.assertTrue; +import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Feature.*; +import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Zone.*; import java.io.IOException; import java.util.Arrays; -import static org.junit.Assert.assertTrue; -import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Feature.*; -import static org.openhab.binding.yamahareceiver.internal.YamahaReceiverBindingConstants.Zone.*; +import org.junit.Test; +import org.openhab.binding.yamahareceiver.internal.protocol.ReceivedMessageParseException; +import org.openhab.binding.yamahareceiver.internal.state.DeviceInformationState; /** * Unit test for {@link DeviceInformationXML}. @@ -41,8 +41,8 @@ public void onSetUp() { } @Test - public void when_HTR4069_then_detects_featureZoneB_and_addsZone2() throws IOException, ReceivedMessageParseException { - + public void when_HTR4069_then_detects_featureZoneB_and_addsZone2() + throws IOException, ReceivedMessageParseException { // arrange ctx.prepareForModel("HTR-4069"); @@ -55,8 +55,8 @@ public void when_HTR4069_then_detects_featureZoneB_and_addsZone2() throws IOExce } @Test - public void when_RXV3900_then_detects_features_and_zones_from_descriptor() throws IOException, ReceivedMessageParseException { - + public void when_RXV3900_then_detects_features_and_zones_from_descriptor() + throws IOException, ReceivedMessageParseException { // arrange ctx.prepareForModel("RX-V3900"); @@ -68,5 +68,4 @@ public void when_RXV3900_then_detects_features_and_zones_from_descriptor() throw assertTrue("Features detected", state.features.containsAll(Arrays.asList(TUNER, BLUETOOTH))); } - } diff --git a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java index 72c667669377a..55bb1cf9f02f5 100644 --- a/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java +++ b/bundles/org.openhab.binding.yeelight/src/main/java/org/openhab/binding/yeelight/internal/lib/services/DeviceManager.java @@ -14,13 +14,26 @@ import java.awt.Color; import java.io.IOException; -import java.net.*; -import java.util.*; +import java.net.DatagramPacket; +import java.net.InetAddress; +import java.net.MulticastSocket; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.stream.Collectors; -import org.openhab.binding.yeelight.internal.lib.device.*; +import org.openhab.binding.yeelight.internal.lib.device.DeviceBase; +import org.openhab.binding.yeelight.internal.lib.device.DeviceFactory; +import org.openhab.binding.yeelight.internal.lib.device.DeviceStatus; +import org.openhab.binding.yeelight.internal.lib.device.DeviceWithAmbientLight; +import org.openhab.binding.yeelight.internal.lib.device.DeviceWithNightlight; import org.openhab.binding.yeelight.internal.lib.enums.DeviceAction; import org.openhab.binding.yeelight.internal.lib.listeners.DeviceListener; import org.slf4j.Logger; @@ -110,7 +123,6 @@ private void searchDevice() { executorService.execute(() -> { try (MulticastSocket multiSocket = new MulticastSocket(MULTI_CAST_PORT)) { - multiSocket.setSoTimeout(TIMEOUT); multiSocket.setNetworkInterface(networkInterface); multiSocket.joinGroup(multicastAddress); diff --git a/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZoneMinderThingMonitorHandler.java b/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZoneMinderThingMonitorHandler.java index 296c691113a2a..f9e2558fab855 100644 --- a/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZoneMinderThingMonitorHandler.java +++ b/bundles/org.openhab.binding.zoneminder/src/main/java/org/openhab/binding/zoneminder/internal/handler/ZoneMinderThingMonitorHandler.java @@ -104,7 +104,6 @@ public String getZoneMinderId() { return ""; } return config.getZoneMinderId().toString(); - } @Override diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java index e481b3b9a2c0c..6385da58fa70c 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitTaggedItem.java @@ -84,7 +84,6 @@ public HomekitTaggedItem(Item item, ItemRegistry itemRegistry) { throw new BadItemConfigurationException( "Item belongs to multiple Groups which are tagged as Homekit devices."); } - } catch (BadItemConfigurationException e) { logger.warn("Item {} was misconfigured: {}. Excluding item from homekit.", item.getName(), e.getMessage()); homekitAccessoryType = null; diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer.java index ad0f0ffe1c5ad..78a21d5064d90 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/glassfish/jersey/servlet/init/JerseyServletContainerInitializer.java @@ -25,6 +25,5 @@ public class JerseyServletContainerInitializer implements ServletContainerInitializer { @Override public void onStartup(Set> c, ServletContext ctx) { - } } diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/RuleUtils.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/RuleUtils.java index ba1cbd2718f85..2fc4c154138cf 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/RuleUtils.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/RuleUtils.java @@ -360,7 +360,6 @@ public static class TimerConfig { trigger = triggers.stream().filter(p -> p.getId().equals("timertrigger")).findFirst(); if (trigger.isPresent()) { - TimerConfig c = trigger.get().getConfiguration().as(TimerConfig.class); if (c.repeat == null) { return String.format(c.randomizeTime.isEmpty() ? "PT%s" : "PT%sA%s", c.time, c.randomizeTime); diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/StateUtils.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/StateUtils.java index 1a4439cc74c87..13d7363d0eeda 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/StateUtils.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/StateUtils.java @@ -156,7 +156,6 @@ public static Command commandByItemState(State state) throws IllegalStateExcepti */ public static @Nullable Command computeCommandByState(List responses, String prefix, AbstractHueState state, HueStateChange newState) { - // Apply new state and collect success, error items Map successApplied = new TreeMap<>(); List errorApplied = new ArrayList<>(); @@ -198,7 +197,6 @@ public static Command commandByItemState(State state) throws IllegalStateExcepti } if (newState.sat != null) { - try { HueStateColorBulb c = state.as(HueStateColorBulb.class); c.sat = newState.sat; @@ -419,7 +417,7 @@ public static Command commandByItemState(State state) throws IllegalStateExcepti * If the item state matches the last command. the hue state is adjusted * to use the values from the last hue state change. This is done to prevent * Alexa reporting device errors. - * + * * @param itemState The item state * @param deviceType The device type * @param lastCommand The last command @@ -428,7 +426,6 @@ public static Command commandByItemState(State state) throws IllegalStateExcepti */ public static AbstractHueState adjustedColorStateFromItemState(State itemState, @Nullable DeviceType deviceType, @Nullable Command lastCommand, @Nullable HueStateChange lastHueChange) { - AbstractHueState hueState = colorStateFromItemState(itemState, deviceType); if (lastCommand != null && lastHueChange != null) { diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/automation/HttpActionHandler.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/automation/HttpActionHandler.java index b67e78383f90a..5aadab993b917 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/automation/HttpActionHandler.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/automation/HttpActionHandler.java @@ -82,7 +82,6 @@ public HttpActionHandler(final Action module, HttpClientFactory httpFactory) { @Override public @Nullable Map execute(Map context) { - try { Request request = httpClient.newRequest(URI.create(config.url)).method(config.method) .timeout(config.timeout, TimeUnit.SECONDS); diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueGroupEntry.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueGroupEntry.java index c61fff225688a..aaed00ab34b82 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueGroupEntry.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueGroupEntry.java @@ -96,7 +96,6 @@ static class HueGroupHelper extends HueGroupEntry { @Override public JsonElement serialize(HueGroupEntry product, Type type, JsonSerializationContext context) { - GroupItem item = product.groupItem; if (item != null) { product.lights = item.getMembers().stream().map(gitem -> cs.mapItemUIDtoHueID(gitem)) diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueLightEntry.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueLightEntry.java index a31fc9faa1fa7..e98c9d7daffa1 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueLightEntry.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/HueLightEntry.java @@ -163,13 +163,12 @@ public HueLightEntry(GenericItem item, String uniqueid, DeviceType deviceType) { */ @NonNullByDefault({}) public static class Serializer implements JsonSerializer { - static class HueDeviceHelper extends HueLightEntry { + static class HueDeviceHelper extends HueLightEntry { } @Override public JsonElement serialize(HueLightEntry product, Type type, JsonSerializationContext context) { - product.state = StateUtils.adjustedColorStateFromItemState(product.item.getState(), product.deviceType, product.lastCommand, product.lastHueChange); String label = product.item.getLabel(); @@ -191,7 +190,7 @@ public JsonElement serialize(HueLightEntry product, Type type, JsonSerialization public void updateItem(GenericItem element) { item = element; state = StateUtils.colorStateFromItemState(item.getState(), deviceType); - + lastCommand = null; lastHueChange = null; diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Rules.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Rules.java index 58fb1a87c3600..3b5781cec296f 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Rules.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Rules.java @@ -198,7 +198,6 @@ protected static Map.Entry hueConditionToAutomation(String i protected static RuleBuilder createHueRuleConditions(List hueConditions, RuleBuilder builder, List oldTriggers, List oldConditions, ItemRegistry itemRegistry) { - // Preserve all triggers, conditions that are not part of hue rules Map triggers = new TreeMap<>(); triggers.putAll(oldTriggers.stream().filter(a -> !a.getTypeUID().equals("core.ItemStateChangeTrigger")) diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Scenes.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Scenes.java index 63398376eac25..89b128d576669 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Scenes.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/rest/Scenes.java @@ -301,7 +301,6 @@ public Response modifySceneApi(@Context UriInfo uri, // } try { - ruleRegistry.add(builder.build()); } catch (IllegalStateException e) { return NetworkUtils.singleError(cs.gson, uri, HueResponse.ARGUMENTS_INVALID, e.getMessage()); @@ -379,7 +378,6 @@ public Response modifySceneLightStateApi(@Context UriInfo uri, // @PathParam("username") @ApiParam(value = "username") String username, @PathParam("id") @ApiParam(value = "scene id") String id, @PathParam("lightid") @ApiParam(value = "light id") String lightid, String body) { - if (!userManagement.authorizeUser(username)) { return NetworkUtils.singleError(cs.gson, uri, HueResponse.UNAUTHORIZED, "Not Authorized"); } diff --git a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/upnp/UpnpServer.java b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/upnp/UpnpServer.java index d6043aea5ad98..b0f2c4124eaa9 100644 --- a/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/upnp/UpnpServer.java +++ b/bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/upnp/UpnpServer.java @@ -17,7 +17,17 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; -import java.net.*; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.NetworkInterface; +import java.net.SocketAddress; +import java.net.StandardProtocolFamily; +import java.net.StandardSocketOptions; +import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.nio.channels.ClosedSelectorException; import java.nio.channels.DatagramChannel; @@ -412,11 +422,11 @@ public void accept(HueEmulationConfigWithRuntime threadContext) { boolean hasIPv4 = false; boolean hasIPv6 = false; - try ( Selector selector = Selector.open(); + try (Selector selector = Selector.open(); DatagramChannel channelV4 = createBoundDataGramChannelOrNull(StandardProtocolFamily.INET); DatagramChannel channelV6 = createBoundDataGramChannelOrNull(StandardProtocolFamily.INET6)) { - - // Set global config to thread local config. Otherwise upnpAnnouncementThreadRunning() will report wrong results. + // Set global config to thread local config. Otherwise upnpAnnouncementThreadRunning() will report wrong + // results. config = threadContext; threadContext.asyncIOselector = selector; @@ -428,7 +438,7 @@ public void accept(HueEmulationConfigWithRuntime threadContext) { if (address instanceof Inet4Address && channelV4 != null) { channelV4.join(MULTI_ADDR_IPV4, networkInterface); hasIPv4 = true; - } else if (channelV6 != null){ + } else if (channelV6 != null) { channelV6.join(MULTI_ADDR_IPV6, networkInterface); hasIPv6 = true; } @@ -497,10 +507,8 @@ public void accept(HueEmulationConfigWithRuntime threadContext) { @Nullable private DatagramChannel createBoundDataGramChannelOrNull(StandardProtocolFamily family) throws IOException { try { - return DatagramChannel.open(family) - .setOption(StandardSocketOptions.SO_REUSEADDR, true) - .setOption(StandardSocketOptions.IP_MULTICAST_LOOP, true) - .bind(new InetSocketAddress(UPNP_PORT)); + return DatagramChannel.open(family).setOption(StandardSocketOptions.SO_REUSEADDR, true) + .setOption(StandardSocketOptions.IP_MULTICAST_LOOP, true).bind(new InetSocketAddress(UPNP_PORT)); } catch (UnsupportedOperationException uoe) { return null; } diff --git a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/LightsAndGroupsTests.java b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/LightsAndGroupsTests.java index af11b199125aa..078e70e4c187a 100644 --- a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/LightsAndGroupsTests.java +++ b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/LightsAndGroupsTests.java @@ -197,7 +197,6 @@ public void updateSwitchable() { @Test public void changeSwitchState() { - assertThat(((HueStatePlug) cs.ds.lights.get("1").state).on, is(false)); String body = "{'on':true}"; @@ -214,7 +213,6 @@ public void changeSwitchState() { @Test public void changeGroupItemSwitchState() { - assertThat(((HueStatePlug) cs.ds.groups.get("10").action).on, is(false)); String body = "{'on':true}"; @@ -231,7 +229,6 @@ public void changeGroupItemSwitchState() { @Test public void changeOnValue() { - assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).on, is(false)); String body = "{'on':true}"; @@ -245,7 +242,6 @@ public void changeOnValue() { @Test public void changeOnAndBriValues() { - assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).on, is(false)); assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).bri, is(1)); diff --git a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/ScheduleTests.java b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/ScheduleTests.java index be2e8781f3c5a..f5722565a74f2 100644 --- a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/ScheduleTests.java +++ b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/ScheduleTests.java @@ -259,7 +259,6 @@ public void getAll() { @Test public void timeStringToTrigger() { - String timeString; Trigger trigger; Configuration configuration; diff --git a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/SensorTests.java b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/SensorTests.java index 57936ee249ef8..fac98faceacd0 100644 --- a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/SensorTests.java +++ b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/SensorTests.java @@ -91,7 +91,6 @@ public void tearDown() { @Test public void renameSensor() { - assertThat(cs.ds.sensors.get("switch1").name, is("name1")); String body = "{'name':'name2'}"; diff --git a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/UsersAndConfigTests.java b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/UsersAndConfigTests.java index fbd5a245186c2..c2f4e0b240afd 100644 --- a/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/UsersAndConfigTests.java +++ b/bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/UsersAndConfigTests.java @@ -122,7 +122,6 @@ public void addUser() { @Test public void UnauthorizedAccessTest() { - // Unauthorized config Response response; response = commonSetup.client.target(commonSetup.basePath + "/config").request().get(); diff --git a/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/Room.java b/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/Room.java index 8985a3c89cef1..2e2e262c37aa8 100644 --- a/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/Room.java +++ b/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/Room.java @@ -50,7 +50,6 @@ public boolean equals(Object o) { Room room = (Room) o; return id != null ? id.equals(room.id) : room.id == null; - } @Override diff --git a/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/param/DeviceParam.java b/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/param/DeviceParam.java index 25128cb54053c..5eedd4618d8c4 100644 --- a/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/param/DeviceParam.java +++ b/bundles/org.openhab.io.imperihome/src/main/java/org/openhab/io/imperihome/internal/model/param/DeviceParam.java @@ -58,7 +58,6 @@ public boolean equals(Object o) { return false; } return value != null ? value.equals(that.value) : that.value == null; - } @Override diff --git a/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java b/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java index eae17088ecfe1..e2de677f8f1ba 100644 --- a/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java +++ b/bundles/org.openhab.io.mqttembeddedbroker/src/main/java/org/openhab/io/mqttembeddedbroker/internal/EmbeddedBrokerService.java @@ -45,7 +45,11 @@ import org.eclipse.smarthome.io.transport.mqtt.MqttServiceObserver; import org.openhab.io.mqttembeddedbroker.Constants; import org.openhab.io.mqttembeddedbroker.internal.MqttEmbeddedBrokerDetectStart.MqttEmbeddedBrokerStartedListener; -import org.osgi.service.component.annotations.*; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.osgi.service.component.annotations.Modified; +import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -107,7 +111,6 @@ public void onConnect(InterceptConnectMessage arg0) { @Override public void onConnectionLost(InterceptConnectionLostMessage arg0) { - } @Override @@ -117,22 +120,18 @@ public void onDisconnect(InterceptDisconnectMessage arg0) { @Override public void onMessageAcknowledged(InterceptAcknowledgedMessage arg0) { - } @Override public void onPublish(InterceptPublishMessage arg0) { - } @Override public void onSubscribe(InterceptSubscribeMessage arg0) { - } @Override public void onUnsubscribe(InterceptUnsubscribeMessage arg0) { - } } @@ -144,16 +143,18 @@ public void onUnsubscribe(InterceptUnsubscribeMessage arg0) { private @Nullable MqttBrokerConnection connection; @Activate - public EmbeddedBrokerService(@Reference MqttService mqttService, Map configuration) throws IOException { + public EmbeddedBrokerService(@Reference MqttService mqttService, Map configuration) + throws IOException { this.service = mqttService; initialize(configuration); } + @Modified public void modified(Map configuration) throws IOException { deactivate(); initialize(configuration); } - + public void initialize(Map configuration) throws IOException { ServiceConfiguration config = new Configuration(configuration).as(ServiceConfiguration.class); int port = config.port == null ? (config.port = config.secure ? 8883 : 1883) : config.port; @@ -214,7 +215,7 @@ public void deactivate() { } }).get(10, TimeUnit.SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { - logger.warn("Could not cleanly shutdown connection or server.", e); + logger.warn("Could not cleanly shutdown connection or server.", e); } connection = null; } @@ -301,16 +302,14 @@ public void startEmbeddedServer(@Nullable Integer portParam, boolean secure, @Nu ISslContextCreator sslContextCreator = secure ? nettySSLcontextCreator() : null; try { - server.startServer(new MemoryConfig(properties), null, sslContextCreator, authentificator, - authorizer); + server.startServer(new MemoryConfig(properties), null, sslContextCreator, authentificator, authorizer); } catch (IllegalArgumentException e) { if (e.getMessage().contains("Could not deserialize")) { Path persistenceFilePath = Paths.get((new File(persistenceFilename)).getAbsolutePath()); logger.warn("persistence corrupt: {}, deleting {}", e.getMessage(), persistenceFilePath); Files.delete(persistenceFilePath); // retry starting broker, if it fails again, don't catch exception - server.startServer(new MemoryConfig(properties), null, sslContextCreator, authentificator, - authorizer); + server.startServer(new MemoryConfig(properties), null, sslContextCreator, authentificator, authorizer); } } this.server = server; diff --git a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoApi.java b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoApi.java index 9bd415ca258a2..ddfaacd755f24 100644 --- a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoApi.java +++ b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/NeeoApi.java @@ -116,8 +116,8 @@ public class NeeoApi implements AutoCloseable { * Constructs the APi from the given IP address, brain identifier and {@link ServiceContext} * * @param ipAddress the non-empty ip address - * @param brainId the non-empty brain id - * @param context the non-null {@link ServiceContext} + * @param brainId the non-empty brain id + * @param context the non-null {@link ServiceContext} * @throws IOException if an exception occurs connecting to the brain */ public NeeoApi(String ipAddress, String brainId, ServiceContext context) throws IOException { @@ -178,7 +178,6 @@ public NeeoApi(String ipAddress, String brainId, ServiceContext context) throws callbackUrl = new URL("http://" + primaryAddress + ":" + (port == -1 ? NeeoConstants.DEFAULT_OPENHAB_PORT : port) + NeeoUtil.getServletUrl(brainId)); - } /** @@ -502,7 +501,7 @@ private void deregisterApi() throws IOException { * Executes a recipe for the given deviceKey * * @param deviceKey the non-empty device key - * @param on true to start the recipe, false to stop + * @param on true to start the recipe, false to stop * @throws IOException Signals that an I/O exception has occurred. */ public void executeRecipe(String deviceKey, boolean on) throws IOException { @@ -557,14 +556,13 @@ public void close() { NeeoUtil.close(request.get()); setConnected(false); } - } /** * Adds a {@link PropertyChangeListener} for the given propertyChange * * @param propertyName a non-null, non-empty property name - * @param listener a non-null listener to add + * @param listener a non-null listener to add */ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { NeeoUtil.requireNotEmpty(propertyName, "propertyName must not be empty"); diff --git a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/models/NeeoDeviceChannel.java b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/models/NeeoDeviceChannel.java index bec52a4320eba..4b8ed44cdfc97 100644 --- a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/models/NeeoDeviceChannel.java +++ b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/models/NeeoDeviceChannel.java @@ -111,7 +111,6 @@ public static List from(Channel channel, NeeoCapabilityType c final ChannelUID uid = channel.getUID(); return Arrays.asList(new NeeoDeviceChannel(NeeoDeviceChannelKind.get(channel.getKind()), uid.getId(), 1, capabilityType, subType, NeeoUtil.getUniqueLabel(existingLabels, uid.getIdWithoutGroup()), "", null)); - } /** @@ -154,7 +153,6 @@ public static List from(Item item, @Nullable Channel channel, NeeoUtil.getUniqueLabel(existingLabels, NeeoUtil.getLabel(item, channelType) + " (Brightness)"), NeeoUtil.getPattern(item, channelType), NeeoDeviceChannelRange.from(item))); - } else { return Arrays.asList(new NeeoDeviceChannel( NeeoDeviceChannelKind.get(channel == null ? ChannelKind.STATE : channel.getKind()), item.getName(), diff --git a/bundles/org.openhab.io.transport.modbus/src/test/java/org/openhab/io/transport/modbus/test/SmokeTest.java b/bundles/org.openhab.io.transport.modbus/src/test/java/org/openhab/io/transport/modbus/test/SmokeTest.java index 3984b70b43694..1ef816b2a1af9 100644 --- a/bundles/org.openhab.io.transport.modbus/src/test/java/org/openhab/io/transport/modbus/test/SmokeTest.java +++ b/bundles/org.openhab.io.transport.modbus/src/test/java/org/openhab/io/transport/modbus/test/SmokeTest.java @@ -385,7 +385,6 @@ public void onError(ModbusReadRequestBlueprint request, Exception error) { @Override public void onBits(ModbusReadRequestBlueprint request, BitArray bits) { - unexpectedCount.incrementAndGet(); callbackCalled.countDown(); diff --git a/bundles/org.openhab.transform.jinja/src/test/java/org/openhab/transform/jinja/internal/JinjaTransformationServiceTest.java b/bundles/org.openhab.transform.jinja/src/test/java/org/openhab/transform/jinja/internal/JinjaTransformationServiceTest.java index cfcf09a4f161f..a01ef6bb73ea0 100644 --- a/bundles/org.openhab.transform.jinja/src/test/java/org/openhab/transform/jinja/internal/JinjaTransformationServiceTest.java +++ b/bundles/org.openhab.transform.jinja/src/test/java/org/openhab/transform/jinja/internal/JinjaTransformationServiceTest.java @@ -31,7 +31,6 @@ public void init() { @Test public void testTransformByJSon() throws TransformationException { - String json = "{\"Time\":\"2019-01-05T22:45:12\",\"AM2301\":{\"Temperature\":4.7,\"Humidity\":99.9},\"TempUnit\":\"C\"}"; // method under test String transformedResponse = processor.transform("{{value_json['AM2301'].Temperature}}", json); @@ -42,7 +41,6 @@ public void testTransformByJSon() throws TransformationException { @Test public void testStringOnly() throws TransformationException { - String value = "world"; // method under test String transformedResponse = processor.transform("Hello {{ value }}!", value); @@ -53,7 +51,6 @@ public void testStringOnly() throws TransformationException { @Test public void testQuotedStringOnly() throws TransformationException { - String value = "\"world\""; // method under test String transformedResponse = processor.transform("Hello {{ value_json }}!", value); diff --git a/bundles/org.openhab.transform.jsonpath/src/test/java/org/openhab/transform/jsonpath/internal/JSonPathTransformationServiceTest.java b/bundles/org.openhab.transform.jsonpath/src/test/java/org/openhab/transform/jsonpath/internal/JSonPathTransformationServiceTest.java index 377f07c0a8cd8..acd0fbfa1d85b 100644 --- a/bundles/org.openhab.transform.jsonpath/src/test/java/org/openhab/transform/jsonpath/internal/JSonPathTransformationServiceTest.java +++ b/bundles/org.openhab.transform.jsonpath/src/test/java/org/openhab/transform/jsonpath/internal/JSonPathTransformationServiceTest.java @@ -33,7 +33,6 @@ public void init() { @Test public void testTransformByJSon() throws TransformationException { - String json = "{'store':{'book':[{'category':'reference','author':'Nigel Rees','title': 'Sayings of the Century', 'price': 8.95 } ], 'bicycle': { 'color': 'red', 'price': 19.95} }}"; // method under test String transformedResponse = processor.transform("$.store.book[0].author", json); diff --git a/bundles/org.openhab.transform.regex/src/test/java/org/openhab/transform/regex/internal/RegExTransformationServiceTest.java b/bundles/org.openhab.transform.regex/src/test/java/org/openhab/transform/regex/internal/RegExTransformationServiceTest.java index 0f42629e3eefd..b0f76aff32efa 100644 --- a/bundles/org.openhab.transform.regex/src/test/java/org/openhab/transform/regex/internal/RegExTransformationServiceTest.java +++ b/bundles/org.openhab.transform.regex/src/test/java/org/openhab/transform/regex/internal/RegExTransformationServiceTest.java @@ -17,7 +17,6 @@ import org.eclipse.smarthome.core.transform.TransformationException; import org.junit.Before; import org.junit.Test; -import org.openhab.transform.regex.internal.RegExTransformationService; /** * @author Thomas.Eichstaedt-Engelen @@ -33,7 +32,6 @@ public void init() { @Test public void testTransformByRegex() throws TransformationException { - // method under test String transformedResponse = processor.transform(".*?.*?.*? removeOlderResults(DiscoveryService source, long tim @Test public void startSearchIsCalled() { - final AtomicBoolean searchHasBeenTriggered = new AtomicBoolean(false); MockedHttpClient mockedHttpClient = new MockedHttpClient() { diff --git a/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/command/FCommandTest.java b/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/command/FCommandTest.java index d6871175d4205..69cea1d89a80f 100644 --- a/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/command/FCommandTest.java +++ b/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/command/FCommandTest.java @@ -32,7 +32,6 @@ public void PrefixTest() { assertEquals("f:", prefix); assertEquals("f:" + '\r' + '\n', commandStr); - } @Test diff --git a/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/message/NMessageTest.java b/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/message/NMessageTest.java index 6edbe7ff3abbd..1ef260d761f41 100644 --- a/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/message/NMessageTest.java +++ b/itests/org.openhab.binding.max.tests/src/main/java/org/openhab/binding/max/internal/message/NMessageTest.java @@ -37,14 +37,12 @@ public void before() { @Test public void getMessageTypeTest() { - MessageType messageType = ((Message) message).getType(); assertEquals(MessageType.N, messageType); } @Test public void getRFAddressTest() { - String rfAddress = message.getRfAddress(); assertEquals("0E15CC", rfAddress); diff --git a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusDataHandlerTest.java b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusDataHandlerTest.java index 524e021989b80..b1ddf0f2ea45f 100644 --- a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusDataHandlerTest.java +++ b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusDataHandlerTest.java @@ -280,7 +280,6 @@ private void testOutOfBoundsGeneric(int pollStart, int pollLength, String start, builder -> builder.withConfiguration(dataConfig), context); assertThat(dataHandler.getThing().getStatusInfo().getDescription(), dataHandler.getThing().getStatus(), is(equalTo(expectedStatus))); - } @Test @@ -804,7 +803,6 @@ public void testRefreshOnData() throws InterruptedException { */ private void testInitGeneric(ModbusReadFunctionCode pollerFunctionCode, Configuration config, Consumer statusConsumer) { - int pollLength = 3; Bridge parent; @@ -878,7 +876,6 @@ public void testReadOnlyDataMissingValueTypeWithRegisters() { assertThat(status.getStatus(), is(equalTo(ThingStatus.OFFLINE))); assertThat(status.getStatusDetail(), is(equalTo(ThingStatusDetail.CONFIGURATION_ERROR))); }); - } @Test @@ -1077,6 +1074,5 @@ public void testWriteTransformAndNecessary() { dataConfig.put("writeValueType", "int16"); dataConfig.put("writeTransform", "JS(myJsonTransform.js)"); testInitGeneric(null, dataConfig, status -> assertThat(status.getStatus(), is(equalTo(ThingStatus.ONLINE)))); - } } diff --git a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusPollerThingHandlerTest.java b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusPollerThingHandlerTest.java index 123e50f3effdb..9adc03215764c 100644 --- a/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusPollerThingHandlerTest.java +++ b/itests/org.openhab.binding.modbus.tests/src/main/java/org/openhab/binding/modbus/tests/ModbusPollerThingHandlerTest.java @@ -124,7 +124,6 @@ public void tearDown() { if (poller != null) { thingProvider.remove(poller.getUID()); } - } @Test @@ -182,7 +181,6 @@ public boolean matchesSafely(PollTask item) { @Override public void describeTo(Description description) { - } }; } @@ -236,7 +234,6 @@ public void describeTo(Description description) { protected boolean matchesSafely(PollTask item) { callbackRef.set(item.getCallback()); return checkPollTask(item, ModbusReadFunctionCode.READ_COILS); - } }), eq(150l), eq(0L)); verifyNoMoreInteractions(mockedModbusManager); @@ -258,12 +255,10 @@ public void describeTo(Description description) { protected boolean matchesSafely(PollTask item) { assertThat(item.getCallback(), is(sameInstance(callbackRef.get()))); return checkPollTask(item, ModbusReadFunctionCode.READ_COILS); - } })); verifyNoMoreInteractions(mockedModbusManager); - } @Test @@ -282,7 +277,6 @@ public void testInitializeWithNoBridge() assertThat(poller.getStatusInfo().getStatusDetail(), is(equalTo(ThingStatusDetail.BRIDGE_OFFLINE))); verifyNoMoreInteractions(mockedModbusManager); - } @Test @@ -715,6 +709,5 @@ public void testRefreshWithOldPreviousData() throws IllegalArgumentException, Il verify(mockedModbusManager, never()).submitOneTimePoll(any()); thingHandler.refresh(); verify(mockedModbusManager).submitOneTimePoll(any()); - } } diff --git a/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java b/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java index dbc9e211d8703..7767b889e023e 100644 --- a/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java +++ b/itests/org.openhab.binding.ntp.tests/src/main/java/org/openhab/binding/ntp/test/NtpOSGiTest.java @@ -209,7 +209,6 @@ public void testStringChannelTimeZoneUpdate() { @Test public void testDateTimeChannelTimeZoneUpdate() { - Configuration configuration = new Configuration(); configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID); initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null); @@ -388,7 +387,6 @@ private void initialize(Configuration configuration, String channelID, String ac private void initialize(Configuration configuration, String channelID, String acceptedItemType, Configuration channelConfiguration) { - configuration.put(NtpBindingConstants.PROPERTY_NTP_SERVER_PORT, TEST_PORT); ThingUID ntpUid = new ThingUID(NtpBindingConstants.THING_TYPE_NTP, TEST_THING_ID); diff --git a/itests/org.openhab.binding.systeminfo.tests/src/main/java/org/openhab/binding/systeminfo/test/SysteminfoOSGiTest.java b/itests/org.openhab.binding.systeminfo.tests/src/main/java/org/openhab/binding/systeminfo/test/SysteminfoOSGiTest.java index fcfec04459248..742a7c5f6f6b7 100644 --- a/itests/org.openhab.binding.systeminfo.tests/src/main/java/org/openhab/binding/systeminfo/test/SysteminfoOSGiTest.java +++ b/itests/org.openhab.binding.systeminfo.tests/src/main/java/org/openhab/binding/systeminfo/test/SysteminfoOSGiTest.java @@ -107,7 +107,6 @@ public class SysteminfoOSGiTest extends JavaOSGiTest { @Before public void setUp() { - VolatileStorageService volatileStorageService = new VolatileStorageService(); registerService(volatileStorageService); @@ -265,7 +264,6 @@ private void assertItemState(String acceptedItemType, String itemName, String pr State itemState = item.getState(); assertThat(itemState, is(equalTo(expectedState))); }, waitTime, DFL_SLEEP_TIME); - } private void intializeItem(ChannelUID channelUID, String itemName, String acceptedItemType) { @@ -942,7 +940,6 @@ private void testDiscoveryService(String expectedHostname, String hostname) { waitForAssert(() -> { assertThat("Thing is not initialized.", systemInfoThing.getStatus(), is(equalTo(ThingStatus.ONLINE))); }); - } @Test