mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Make homekit aware of STATE_STANDBY (#33679)
This commit is contained in:
parent
de317fb2f6
commit
b855177fe6
@ -33,6 +33,7 @@ from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
STATE_PAUSED,
|
||||
STATE_PLAYING,
|
||||
STATE_STANDBY,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
|
||||
@ -190,7 +191,12 @@ class MediaPlayer(HomeAccessory):
|
||||
current_state = new_state.state
|
||||
|
||||
if self.chars[FEATURE_ON_OFF]:
|
||||
hk_state = current_state not in (STATE_OFF, STATE_UNKNOWN, "None")
|
||||
hk_state = current_state not in (
|
||||
STATE_OFF,
|
||||
STATE_UNKNOWN,
|
||||
STATE_STANDBY,
|
||||
"None",
|
||||
)
|
||||
if not self._flag[FEATURE_ON_OFF]:
|
||||
_LOGGER.debug(
|
||||
'%s: Set current state for "on_off" to %s', self.entity_id, hk_state
|
||||
|
@ -30,6 +30,7 @@ from homeassistant.const import (
|
||||
STATE_ON,
|
||||
STATE_PAUSED,
|
||||
STATE_PLAYING,
|
||||
STATE_STANDBY,
|
||||
)
|
||||
from homeassistant.core import CoreState
|
||||
from homeassistant.helpers import entity_registry
|
||||
@ -75,6 +76,14 @@ async def test_media_player_set_state(hass, hk_driver, events):
|
||||
await hass.async_block_till_done()
|
||||
assert acc.chars[FEATURE_ON_OFF].value is False
|
||||
|
||||
hass.states.async_set(entity_id, STATE_ON)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.chars[FEATURE_ON_OFF].value is True
|
||||
|
||||
hass.states.async_set(entity_id, STATE_STANDBY)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.chars[FEATURE_ON_OFF].value is False
|
||||
|
||||
hass.states.async_set(entity_id, STATE_PLAYING)
|
||||
await hass.async_block_till_done()
|
||||
assert acc.chars[FEATURE_PLAY_PAUSE].value is True
|
||||
|
Loading…
x
Reference in New Issue
Block a user