Skip to content
Snippets Groups Projects
Unverified Commit b855177f authored by J. Nick Koston's avatar J. Nick Koston Committed by GitHub
Browse files

Make homekit aware of STATE_STANDBY (#33679)

parent de317fb2
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment