Rename [blueprint|Blueprint] -> [integration_blueprint|Integration blueprint] (#47)
This commit is contained in:
33
custom_components/integration_blueprint/entity.py
Normal file
33
custom_components/integration_blueprint/entity.py
Normal file
@ -0,0 +1,33 @@
|
||||
"""BlueprintEntity class"""
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN, NAME, VERSION, ATTRIBUTION
|
||||
|
||||
|
||||
class IntegrationBlueprintEntity(CoordinatorEntity):
|
||||
def __init__(self, coordinator, config_entry):
|
||||
super().__init__(coordinator)
|
||||
self.config_entry = config_entry
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique ID to use for this entity."""
|
||||
return self.config_entry.entry_id
|
||||
|
||||
@property
|
||||
def device_info(self):
|
||||
return {
|
||||
"identifiers": {(DOMAIN, self.unique_id)},
|
||||
"name": NAME,
|
||||
"model": VERSION,
|
||||
"manufacturer": NAME,
|
||||
}
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
return {
|
||||
"attribution": ATTRIBUTION,
|
||||
"id": str(self.coordinator.data.get("id")),
|
||||
"integration": DOMAIN,
|
||||
}
|
Reference in New Issue
Block a user