diff --git a/homeassistant/components/avion/light.py b/homeassistant/components/avion/light.py index 0d242b952dd..fcc780f77bc 100644 --- a/homeassistant/components/avion/light.py +++ b/homeassistant/components/avion/light.py @@ -65,49 +65,17 @@ def setup_platform(hass, config, add_entities, discovery_info=None): class AvionLight(LightEntity): """Representation of an Avion light.""" + _attr_supported_features = SUPPORT_AVION_LED + _attr_should_poll = False + _attr_assumed_state = True + def __init__(self, device): """Initialize the light.""" - self._name = device.name - self._address = device.mac - self._brightness = 255 - self._state = False + self._attr_name = device.name + self._attr_unique_id = device.mac + self._attr_brightness = 255 self._switch = device - @property - def unique_id(self): - """Return the ID of this light.""" - return self._address - - @property - def name(self): - """Return the name of the device if any.""" - return self._name - - @property - def is_on(self): - """Return true if device is on.""" - return self._state - - @property - def brightness(self): - """Return the brightness of this light between 0..255.""" - return self._brightness - - @property - def supported_features(self): - """Flag supported features.""" - return SUPPORT_AVION_LED - - @property - def should_poll(self): - """Don't poll.""" - return False - - @property - def assumed_state(self): - """We can't read the actual state, so assume it matches.""" - return True - def set_state(self, brightness): """Set the state of this lamp to the provided brightness.""" avion = importlib.import_module("avion") @@ -130,12 +98,12 @@ class AvionLight(LightEntity): brightness = kwargs.get(ATTR_BRIGHTNESS) if brightness is not None: - self._brightness = brightness + self._attr_brightness = brightness self.set_state(self.brightness) - self._state = True + self._attr_is_on = True def turn_off(self, **kwargs): """Turn the specified or all lights off.""" self.set_state(0) - self._state = False + self._attr_is_on = False