mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[chromecast] Fix STOP command
Fixes #14516 Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
parent
177d75e7dd
commit
cb9ff7aae3
@ -128,7 +128,18 @@ public class ChromecastCommander {
|
||||
|
||||
public void handleCloseApp(final Command command) {
|
||||
if (command == OnOffType.ON) {
|
||||
closeApp(MEDIA_PLAYER);
|
||||
Application app;
|
||||
try {
|
||||
app = chromeCast.getRunningApp();
|
||||
} catch (final IOException e) {
|
||||
logger.info("{} command failed: {}", command, e.getMessage());
|
||||
statusUpdater.updateStatus(ThingStatus.OFFLINE, COMMUNICATION_ERROR, e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (app != null) {
|
||||
closeApp(app.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -250,13 +261,13 @@ public class ChromecastCommander {
|
||||
try {
|
||||
if (chromeCast.isAppRunning(appId)) {
|
||||
Application app = chromeCast.getRunningApp();
|
||||
if (app.id.equals(appId) && app.sessionId.equals(statusUpdater.getAppSessionId())) {
|
||||
if (app.id.equals(appId)) {
|
||||
chromeCast.stopApp();
|
||||
logger.debug("Application closed: {}", appId);
|
||||
}
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
logger.debug("Failed stopping media player app: {} with message: {}", appId, e.getMessage());
|
||||
logger.debug("Failed stopping app: {} with message: {}", appId, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user