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
72028f7a86
commit
5a447375a4
@ -128,7 +128,18 @@ public class ChromecastCommander {
|
|||||||
|
|
||||||
public void handleCloseApp(final Command command) {
|
public void handleCloseApp(final Command command) {
|
||||||
if (command == OnOffType.ON) {
|
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 {
|
try {
|
||||||
if (chromeCast.isAppRunning(appId)) {
|
if (chromeCast.isAppRunning(appId)) {
|
||||||
Application app = chromeCast.getRunningApp();
|
Application app = chromeCast.getRunningApp();
|
||||||
if (app.id.equals(appId) && app.sessionId.equals(statusUpdater.getAppSessionId())) {
|
if (app.id.equals(appId)) {
|
||||||
chromeCast.stopApp();
|
chromeCast.stopApp();
|
||||||
logger.debug("Application closed: {}", appId);
|
logger.debug("Application closed: {}", appId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (final IOException e) {
|
} 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