]> git.basschouten.com Git - openhab-addons.git/commitdiff
[homeconnect] Undo PR 10754 (#10792)
authorlolodomo <lg.hc@free.fr>
Sat, 5 Jun 2021 18:08:51 +0000 (20:08 +0200)
committerGitHub <noreply@github.com>
Sat, 5 Jun 2021 18:08:51 +0000 (20:08 +0200)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
bundles/org.openhab.binding.homeconnect/src/main/java/org/openhab/binding/homeconnect/internal/handler/AbstractHomeConnectThingHandler.java

index e6e370a273768a0e77712d44cd3a2c1f74f3717d..8c15a57ef79393026f9dfdd7e5bbf4667db7806e 100644 (file)
@@ -868,7 +868,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
                 String programKey = programOptionsDelayedUpdate;
                 if (programKey != null && Boolean.parseBoolean(event.getValue())) {
                     logger.debug("Delayed update of options for program {}", programKey);
-                    updateProgramOptionsStateDescriptions(programKey, null);
+                    updateProgramOptionsStateDescriptions(programKey);
                     programOptionsDelayedUpdate = null;
                 }
             } catch (CommunicationException | ApplianceOfflineException | AuthorizationException e) {
@@ -892,7 +892,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
                         logger.debug("Delay update of options for program {}", programKey);
                         programOptionsDelayedUpdate = programKey;
                     } else {
-                        updateProgramOptionsStateDescriptions(programKey, null);
+                        updateProgramOptionsStateDescriptions(programKey);
                     }
                 }
             } catch (CommunicationException | ApplianceOfflineException | AuthorizationException e) {
@@ -1061,7 +1061,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
                 Program program = apiClient.get().getSelectedProgram(getThingHaId());
 
                 if (program != null) {
-                    updateProgramOptionsStateDescriptions(program.getKey(), program.getOptions());
+                    updateProgramOptionsStateDescriptions(program.getKey());
                     processProgramOptions(program.getOptions());
 
                     return new StringType(program.getKey());
@@ -1367,7 +1367,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
         return mapStringType(value);
     }
 
-    protected void updateProgramOptionsStateDescriptions(String programKey, @Nullable List<Option> optionsValues)
+    protected void updateProgramOptionsStateDescriptions(String programKey)
             throws CommunicationException, AuthorizationException, ApplianceOfflineException {
         Optional<HomeConnectApiClient> apiClient = getApiClient();
         if (apiClient.isPresent()) {
@@ -1387,43 +1387,12 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
             Optional<Channel> channelDryingTarget = getThingChannel(CHANNEL_DRYER_DRYING_TARGET);
 
             if (availableProgramOptions.isEmpty()) {
-                List<Option> options;
-                if (optionsValues != null) {
-                    options = optionsValues;
-                } else if (channelSpinSpeed.isPresent() || channelTemperature.isPresent()
-                        || channelDryingTarget.isPresent()) {
-                    Program program = apiClient.get().getSelectedProgram(getThingHaId());
-                    options = program != null ? program.getOptions() : emptyList();
-                } else {
-                    options = emptyList();
-                }
-
-                channelSpinSpeed.ifPresent(channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(),
-                        options.stream()
-                                .filter(option -> option.getKey() != null && option.getValue() != null
-                                        && OPTION_WASHER_SPIN_SPEED.equals(option.getKey()))
-                                .map(option -> option.getValue())
-                                .map(value -> new StateOption(value == null ? "" : value,
-                                        convertWasherSpinSpeed(value == null ? "" : value)))
-                                .collect(Collectors.toList())));
-                channelTemperature
-                        .ifPresent(channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(),
-                                options.stream()
-                                        .filter(option -> option.getKey() != null && option.getValue() != null
-                                                && OPTION_WASHER_TEMPERATURE.equals(option.getKey()))
-                                        .map(option -> option.getValue())
-                                        .map(value -> new StateOption(value == null ? "" : value,
-                                                convertWasherTemperature(value == null ? "" : value)))
-                                        .collect(Collectors.toList())));
-                channelDryingTarget
-                        .ifPresent(channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(),
-                                options.stream()
-                                        .filter(option -> option.getKey() != null && option.getValue() != null
-                                                && OPTION_DRYER_DRYING_TARGET.equals(option.getKey()))
-                                        .map(option -> option.getValue())
-                                        .map(value -> new StateOption(value == null ? "" : value,
-                                                mapStringType(value == null ? "" : value)))
-                                        .collect(Collectors.toList())));
+                channelSpinSpeed.ifPresent(
+                        channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
+                channelTemperature.ifPresent(
+                        channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
+                channelDryingTarget.ifPresent(
+                        channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
             }
 
             availableProgramOptions.forEach(option -> {