From 7d0751df8a4f1b47e597dadfbe42031e11403409 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 8 Jul 2021 05:42:07 -0400 Subject: [PATCH] Use entity class attributes for anthemav (#52602) --- .../components/anthemav/media_player.py | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/anthemav/media_player.py b/homeassistant/components/anthemav/media_player.py index 788fa8db7eb..18b2e704538 100644 --- a/homeassistant/components/anthemav/media_player.py +++ b/homeassistant/components/anthemav/media_player.py @@ -82,11 +82,14 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class AnthemAVR(MediaPlayerEntity): """Entity reading values from Anthem AVR protocol.""" + _attr_should_poll = False + _attr_supported_features = SUPPORT_ANTHEMAV + def __init__(self, avr, name): """Initialize entity with transport.""" super().__init__() self.avr = avr - self._name = name + self._attr_name = name or self._lookup("model") def _lookup(self, propname, dval=None): 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) ) - @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 def state(self): """Return state of power on/off."""