Move attribution to standalone attribute [c-d] (#80150)

This commit is contained in:
epenet 2022-10-12 11:38:43 +02:00 committed by GitHub
parent 237b03150e
commit e9e3fb1cc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 20 additions and 45 deletions

View file

@ -7,7 +7,6 @@ from typing import Any
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import ATTR_ATTRIBUTION
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity_platform import AddEntitiesCallback
@ -62,6 +61,8 @@ def setup_platform(
class DigitalOceanSwitch(SwitchEntity):
"""Representation of a Digital Ocean droplet switch."""
_attr_attribution = ATTRIBUTION
def __init__(self, do, droplet_id): # pylint: disable=invalid-name
"""Initialize a new Digital Ocean sensor."""
self._digital_ocean = do
@ -83,7 +84,6 @@ class DigitalOceanSwitch(SwitchEntity):
def extra_state_attributes(self):
"""Return the state attributes of the Digital Ocean droplet."""
return {
ATTR_ATTRIBUTION: ATTRIBUTION,
ATTR_CREATED_AT: self.data.created_at,
ATTR_DROPLET_ID: self.data.id,
ATTR_DROPLET_NAME: self.data.name,