[homeconnect] Undo PR 10754 (#10792)
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
parent
d454fe3331
commit
33b7fd6e98
|
@ -868,7 +868,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
|
||||||
String programKey = programOptionsDelayedUpdate;
|
String programKey = programOptionsDelayedUpdate;
|
||||||
if (programKey != null && Boolean.parseBoolean(event.getValue())) {
|
if (programKey != null && Boolean.parseBoolean(event.getValue())) {
|
||||||
logger.debug("Delayed update of options for program {}", programKey);
|
logger.debug("Delayed update of options for program {}", programKey);
|
||||||
updateProgramOptionsStateDescriptions(programKey, null);
|
updateProgramOptionsStateDescriptions(programKey);
|
||||||
programOptionsDelayedUpdate = null;
|
programOptionsDelayedUpdate = null;
|
||||||
}
|
}
|
||||||
} catch (CommunicationException | ApplianceOfflineException | AuthorizationException e) {
|
} 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);
|
logger.debug("Delay update of options for program {}", programKey);
|
||||||
programOptionsDelayedUpdate = programKey;
|
programOptionsDelayedUpdate = programKey;
|
||||||
} else {
|
} else {
|
||||||
updateProgramOptionsStateDescriptions(programKey, null);
|
updateProgramOptionsStateDescriptions(programKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CommunicationException | ApplianceOfflineException | AuthorizationException e) {
|
} catch (CommunicationException | ApplianceOfflineException | AuthorizationException e) {
|
||||||
|
@ -1061,7 +1061,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
|
||||||
Program program = apiClient.get().getSelectedProgram(getThingHaId());
|
Program program = apiClient.get().getSelectedProgram(getThingHaId());
|
||||||
|
|
||||||
if (program != null) {
|
if (program != null) {
|
||||||
updateProgramOptionsStateDescriptions(program.getKey(), program.getOptions());
|
updateProgramOptionsStateDescriptions(program.getKey());
|
||||||
processProgramOptions(program.getOptions());
|
processProgramOptions(program.getOptions());
|
||||||
|
|
||||||
return new StringType(program.getKey());
|
return new StringType(program.getKey());
|
||||||
|
@ -1367,7 +1367,7 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
|
||||||
return mapStringType(value);
|
return mapStringType(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateProgramOptionsStateDescriptions(String programKey, @Nullable List<Option> optionsValues)
|
protected void updateProgramOptionsStateDescriptions(String programKey)
|
||||||
throws CommunicationException, AuthorizationException, ApplianceOfflineException {
|
throws CommunicationException, AuthorizationException, ApplianceOfflineException {
|
||||||
Optional<HomeConnectApiClient> apiClient = getApiClient();
|
Optional<HomeConnectApiClient> apiClient = getApiClient();
|
||||||
if (apiClient.isPresent()) {
|
if (apiClient.isPresent()) {
|
||||||
|
@ -1387,43 +1387,12 @@ public abstract class AbstractHomeConnectThingHandler extends BaseThingHandler i
|
||||||
Optional<Channel> channelDryingTarget = getThingChannel(CHANNEL_DRYER_DRYING_TARGET);
|
Optional<Channel> channelDryingTarget = getThingChannel(CHANNEL_DRYER_DRYING_TARGET);
|
||||||
|
|
||||||
if (availableProgramOptions.isEmpty()) {
|
if (availableProgramOptions.isEmpty()) {
|
||||||
List<Option> options;
|
channelSpinSpeed.ifPresent(
|
||||||
if (optionsValues != null) {
|
channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
|
||||||
options = optionsValues;
|
channelTemperature.ifPresent(
|
||||||
} else if (channelSpinSpeed.isPresent() || channelTemperature.isPresent()
|
channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
|
||||||
|| channelDryingTarget.isPresent()) {
|
channelDryingTarget.ifPresent(
|
||||||
Program program = apiClient.get().getSelectedProgram(getThingHaId());
|
channel -> dynamicStateDescriptionProvider.setStateOptions(channel.getUID(), emptyList()));
|
||||||
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())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
availableProgramOptions.forEach(option -> {
|
availableProgramOptions.forEach(option -> {
|
||||||
|
|
Loading…
Reference in New Issue