From 57e88dfa81d181a8acbbb1f26c0c3508ef222ec6 Mon Sep 17 00:00:00 2001 From: Markus Zehnder Date: Mon, 18 Mar 2024 13:35:34 +0100 Subject: [PATCH] fix: don't turn device on in standby with off command Relates to unfoldedcircle/feature-and-bug-tracker#349 --- intg-appletv/driver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intg-appletv/driver.py b/intg-appletv/driver.py index a2a90bf..f754a08 100644 --- a/intg-appletv/driver.py +++ b/intg-appletv/driver.py @@ -157,7 +157,10 @@ async def media_player_cmd_handler( # If the entity is OFF (device is in standby), we turn it on regardless of the actual command # TODO #15 implement proper fix for correct entity OFF state (it may not remain in OFF state if connection is # established) + online check if we think it is in standby mode. - if configured_entity.attributes[media_player.Attributes.STATE] == media_player.States.OFF: + if ( + configured_entity.attributes[media_player.Attributes.STATE] == media_player.States.OFF + and cmd_id != media_player.Commands.OFF + ): _LOG.debug("Device is off, sending turn on command") # quick & dirty workaround for #15: the entity state is not always correct! res = await device.turn_on()