def toggle(self):
        if self.state in [STATE_OFF, STATE_IDLE]:
            self.turn_on()
        else:
            self.turn_off()
Toggle the power on the media player.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/media_player/__init__.py/MediaPlayerDevice.toggle