mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Use entity class attributes for anthemav (#52602)
This commit is contained in:
parent
1dd4ba5fcd
commit
7d0751df8a
@ -82,11 +82,14 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||||||
class AnthemAVR(MediaPlayerEntity):
|
class AnthemAVR(MediaPlayerEntity):
|
||||||
"""Entity reading values from Anthem AVR protocol."""
|
"""Entity reading values from Anthem AVR protocol."""
|
||||||
|
|
||||||
|
_attr_should_poll = False
|
||||||
|
_attr_supported_features = SUPPORT_ANTHEMAV
|
||||||
|
|
||||||
def __init__(self, avr, name):
|
def __init__(self, avr, name):
|
||||||
"""Initialize entity with transport."""
|
"""Initialize entity with transport."""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.avr = avr
|
self.avr = avr
|
||||||
self._name = name
|
self._attr_name = name or self._lookup("model")
|
||||||
|
|
||||||
def _lookup(self, propname, dval=None):
|
def _lookup(self, propname, dval=None):
|
||||||
return getattr(self.avr.protocol, propname, dval)
|
return getattr(self.avr.protocol, propname, dval)
|
||||||
@ -97,21 +100,6 @@ class AnthemAVR(MediaPlayerEntity):
|
|||||||
async_dispatcher_connect(self.hass, DOMAIN, self.async_write_ha_state)
|
async_dispatcher_connect(self.hass, DOMAIN, self.async_write_ha_state)
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
|
||||||
def supported_features(self):
|
|
||||||
"""Flag media player features that are supported."""
|
|
||||||
return SUPPORT_ANTHEMAV
|
|
||||||
|
|
||||||
@property
|
|
||||||
def should_poll(self):
|
|
||||||
"""No polling needed."""
|
|
||||||
return False
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Return name of device."""
|
|
||||||
return self._name or self._lookup("model")
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
"""Return state of power on/off."""
|
"""Return state of power on/off."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user