Collection of changing entity properties to class attributes (#51248)
* Collection of changing entity properties to class attributes * Apply suggestions from code review Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
@@ -240,6 +240,8 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
||||
class UpCloudServerEntity(CoordinatorEntity):
|
||||
"""Entity class for UpCloud servers."""
|
||||
|
||||
_attr_device_class = DEFAULT_COMPONENT_DEVICE_CLASS
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator[dict[str, upcloud_api.Server]],
|
||||
@@ -284,11 +286,6 @@ class UpCloudServerEntity(CoordinatorEntity):
|
||||
"""Return true if the server is on."""
|
||||
return self.state == STATE_ON
|
||||
|
||||
@property
|
||||
def device_class(self) -> str:
|
||||
"""Return the class of this server."""
|
||||
return DEFAULT_COMPONENT_DEVICE_CLASS
|
||||
|
||||
@property
|
||||
def extra_state_attributes(self) -> dict[str, Any]:
|
||||
"""Return the state attributes of the UpCloud server."""
|
||||
|
||||
Reference in New Issue
Block a user