Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lgwebos] Use channel id as state for the channel channel #7624

Merged
merged 1 commit into from
May 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onSuccess(List<ChannelInfo> channels) {
List<StateOption> options = new ArrayList<>();
for (ChannelInfo channel : channels) {
String name = channel.getName() == null ? "" : channel.getName();
options.add(new StateOption(channel.getChannelNumber(), channel.getChannelNumber() + " - " + name));
options.add(new StateOption(channel.getId(), channel.getChannelNumber() + " - " + name));
}
handler.setOptions(channelId, options);
}
Expand All @@ -91,8 +91,8 @@ public void onReceiveCommand(String channelId, LGWebOSHandler handler, Command c
logger.warn("No channel list cached for this device {}, ignoring command.",
handler.getThing().getUID().toString());
} else {
Optional<ChannelInfo> channelInfo = channels.stream().filter(c -> c.getChannelNumber().equals(value))
.findFirst();
Optional<ChannelInfo> channelInfo = channels.stream()
.filter(c -> c.getId().equals(value) || c.getChannelNumber().equals(value)).findFirst();
if (channelInfo.isPresent()) {
handler.getSocket().setChannel(channelInfo.get(), objResponseListener);
} else {
Expand All @@ -119,7 +119,7 @@ public void onSuccess(@Nullable ChannelInfo channelInfo) {
if (channelInfo == null) {
return;
}
handler.postUpdate(channelId, new StringType(channelInfo.getChannelNumber()));
handler.postUpdate(channelId, new StringType(channelInfo.getId()));
}
};
}
Expand Down