Checking state before actually sending a new state change. Some projectors return ERR if you try to turn off a projector that's already off. (#28529)
This commit is contained in:
parent
6e58a0c996
commit
f5fb9fc580
1 changed files with 6 additions and 4 deletions
|
@ -158,11 +158,13 @@ class PjLinkDevice(MediaPlayerDevice):
|
|||
|
||||
def turn_off(self):
|
||||
"""Turn projector off."""
|
||||
if self._pwstate == STATE_ON:
|
||||
with self.projector() as projector:
|
||||
projector.set_power("off")
|
||||
|
||||
def turn_on(self):
|
||||
"""Turn projector on."""
|
||||
if self._pwstate == STATE_OFF:
|
||||
with self.projector() as projector:
|
||||
projector.set_power("on")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue