Skip to content
Closed
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
8 changes: 7 additions & 1 deletion src/util/hass-media-player-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,19 @@ export default class MediaPlayerEntity {
}

togglePower() {
Comment thread
ktnrg45 marked this conversation as resolved.
if (this.isOff) {
if (this.supportsTurnOn && this.supportsTurnOff) {
Copy link
Copy Markdown
Contributor Author

@ktnrg45 ktnrg45 Feb 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition may not be necessary, we may be able to simply call toggle(). The Plex integration seems to be the only media_player that supports 'turnoff' but not 'turnon'. Used grep -rl 'SUPPORT_TURN_ON' homeassistant/components/*/media_player.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly the Plex integration should probably not advertise as supporting either power on/off as it doesn't have the ability to do either.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more that can't turn on. Philips js, arcam. They can support it with external wol or it blasters.

this.toggle();
} else if (this.isOff) {
this.turnOn();
} else {
this.turnOff();
}
}

toggle() {
this.callService("toggle");
}

turnOff() {
this.callService("turn_off");
}
Expand Down