Add activity properties to remote entity model (#47237)
This commit is contained in:
parent
6019bcf9d1
commit
32fe4fa378
3 changed files with 41 additions and 7 deletions
|
@ -12,6 +12,7 @@ from homeassistant.components.remote import (
|
|||
ATTR_HOLD_SECS,
|
||||
ATTR_NUM_REPEATS,
|
||||
DEFAULT_DELAY_SECS,
|
||||
SUPPORT_ACTIVITY,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_ENTITY_ID
|
||||
|
@ -24,9 +25,7 @@ from homeassistant.helpers.restore_state import RestoreEntity
|
|||
from .connection_state import ConnectionStateMixin
|
||||
from .const import (
|
||||
ACTIVITY_POWER_OFF,
|
||||
ATTR_ACTIVITY_LIST,
|
||||
ATTR_ACTIVITY_STARTING,
|
||||
ATTR_CURRENT_ACTIVITY,
|
||||
ATTR_DEVICES_LIST,
|
||||
ATTR_LAST_ACTIVITY,
|
||||
DOMAIN,
|
||||
|
@ -100,6 +99,11 @@ class HarmonyRemote(ConnectionStateMixin, remote.RemoteEntity, RestoreEntity):
|
|||
self._last_activity = None
|
||||
self._config_path = out_path
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Supported features for the remote."""
|
||||
return SUPPORT_ACTIVITY
|
||||
|
||||
async def _async_update_options(self, data):
|
||||
"""Change options when the options flow does."""
|
||||
if ATTR_DELAY_SECS in data:
|
||||
|
@ -178,13 +182,21 @@ class HarmonyRemote(ConnectionStateMixin, remote.RemoteEntity, RestoreEntity):
|
|||
"""Return the fact that we should not be polled."""
|
||||
return False
|
||||
|
||||
@property
|
||||
def current_activity(self):
|
||||
"""Return the current activity."""
|
||||
return self._current_activity
|
||||
|
||||
@property
|
||||
def activity_list(self):
|
||||
"""Return the available activities."""
|
||||
return self._data.activity_names
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Add platform specific attributes."""
|
||||
return {
|
||||
ATTR_ACTIVITY_STARTING: self._activity_starting,
|
||||
ATTR_CURRENT_ACTIVITY: self._current_activity,
|
||||
ATTR_ACTIVITY_LIST: self._data.activity_names,
|
||||
ATTR_DEVICES_LIST: self._data.device_names,
|
||||
ATTR_LAST_ACTIVITY: self._last_activity,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue